/* Generated by Cython 3.1.0 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "amplpy/amplpython/cppinterface/include/ampl/ampl_c.h"
        ],
        "extra_compile_args": [
            "-Wno-stringop-truncation",
            "-Wno-catch-value",
            "-Wno-unused-variable"
        ],
        "extra_link_args": [
            "-Wl,-rpath,$ORIGIN/amplpython/cppinterface/lib/amd64"
        ],
        "include_dirs": [
            "amplpy/amplpython/cppinterface/include"
        ],
        "libraries": [
            "ampl"
        ],
        "library_dirs": [
            "amplpy/amplpython/cppinterface/lib/amd64"
        ],
        "name": "amplpy.ampl",
        "sources": [
            "amplpy/ampl.pyx"
        ]
    },
    "module_name": "amplpy.ampl"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API) && !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
#endif

#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_1_0"
#define CYTHON_HEX_VERSION 0x030100F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #define HAVE_LONG_LONG
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_CLINE_IN_TRACEBACK
  #define CYTHON_CLINE_IN_TRACEBACK 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
#endif
#endif
#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
#if CYTHON_USE_PYLONG_INTERNALS
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
            typedef unsigned char     uint8_t;
            typedef unsigned short    uint16_t;
            typedef unsigned int      uint32_t;
        #else
            typedef unsigned __int8   uint8_t;
            typedef unsigned __int16  uint16_t;
            typedef unsigned __int32  uint32_t;
        #endif
    #endif
    #if _MSC_VER < 1300
        #ifdef _WIN64
            typedef unsigned long long  __pyx_uintptr_t;
        #else
            typedef unsigned int        __pyx_uintptr_t;
        #endif
    #else
        #ifdef _WIN64
            typedef unsigned __int64    __pyx_uintptr_t;
        #else
            typedef unsigned __int32    __pyx_uintptr_t;
        #endif
    #endif
#else
    #include <stdint.h>
    typedef uintptr_t  __pyx_uintptr_t;
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#ifndef Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CInitCode */
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef METH_FASTCALL
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#elif CYTHON_BACKPORT_VECTORCALL
  typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
                                            size_t nargsf, PyObject *kwnames);
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  ((size_t)1 << (8 * sizeof(size_t) - 1))
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if __PYX_LIMITED_VERSION_HEX < 0x03090000
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((int)PyUnicode_KIND(u))
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_GetItem(o, i)
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__amplpy__ampl
#define __PYX_HAVE_API__amplpy__ampl
/* Early includes */
#include <stdint.h>
#include "ampl/ampl_c.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

    #if PY_MAJOR_VERSION >= 3
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj)
    #else
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj, NULL)
    #endif
    
#include <stddef.h>

    #if PY_MAJOR_VERSION <= 2
    #define PyDict_GetItemWithError _PyDict_GetItemWithError
    #endif
    

    #if PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int __Pyx_PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
    {
        PyObject *obj = PyWeakref_GetObject(ref);
        if (obj == NULL) {
            // SystemError if ref is NULL
            *pobj = NULL;
            return -1;
        }
        if (obj == Py_None) {
            *pobj = NULL;
            return 0;
        }
        Py_INCREF(obj);
        *pobj = obj;
        return 1;
    }
    #else
    #define __Pyx_PyWeakref_GetRef PyWeakref_GetRef
    #endif
    
#include "pythread.h"

    #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600) && !defined(PyContextVar_Get)
    #define PyContextVar_Get(var, d, v)         ((d) ?             ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) :             ((v)[0] = NULL, 0)         )
    #endif
    
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
/* PretendToInitialize */
#ifdef __cplusplus
#include <type_traits>
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * const __pyx_cfilenm = __FILE__;
static const char *__pyx_filename;

/* #### Code section: filename_table ### */

static const char* const __pyx_f[] = {
  "amplpy/ampl.pyx",
  "amplpy/dataframe.pxi",
  "amplpy/exceptions.pxi",
  "amplpy/outputhandler.pxi",
  "amplpy/util.pxi",
  "amplpy/constraint.pxi",
  "amplpy/iterators.pxi",
  "cpython/contextvars.pxd",
  "<stringsource>",
  "amplpy/dataframe_arrow.pxi",
  "amplpy/entity.pxi",
  "amplpy/environment.pxi",
  "amplpy/errorhandler.pxi",
  "amplpy/objective.pxi",
  "amplpy/parameter.pxi",
  "amplpy/set.pxi",
  "amplpy/variable.pxi",
  "cpython/bool.pxd",
  "cpython/type.pxd",
  "cpython/complex.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* Atomics.proto */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview))
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview))
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif

/* IncludeStructmemberH.proto */
#include <structmember.h>

/* CriticalSections.proto */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_Begin1(cs, arg) (void)cs
#define __Pyx_PyCriticalSection_Begin2(cs, arg1, arg2) (void)cs
#define __Pyx_PyCriticalSection_End1(cs)
#define __Pyx_PyCriticalSection_End2(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_Begin1 PyCriticalSection_Begin
#define __Pyx_PyCriticalSection_Begin2 PyCriticalSection2_Begin
#define __Pyx_PyCriticalSection_End1 PyCriticalSection_End
#define __Pyx_PyCriticalSection_End2 PyCriticalSection2_End
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#endif

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* #### Code section: numeric_typedefs ### */
/* #### Code section: complex_type_declarations ### */
/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
struct __pyx_obj_6amplpy_4ampl_Row;
struct __pyx_obj_6amplpy_4ampl_Column;
struct __pyx_obj_6amplpy_4ampl_DataFrame;
struct __pyx_obj_6amplpy_4ampl_DataFrameArrow;
struct __pyx_obj_6amplpy_4ampl_Entity;
struct __pyx_obj_6amplpy_4ampl_Constraint;
struct __pyx_obj_6amplpy_4ampl_Environment;
struct __pyx_obj_6amplpy_4ampl_ErrorHandler;
struct __pyx_obj_6amplpy_4ampl_AMPLException;
struct __pyx_obj_6amplpy_4ampl_EnvIterator;
struct __pyx_obj_6amplpy_4ampl_EntityMap;
struct __pyx_obj_6amplpy_4ampl_InstanceIterator;
struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator;
struct __pyx_obj_6amplpy_4ampl_ColIterator;
struct __pyx_obj_6amplpy_4ampl_RowIterator;
struct __pyx_obj_6amplpy_4ampl_Objective;
struct __pyx_obj_6amplpy_4ampl_OutputHandler;
struct __pyx_obj_6amplpy_4ampl_Parameter;
struct __pyx_obj_6amplpy_4ampl_Set;
struct __pyx_obj_6amplpy_4ampl_Variable;
struct __pyx_obj_6amplpy_4ampl_AMPL;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr;
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr;
struct __pyx_opt_args_7cpython_11contextvars_get_value;
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;

/* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value {
  int __pyx_n;
  PyObject *default_value;
};

/* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
  int __pyx_n;
  PyObject *default_value;
};

/* "amplpy/dataframe.pxi":21
 * 
 * 
 * cdef class Row(object):             # <<<<<<<<<<<<<<
 *     """
 *     Represents a row in a :class:`~amplpy.DataFrame`.
*/
struct __pyx_obj_6amplpy_4ampl_Row {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_Row *__pyx_vtab;
  AMPL_DATAFRAME *_df;
  size_t _index;
};


/* "amplpy/dataframe.pxi":53
 * 
 * 
 * cdef class Column(object):             # <<<<<<<<<<<<<<
 *     """
 *     Represents a column in a :class:`~amplpy.DataFrame`.
*/
struct __pyx_obj_6amplpy_4ampl_Column {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_Column *__pyx_vtab;
  AMPL_DATAFRAME *_df;
  size_t _index;
};


/* "amplpy/dataframe.pxi":92
 * 
 * 
 * cdef class DataFrame(object):             # <<<<<<<<<<<<<<
 *     """
 *     A DataFrame object, used to communicate data to and from the AMPL entities.
*/
struct __pyx_obj_6amplpy_4ampl_DataFrame {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame *__pyx_vtab;
  AMPL_DATAFRAME *_c_df;
};


/* "amplpy/dataframe_arrow.pxi":32
 * 
 * 
 * cdef class DataFrameArrow:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_DATAFRAMEARROW* _c_df
 *     cdef object _capsule_schema
*/
struct __pyx_obj_6amplpy_4ampl_DataFrameArrow {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow *__pyx_vtab;
  struct AMPL_DATAFRAMEARROW *_c_df;
  PyObject *_capsule_schema;
  PyObject *_capsule_array;
};


/* "amplpy/entity.pxi":22
 * 
 * 
 * cdef class Entity(object):             # <<<<<<<<<<<<<<
 *     """
 *     An AMPL entity such as a parameter or a variable.
*/
struct __pyx_obj_6amplpy_4ampl_Entity {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_Entity *__pyx_vtab;
  struct __pyx_obj_6amplpy_4ampl_AMPL *_ampl;
  char *_name;
  AMPL_TUPLE *_index;
  AMPL_ENTITYTYPE wrap_function;
  PyObject *_entity;
};


/* "amplpy/constraint.pxi":6
 * 
 * 
 * cdef class Constraint(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Bases: :class:`~amplpy.Entity`.
*/
struct __pyx_obj_6amplpy_4ampl_Constraint {
  struct __pyx_obj_6amplpy_4ampl_Entity __pyx_base;
};


/* "amplpy/environment.pxi":5
 * 
 * 
 * cdef class Environment(object):             # <<<<<<<<<<<<<<
 *     """
 *     This class provides access to the environment variables and provides
*/
struct __pyx_obj_6amplpy_4ampl_Environment {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_Environment *__pyx_vtab;
  AMPL_ENVIRONMENT *_c_env;
};


/* "amplpy/errorhandler.pxi":28
 * 
 * 
 * cdef class ErrorHandler:             # <<<<<<<<<<<<<<
 *     """
 *     A basic interface for AMPL error handlers. If an application needs to
*/
struct __pyx_obj_6amplpy_4ampl_ErrorHandler {
  PyObject_HEAD
};


/* "amplpy/exceptions.pxi":4
 * 
 * 
 * cdef class AMPLException(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     Represent an exception generated by AMPL.
*/
struct __pyx_obj_6amplpy_4ampl_AMPLException {
  PyBaseExceptionObject __pyx_base;
};


/* "amplpy/iterators.pxi":1
 * cdef class EnvIterator(object):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ENVIRONMENT* env_c
 *     cdef campl.AMPL_ENVIRONMENTVAR* begin
*/
struct __pyx_obj_6amplpy_4ampl_EnvIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_EnvIterator *__pyx_vtab;
  AMPL_ENVIRONMENT *env_c;
  AMPL_ENVIRONMENTVAR *begin;
  AMPL_ENVIRONMENTVAR *end;
  AMPL_ENVIRONMENTVAR *iterator;
};


/* "amplpy/iterators.pxi":38
 *         return (name, value)
 * 
 * cdef class EntityMap(object):             # <<<<<<<<<<<<<<
 *     cdef AMPL _ampl
 *     cdef campl.AMPL_ENTITYTYPE entity_class
*/
struct __pyx_obj_6amplpy_4ampl_EntityMap {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_EntityMap *__pyx_vtab;
  struct __pyx_obj_6amplpy_4ampl_AMPL *_ampl;
  AMPL_ENTITYTYPE entity_class;
  char **begin;
  size_t iterator;
  size_t _size;
};


/* "amplpy/iterators.pxi":111
 *         return self.size()
 * 
 * cdef class InstanceIterator(object):             # <<<<<<<<<<<<<<
 *     cdef AMPL _ampl
 *     cdef char* _name
*/
struct __pyx_obj_6amplpy_4ampl_InstanceIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_InstanceIterator *__pyx_vtab;
  struct __pyx_obj_6amplpy_4ampl_AMPL *_ampl;
  char *_name;
  AMPL_ENTITYTYPE entity_class;
  AMPL_TUPLE **begin;
  size_t iterator;
  size_t _size;
  PyObject *_entity;
};


/* "amplpy/iterators.pxi":180
 * 
 * 
 * cdef class MemberRangeIterator(object):             # <<<<<<<<<<<<<<
 *     """Iterator for set members."""
 *     cdef campl.AMPL* _c_ampl
*/
struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_MemberRangeIterator *__pyx_vtab;
  AMPL *_c_ampl;
  char *_name;
  AMPL_TUPLE *_index;
  AMPL_TUPLE **begin;
  size_t iterator;
  size_t _size;
  PyObject *_entity;
};


/* "amplpy/iterators.pxi":244
 *             return py_tuple
 * 
 * cdef class ColIterator(object):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_DATAFRAME* _df
 *     cdef size_t _index
*/
struct __pyx_obj_6amplpy_4ampl_ColIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_ColIterator *__pyx_vtab;
  AMPL_DATAFRAME *_df;
  size_t _index;
  size_t _rowsize;
  size_t _rowit;
};


/* "amplpy/iterators.pxi":270
 *         return to_py_variant(v)
 * 
 * cdef class RowIterator(object):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_DATAFRAME* _df
 *     cdef size_t _index
*/
struct __pyx_obj_6amplpy_4ampl_RowIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_6amplpy_4ampl_RowIterator *__pyx_vtab;
  AMPL_DATAFRAME *_df;
  size_t _index;
  size_t _columnsize;
  size_t _columnit;
};


/* "amplpy/objective.pxi":4
 * 
 * 
 * cdef class Objective(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Bases: :class:`~amplpy.Entity`.
*/
struct __pyx_obj_6amplpy_4ampl_Objective {
  struct __pyx_obj_6amplpy_4ampl_Entity __pyx_base;
};


/* "amplpy/outputhandler.pxi":3
 * # -*- coding: utf-8 -*-
 * 
 * cdef class OutputHandler(object):             # <<<<<<<<<<<<<<
 *     """
 *     Interface to handle the outputs from the calls to any
*/
struct __pyx_obj_6amplpy_4ampl_OutputHandler {
  PyObject_HEAD
};


/* "amplpy/parameter.pxi":30
 * 
 * 
 * cdef class Parameter(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Represents an AMPL parameter. The values can be float or string (in case of
*/
struct __pyx_obj_6amplpy_4ampl_Parameter {
  struct __pyx_obj_6amplpy_4ampl_Entity __pyx_base;
};


/* "amplpy/set.pxi":12
 * 
 * 
 * cdef class Set(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Represents an AMPL set. In case of not indexed sets, this class exposes
*/
struct __pyx_obj_6amplpy_4ampl_Set {
  struct __pyx_obj_6amplpy_4ampl_Entity __pyx_base;
};


/* "amplpy/variable.pxi":3
 * # -*- coding: utf-8 -*-
 * 
 * cdef class Variable(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Bases: :class:`~amplpy.Entity`.
*/
struct __pyx_obj_6amplpy_4ampl_Variable {
  struct __pyx_obj_6amplpy_4ampl_Entity __pyx_base;
};


/* "amplpy/ampl.pyx":66
 * """
 * 
 * cdef class AMPL:             # <<<<<<<<<<<<<<
 *     """An AMPL translator.
 * 
*/
struct __pyx_obj_6amplpy_4ampl_AMPL {
  PyObject_HEAD
  AMPL *_c_ampl;
  PyObject *_output_handler;
  PyObject *_error_handler;
  PyObject *_error_handler_wrapper;
};


/* "amplpy/dataframe.pxi":197
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         # FIXME: C++ iterators for dataframes not working with SWIG.
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ {
  PyObject_HEAD
  struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self;
};


/* "amplpy/dataframe.pxi":199
 *     def __iter__(self):
 *         # FIXME: C++ iterators for dataframes not working with SWIG.
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))             # <<<<<<<<<<<<<<
 * 
 *     def _get_num_cols(self):
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_i;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "amplpy/dataframe.pxi":276
 *         else:
 *             assert len(values) == self._get_num_rows()
 *             if any(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
 *                 if not isinstance(values, (list, tuple)):
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_value;
};


/* "amplpy/dataframe.pxi":289
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 c_double_array = <double*> malloc(size * sizeof(double))
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_value;
};


/* "amplpy/dataframe.pxi":383
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_headers(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the headers of this DataFrame.
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers {
  PyObject_HEAD
  char **__pyx_v_headers;
};


/* "amplpy/dataframe.pxi":396
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             campl.AMPL_StringFree(&headers[i])
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers *__pyx_outer_scope;
  size_t __pyx_genexpr_arg_0;
  size_t __pyx_v_i;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
};


/* "amplpy/dataframe.pxi":499
 *                 return pd.DataFrame(columns, index=index)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_dict(cls, dic, index_names=None, column_names=None):
 *         """
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict {
  PyObject_HEAD
  Py_ssize_t __pyx_v_ncolumns;
  Py_ssize_t __pyx_v_nindices;
};


/* "amplpy/dataframe.pxi":523
 *         assert index_names is None or nindices == len(index_names)
 *         assert column_names is None or ncolumns == len(column_names)
 *         assert all(len(k) == nindices for k in lst_index)             # <<<<<<<<<<<<<<
 *         assert all(len(v) == ncolumns for v in lst_columns)
 * 
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_k;
};


/* "amplpy/dataframe.pxi":524
 *         assert column_names is None or ncolumns == len(column_names)
 *         assert all(len(k) == nindices for k in lst_index)
 *         assert all(len(v) == ncolumns for v in lst_columns)             # <<<<<<<<<<<<<<
 * 
 *         index = zip(*lst_index)
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_v;
};


/* "amplpy/parameter.pxi":198
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))
 *         elif isinstance(values, Iterable):
 *             if all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_value;
};


/* "amplpy/parameter.pxi":204
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_value;
};


/* "amplpy/set.pxi":107
 *         return contains_c
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the tuples in this set. Valid only for non-indexed sets.
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values {
  PyObject_HEAD
  PyObject *__pyx_v_cast_value;
  PyObject *__pyx_v_dimen;
};


/* "amplpy/set.pxi":147
 *         elif isinstance(values, Iterable):
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_value;
};


/* "amplpy/set.pxi":153
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_value;
};


/* "amplpy/set.pxi":183
 *                 values = [cast_row(row) for row in values]
 *                 if dimen == 1:
 *                     if any(isinstance(row, tuple) for row in values):             # <<<<<<<<<<<<<<
 *                         raise ValueError(
 *                             f"Trying to assign tuples to set of arity {dimen}."
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_row;
};


/* "amplpy/set.pxi":189
 *                 else:
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen             # <<<<<<<<<<<<<<
 *                         for row in values
 *                     ):
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_row;
};


/* "amplpy/ampl.pyx":942
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.ampl.set_option(name, value)
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
};


/* "amplpy/ampl.pyx":952
 *             if isinstance(value, dict):
 *                 if name.endswith("_options"):
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))             # <<<<<<<<<<<<<<
 *             else:
 *                 self.set_option(name, value)
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
};


/* "amplpy/ampl.pyx":1229
 *             self.eval(
 *                 "".join(
 *                     "let {} := {};".format(name, value) for name, value in model.items()             # <<<<<<<<<<<<<<
 *                 )
 *             )
*/
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_value;
};



/* "amplpy/dataframe.pxi":21
 * 
 * 
 * cdef class Row(object):             # <<<<<<<<<<<<<<
 *     """
 *     Represents a row in a :class:`~amplpy.DataFrame`.
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Row {
  PyObject *(*create)(AMPL_DATAFRAME *, size_t);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Row *__pyx_vtabptr_6amplpy_4ampl_Row;


/* "amplpy/dataframe.pxi":53
 * 
 * 
 * cdef class Column(object):             # <<<<<<<<<<<<<<
 *     """
 *     Represents a column in a :class:`~amplpy.DataFrame`.
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Column {
  PyObject *(*create)(AMPL_DATAFRAME *, size_t);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Column *__pyx_vtabptr_6amplpy_4ampl_Column;


/* "amplpy/dataframe.pxi":92
 * 
 * 
 * cdef class DataFrame(object):             # <<<<<<<<<<<<<<
 *     """
 *     A DataFrame object, used to communicate data to and from the AMPL entities.
*/

struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame {
  AMPL_DATAFRAME *(*get_ptr)(struct __pyx_obj_6amplpy_4ampl_DataFrame *);
  PyObject *(*create)(AMPL_DATAFRAME *);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame *__pyx_vtabptr_6amplpy_4ampl_DataFrame;


/* "amplpy/dataframe_arrow.pxi":32
 * 
 * 
 * cdef class DataFrameArrow:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_DATAFRAMEARROW* _c_df
 *     cdef object _capsule_schema
*/

struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow {
  void (*init_from_arrow)(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *, struct ArrowSchema *, struct ArrowArray *, int64_t);
  struct AMPL_DATAFRAMEARROW *(*get_ptr)(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow *__pyx_vtabptr_6amplpy_4ampl_DataFrameArrow;


/* "amplpy/entity.pxi":22
 * 
 * 
 * cdef class Entity(object):             # <<<<<<<<<<<<<<
 *     """
 *     An AMPL entity such as a parameter or a variable.
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Entity {
  PyObject *(*create)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Entity *__pyx_vtabptr_6amplpy_4ampl_Entity;


/* "amplpy/constraint.pxi":6
 * 
 * 
 * cdef class Constraint(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Bases: :class:`~amplpy.Entity`.
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Constraint {
  struct __pyx_vtabstruct_6amplpy_4ampl_Entity __pyx_base;
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Constraint *__pyx_vtabptr_6amplpy_4ampl_Constraint;


/* "amplpy/environment.pxi":5
 * 
 * 
 * cdef class Environment(object):             # <<<<<<<<<<<<<<
 *     """
 *     This class provides access to the environment variables and provides
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Environment {
  AMPL_ENVIRONMENT *(*get_c_pointer)(struct __pyx_obj_6amplpy_4ampl_Environment *);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Environment *__pyx_vtabptr_6amplpy_4ampl_Environment;


/* "amplpy/iterators.pxi":1
 * cdef class EnvIterator(object):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ENVIRONMENT* env_c
 *     cdef campl.AMPL_ENVIRONMENTVAR* begin
*/

struct __pyx_vtabstruct_6amplpy_4ampl_EnvIterator {
  PyObject *(*create)(AMPL_ENVIRONMENT *);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_EnvIterator *__pyx_vtabptr_6amplpy_4ampl_EnvIterator;


/* "amplpy/iterators.pxi":38
 *         return (name, value)
 * 
 * cdef class EntityMap(object):             # <<<<<<<<<<<<<<
 *     cdef AMPL _ampl
 *     cdef campl.AMPL_ENTITYTYPE entity_class
*/

struct __pyx_vtabstruct_6amplpy_4ampl_EntityMap {
  PyObject *(*create)(struct __pyx_obj_6amplpy_4ampl_AMPL *, AMPL_ENTITYTYPE);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_EntityMap *__pyx_vtabptr_6amplpy_4ampl_EntityMap;


/* "amplpy/iterators.pxi":111
 *         return self.size()
 * 
 * cdef class InstanceIterator(object):             # <<<<<<<<<<<<<<
 *     cdef AMPL _ampl
 *     cdef char* _name
*/

struct __pyx_vtabstruct_6amplpy_4ampl_InstanceIterator {
  PyObject *(*create)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_ENTITYTYPE, PyObject *);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_InstanceIterator *__pyx_vtabptr_6amplpy_4ampl_InstanceIterator;


/* "amplpy/iterators.pxi":180
 * 
 * 
 * cdef class MemberRangeIterator(object):             # <<<<<<<<<<<<<<
 *     """Iterator for set members."""
 *     cdef campl.AMPL* _c_ampl
*/

struct __pyx_vtabstruct_6amplpy_4ampl_MemberRangeIterator {
  PyObject *(*create)(AMPL *, char *, AMPL_TUPLE *, PyObject *);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_MemberRangeIterator *__pyx_vtabptr_6amplpy_4ampl_MemberRangeIterator;


/* "amplpy/iterators.pxi":244
 *             return py_tuple
 * 
 * cdef class ColIterator(object):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_DATAFRAME* _df
 *     cdef size_t _index
*/

struct __pyx_vtabstruct_6amplpy_4ampl_ColIterator {
  PyObject *(*create)(AMPL_DATAFRAME *, size_t);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_ColIterator *__pyx_vtabptr_6amplpy_4ampl_ColIterator;


/* "amplpy/iterators.pxi":270
 *         return to_py_variant(v)
 * 
 * cdef class RowIterator(object):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_DATAFRAME* _df
 *     cdef size_t _index
*/

struct __pyx_vtabstruct_6amplpy_4ampl_RowIterator {
  PyObject *(*create)(AMPL_DATAFRAME *, size_t);
};
static struct __pyx_vtabstruct_6amplpy_4ampl_RowIterator *__pyx_vtabptr_6amplpy_4ampl_RowIterator;


/* "amplpy/objective.pxi":4
 * 
 * 
 * cdef class Objective(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Bases: :class:`~amplpy.Entity`.
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Objective {
  struct __pyx_vtabstruct_6amplpy_4ampl_Entity __pyx_base;
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Objective *__pyx_vtabptr_6amplpy_4ampl_Objective;


/* "amplpy/parameter.pxi":30
 * 
 * 
 * cdef class Parameter(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Represents an AMPL parameter. The values can be float or string (in case of
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Parameter {
  struct __pyx_vtabstruct_6amplpy_4ampl_Entity __pyx_base;
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Parameter *__pyx_vtabptr_6amplpy_4ampl_Parameter;


/* "amplpy/set.pxi":12
 * 
 * 
 * cdef class Set(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Represents an AMPL set. In case of not indexed sets, this class exposes
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Set {
  struct __pyx_vtabstruct_6amplpy_4ampl_Entity __pyx_base;
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Set *__pyx_vtabptr_6amplpy_4ampl_Set;


/* "amplpy/variable.pxi":3
 * # -*- coding: utf-8 -*-
 * 
 * cdef class Variable(Entity):             # <<<<<<<<<<<<<<
 *     """
 *     Bases: :class:`~amplpy.Entity`.
*/

struct __pyx_vtabstruct_6amplpy_4ampl_Variable {
  struct __pyx_vtabstruct_6amplpy_4ampl_Entity __pyx_base;
};
static struct __pyx_vtabstruct_6amplpy_4ampl_Variable *__pyx_vtabptr_6amplpy_4ampl_Variable;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_XINCREF(r)  do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* IncludeStringH.proto */
#include <string.h>

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#if !CYTHON_VECTORCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs);
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#if !CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03080000
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()
  #define __Pyx_PyFrame_GetLocalsplus(frame)  ((frame)->f_localsplus)
#else
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif
#endif
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectFastCall.proto */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* ModFloat[double].proto */
static CYTHON_INLINE double __Pyx_mod_double(double, double, int b_is_constant);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* JoinPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* TupleAndListFromArray.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#endif
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RejectKeywords.proto */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static CYTHON_INLINE int __Pyx_ParseKeywords(
    PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
    PyObject *kwds2, PyObject *values[],
    Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* CallCFunction.proto */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod2.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* pybytes_as_double.proto */
static double __Pyx_SlowPyString_AsDouble(PyObject *obj);
static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length);
static CYTHON_INLINE double __Pyx_PyBytes_AsDouble(PyObject *obj) {
    char* as_c_string;
    Py_ssize_t size;
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    as_c_string = PyBytes_AS_STRING(obj);
    size = PyBytes_GET_SIZE(obj);
#else
    if (PyBytes_AsStringAndSize(obj, &as_c_string, &size) < 0) {
        return (double)-1;
    }
#endif
    return __Pyx__PyBytes_AsDouble(obj, as_c_string, size);
}
static CYTHON_INLINE double __Pyx_PyByteArray_AsDouble(PyObject *obj) {
    char* as_c_string;
    Py_ssize_t size;
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    as_c_string = PyByteArray_AS_STRING(obj);
    size = PyByteArray_GET_SIZE(obj);
#else
    as_c_string = PyByteArray_AsString(obj);
    if (as_c_string == NULL) {
        return (double)-1;
    }
    size = PyByteArray_Size(obj);
#endif
    return __Pyx__PyBytes_AsDouble(obj, as_c_string, size);
}

/* pyunicode_as_double.proto */
#if !CYTHON_COMPILING_IN_PYPY && CYTHON_ASSUME_SAFE_MACROS
static const char* __Pyx__PyUnicode_AsDouble_Copy(const void* data, const int kind, char* buffer, Py_ssize_t start, Py_ssize_t end) {
    int last_was_punctuation;
    Py_ssize_t i;
    last_was_punctuation = 1;
    for (i=start; i <= end; i++) {
        Py_UCS4 chr = PyUnicode_READ(kind, data, i);
        int is_punctuation = (chr == '_') | (chr == '.');
        *buffer = (char)chr;
        buffer += (chr != '_');
        if (unlikely(chr > 127)) goto parse_failure;
        if (unlikely(last_was_punctuation & is_punctuation)) goto parse_failure;
        last_was_punctuation = is_punctuation;
    }
    if (unlikely(last_was_punctuation)) goto parse_failure;
    *buffer = '\0';
    return buffer;
parse_failure:
    return NULL;
}
static double __Pyx__PyUnicode_AsDouble_inf_nan(const void* data, int kind, Py_ssize_t start, Py_ssize_t length) {
    int matches = 1;
    Py_UCS4 chr;
    Py_UCS4 sign = PyUnicode_READ(kind, data, start);
    int is_signed = (sign == '-') | (sign == '+');
    start += is_signed;
    length -= is_signed;
    switch (PyUnicode_READ(kind, data, start)) {
        #ifdef Py_NAN
        case 'n':
        case 'N':
            if (unlikely(length != 3)) goto parse_failure;
            chr = PyUnicode_READ(kind, data, start+1);
            matches &= (chr == 'a') | (chr == 'A');
            chr = PyUnicode_READ(kind, data, start+2);
            matches &= (chr == 'n') | (chr == 'N');
            if (unlikely(!matches)) goto parse_failure;
            return (sign == '-') ? -Py_NAN : Py_NAN;
        #endif
        case 'i':
        case 'I':
            if (unlikely(length < 3)) goto parse_failure;
            chr = PyUnicode_READ(kind, data, start+1);
            matches &= (chr == 'n') | (chr == 'N');
            chr = PyUnicode_READ(kind, data, start+2);
            matches &= (chr == 'f') | (chr == 'F');
            if (likely(length == 3 && matches))
                return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
            if (unlikely(length != 8)) goto parse_failure;
            chr = PyUnicode_READ(kind, data, start+3);
            matches &= (chr == 'i') | (chr == 'I');
            chr = PyUnicode_READ(kind, data, start+4);
            matches &= (chr == 'n') | (chr == 'N');
            chr = PyUnicode_READ(kind, data, start+5);
            matches &= (chr == 'i') | (chr == 'I');
            chr = PyUnicode_READ(kind, data, start+6);
            matches &= (chr == 't') | (chr == 'T');
            chr = PyUnicode_READ(kind, data, start+7);
            matches &= (chr == 'y') | (chr == 'Y');
            if (unlikely(!matches)) goto parse_failure;
            return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
        case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
            break;
        default:
            goto parse_failure;
    }
    return 0.0;
parse_failure:
    return -1.0;
}
static double __Pyx_PyUnicode_AsDouble_WithSpaces(PyObject *obj) {
    double value;
    const char *last;
    char *end;
    Py_ssize_t start, length = PyUnicode_GET_LENGTH(obj);
    const int kind = PyUnicode_KIND(obj);
    const void* data = PyUnicode_DATA(obj);
    start = 0;
    while (Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, start)))
        start++;
    while (start < length - 1 && Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, length - 1)))
        length--;
    length -= start;
    if (unlikely(length <= 0)) goto fallback;
    value = __Pyx__PyUnicode_AsDouble_inf_nan(data, kind, start, length);
    if (unlikely(value == -1.0)) goto fallback;
    if (value != 0.0) return value;
    if (length < 40) {
        char number[40];
        last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length);
        if (unlikely(!last)) goto fallback;
        value = PyOS_string_to_double(number, &end, NULL);
    } else {
        char *number = (char*) PyMem_Malloc((length + 1) * sizeof(char));
        if (unlikely(!number)) goto fallback;
        last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length);
        if (unlikely(!last)) {
            PyMem_Free(number);
            goto fallback;
        }
        value = PyOS_string_to_double(number, &end, NULL);
        PyMem_Free(number);
    }
    if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) {
        return value;
    }
fallback:
    return __Pyx_SlowPyString_AsDouble(obj);
}
#endif
static CYTHON_INLINE double __Pyx_PyUnicode_AsDouble(PyObject *obj) {
#if !CYTHON_COMPILING_IN_PYPY && CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(__Pyx_PyUnicode_READY(obj) == -1))
        return (double)-1;
    if (likely(PyUnicode_IS_ASCII(obj))) {
        const char *s;
        Py_ssize_t length;
        s = PyUnicode_AsUTF8AndSize(obj, &length);
        return __Pyx__PyBytes_AsDouble(obj, s, length);
    }
    return __Pyx_PyUnicode_AsDouble_WithSpaces(obj);
#else
    return __Pyx_SlowPyString_AsDouble(obj);
#endif
}

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyLong_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?  __Pyx_PyFloat_AS_DOUBLE(obj) :\
 likely(PyLong_CheckExact(obj)) ?\
 PyLong_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

/* PyObject_Unicode.proto */
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* PyObjectVectorCallKwBuilder.proto */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* RaiseUnboundLocalError.proto */
static void __Pyx_RaiseUnboundLocalError(const char *varname);

/* RaiseClosureNameError.proto */
static void __Pyx_RaiseClosureNameError(const char *varname);

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* pep479.proto */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_LIMITED_API  ||  (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000)
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

/* FixUpExtensionType.proto */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* FetchSharedCythonModule.proto */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* dict_setdefault.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value, int is_safe_type);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CallTypeTraverse.proto */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* PyMethodNew.proto */
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);

/* PyVectorcallFastCallDict.proto */
#if CYTHON_METH_FASTCALL && (CYTHON_VECTORCALL || CYTHON_BACKPORT_VECTORCALL)
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
#endif

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_BACKPORT_VECTORCALL ||\
        (CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL)
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    PyObject *defaults;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
                                                         PyTypeObject *defaults_type);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_BACKPORT_VECTORCALL || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* PyObjectCallNoArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
    PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple);
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* PyObjectVectorCallMethodKwBuilder.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod
#else
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#endif

/* BuildPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* COrdinalToPyUnicode.proto */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

/* GCCDiagnostics.proto */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* IncludeStdlibH.proto */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* PyLongCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* KeywordStringCheck.proto */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* UnicodeConcatInPlace.proto */
# if CYTHON_COMPILING_IN_CPYTHON
    #if CYTHON_REFNANNY
        #define __Pyx_PyUnicode_ConcatInPlace(left, right) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, __pyx_refnanny)
    #else
        #define __Pyx_PyUnicode_ConcatInPlace(left, right) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right)
    #endif
    static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    );
#else
#define __Pyx_PyUnicode_ConcatInPlace __Pyx_PyUnicode_Concat
#endif
#define __Pyx_PyUnicode_ConcatInPlaceSafe(left, right) ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_ConcatInPlace(left, right))

/* pynumber_float.proto */
static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj);
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : __Pyx__PyNumber_Float(x))

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* DictGetItem.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* unicode_tailmatch.proto */
static int __Pyx_PyUnicode_Tailmatch(
    PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction);

/* PyObjectFormat.proto */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
#else
#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
#endif

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static int __Pyx_PyFloat_BoolNeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_BoolNeObjC(op1, op2, floatval, inplace, zerodivision_check)\
    __Pyx_PyObject_IsTrueAndDecref(PyObject_RichCompare(op1, op2, Py_NE))
    #endif

/* Py3UpdateBases.proto */
static PyObject* __Pyx_PEP560_update_bases(PyObject *bases);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
#define __Pyx_PyObject_LookupSpecial(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
#else
#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* ImportDottedModule.proto */
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);

/* HasAttr.proto */
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_HasAttr(o, n)  PyObject_HasAttrWithError(o, n)
#else
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
#endif

/* ValidateBasesTuple.proto */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* LimitedApiGetTypeDict.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* DelItemOnTypeDict.proto */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k);
#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k)

/* SetItemOnTypeDict.proto */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* ValidateExternBase.proto */
static int __Pyx_validate_extern_base(PyTypeObject *base);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_1_0
#define __PYX_HAVE_RT_ImportType_proto_3_1_0
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_1_0(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_1_0(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_1_0 {
   __Pyx_ImportType_CheckSize_Error_3_1_0 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_1_0 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_1_0 = 2
};
static PyTypeObject *__Pyx_ImportType_3_1_0(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_1_0 check_size);
#endif

/* ListPack.proto */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...);

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

/* ClassMethod.proto */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include "descrobject.h"
#endif
CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method);

/* CLineInTraceback.proto */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUTKIND value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE int64_t __Pyx_PyLong_As_int64_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_AMPL_ENTITYTYPE(AMPL_ENTITYTYPE value);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
    return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
}
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#ifdef PyExceptionInstance_Check
  #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
#else
  #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
#endif

/* IterNextPlain.proto */
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* ReturnWithStopIteration.proto */
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);

/* CoroutineBase.proto */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    __Pyx_pyiter_sendfunc yieldfrom_am_send;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
    uint64_t __pyx_pymonitoring_version;
#endif
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
#endif

/* Generator.proto */
#define __Pyx_Generator_USED
#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(PyObject *module);
static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);

/* GetRuntimeVersion.proto */
static unsigned long __Pyx_get_runtime_version(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
#endif
static PyObject *__pyx_f_6amplpy_4ampl_10Constraint_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_3Row_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_6Column_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index); /* proto*/
static AMPL_DATAFRAME *__pyx_f_6amplpy_4ampl_9DataFrame_get_ptr(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_9DataFrame_create(AMPL_DATAFRAME *__pyx_v_df_c); /* proto*/
static void __pyx_f_6amplpy_4ampl_14DataFrameArrow_init_from_arrow(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self, struct ArrowSchema *__pyx_v_schema_ptr, struct ArrowArray *__pyx_v_array_ptr, int64_t __pyx_v_nindices); /* proto*/
static struct AMPL_DATAFRAMEARROW *__pyx_f_6amplpy_4ampl_14DataFrameArrow_get_ptr(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_6Entity_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent); /* proto*/
static AMPL_ENVIRONMENT *__pyx_f_6amplpy_4ampl_11Environment_get_c_pointer(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_11EnvIterator_create(AMPL_ENVIRONMENT *__pyx_v_env_c); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_9EntityMap_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, AMPL_ENTITYTYPE __pyx_v_entity_class); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_16InstanceIterator_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_ENTITYTYPE __pyx_v_entity_class, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_19MemberRangeIterator_create(AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_11ColIterator_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_11RowIterator_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_9Objective_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_9Parameter_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_3Set_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_6amplpy_4ampl_8Variable_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent); /* proto*/

/* Module declarations from "libcpp" */

/* Module declarations from "libc.stdint" */

/* Module declarations from "amplpy.campl" */

/* Module declarations from "libc.string" */

/* Module declarations from "libc.stdlib" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.bool" */

/* Module declarations from "cpython.pycapsule" */

/* Module declarations from "cpython.version" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.type" */

/* Module declarations from "libc.stdio" */

/* Module declarations from "cpython.object" */

/* Module declarations from "cpython.ref" */

/* Module declarations from "cpython.exc" */

/* Module declarations from "cpython.module" */

/* Module declarations from "cpython.mem" */

/* Module declarations from "cpython.tuple" */

/* Module declarations from "cpython.list" */

/* Module declarations from "cpython.sequence" */

/* Module declarations from "cpython.mapping" */

/* Module declarations from "cpython.iterator" */

/* Module declarations from "cpython.number" */

/* Module declarations from "cpython.long" */

/* Module declarations from "cpython.float" */

/* Module declarations from "cython" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.complex" */

/* Module declarations from "libc.stddef" */

/* Module declarations from "cpython.unicode" */

/* Module declarations from "cpython.pyport" */

/* Module declarations from "cpython.dict" */

/* Module declarations from "cpython.instance" */

/* Module declarations from "cpython.function" */

/* Module declarations from "cpython.method" */

/* Module declarations from "cpython.weakref" */

/* Module declarations from "cpython.getargs" */

/* Module declarations from "cpython.pythread" */

/* Module declarations from "cpython.pystate" */

/* Module declarations from "cpython.set" */

/* Module declarations from "cpython.buffer" */

/* Module declarations from "cpython.bytes" */

/* Module declarations from "cpython.contextvars" */

/* Module declarations from "cpython" */

/* Module declarations from "amplpy.ampl" */
static void __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ERRORINFO *); /*proto*/
static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValues(AMPL *, char *, AMPL_TUPLE *, PyObject *, size_t); /*proto*/
static PyObject *__pyx_f_6amplpy_4ampl_to_py_variant(AMPL_VARIANT *); /*proto*/
static PyObject *__pyx_f_6amplpy_4ampl_to_py_tuple(AMPL_TUPLE *); /*proto*/
static AMPL_TUPLE *__pyx_f_6amplpy_4ampl_to_c_tuple(PyObject *); /*proto*/
static AMPL_VARIANT *__pyx_f_6amplpy_4ampl_to_c_variant(PyObject *); /*proto*/
static PyObject *__pyx_f_6amplpy_4ampl_create_entity(AMPL_ENTITYTYPE, struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *); /*proto*/
static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValuesParamNum(AMPL *, char *, PyObject *); /*proto*/
static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValuesParamStr(AMPL *, char *, PyObject *); /*proto*/
static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValuesPyDict(AMPL *, char *, PyObject *); /*proto*/
static void __pyx_f_6amplpy_4ampl_raiseKeyError(AMPL_ENTITYTYPE, PyObject *); /*proto*/
static void __pyx_f_6amplpy_4ampl_PyError(bool, char const *, int, int, char const *, void *); /*proto*/
static void __pyx_f_6amplpy_4ampl_PyOutput(AMPL_OUTPUTKIND, char const *, void *); /*proto*/
static PyObject *__pyx_f_6amplpy_4ampl___pyx_unpickle_ErrorHandler__set_state(struct __pyx_obj_6amplpy_4ampl_ErrorHandler *, PyObject *); /*proto*/
static PyObject *__pyx_f_6amplpy_4ampl___pyx_unpickle_AMPLException__set_state(struct __pyx_obj_6amplpy_4ampl_AMPLException *, PyObject *); /*proto*/
static PyObject *__pyx_f_6amplpy_4ampl___pyx_unpickle_OutputHandler__set_state(struct __pyx_obj_6amplpy_4ampl_OutputHandler *, PyObject *); /*proto*/
/* #### Code section: typeinfo ### */
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "amplpy.ampl"
extern int __pyx_module_is_main_amplpy__ampl;
int __pyx_module_is_main_amplpy__ampl = 0;

/* Implementation of "amplpy.ampl" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_SystemError;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_AssertionError;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_open;
/* #### Code section: string_decls ### */
static const char __pyx_k_1[] = "\2601";
static const char __pyx_k_6[] = "\200\001\330\004*\250!\2506\260\021";
static const char __pyx_k_A[] = "\250A";
static const char __pyx_k_Q[] = "\230Q";
static const char __pyx_k_a[] = "\240a";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_e[] = "e";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_j[] = "j";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_q[] = "\230q";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_1F[] = "\200\001\330\004+\2501\250F\260!";
static const char __pyx_k_75[] = "75";
static const char __pyx_k_CD[] = "CD";
static const char __pyx_k_IF[] = "_IF";
static const char __pyx_k__2[] = ".";
static const char __pyx_k__3[] = "";
static const char __pyx_k__4[] = "\t";
static const char __pyx_k__5[] = "\n";
static const char __pyx_k__6[] = "\n\t";
static const char __pyx_k__7[] = "-";
static const char __pyx_k__8[] = "[";
static const char __pyx_k__9[] = "(";
static const char __pyx_k_cd[] = "cd";
static const char __pyx_k_df[] = "df";
static const char __pyx_k_gc[] = "gc";
static const char __pyx_k_lb[] = "lb";
static const char __pyx_k_na[] = "na";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_nt[] = "nt";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_pa[] = "pa";
static const char __pyx_k_pd[] = "pd";
static const char __pyx_k_pl[] = "pl";
static const char __pyx_k_rc[] = "rc";
static const char __pyx_k_ub[] = "ub";
static const char __pyx_k_A_1[] = "\200A\360\n\000\t\033\230!\330\014\r\360\006\000\r\016\360\006\000\r\016\360\014\000\r\016\360\006\000\t\020\210{\230!\2301";
static const char __pyx_k_A_2[] = "\270A";
static const char __pyx_k_A_T[] = "\200A\360\016\000\t\020\210~\230T\240\021";
static const char __pyx_k_A_y[] = "\200A\360\n\000\t\031\230\001\330\014\r\360\006\000\r\016\360\006\000\r\016\360\014\000\r\016\360\006\000\t\020\210y\230\001\230\021";
static const char __pyx_k_A_z[] = "\200A\360\n\000\t\032\230\021\330\014\r\360\006\000\r\016\360\006\000\r\016\360\006\000\t\020\210z\230\021\230!";
static const char __pyx_k_FIX[] = "FIX";
static const char __pyx_k_FOR[] = "FOR";
static const char __pyx_k_LET[] = "LET";
static const char __pyx_k_Q_2[] = "\240Q";
static const char __pyx_k_Q_3[] = "\200\001\330\004\n\210+\220Q";
static const char __pyx_k_Row[] = "Row";
static const char __pyx_k_Set[] = "Set";
static const char __pyx_k__10[] = ",)";
static const char __pyx_k__11[] = "*******************************************************************************";
static const char __pyx_k__12[] = "* ";
static const char __pyx_k__13[] = " *";
static const char __pyx_k__14[] = " ";
static const char __pyx_k__15[] = ";";
static const char __pyx_k__16[] = "=";
static const char __pyx_k__17[] = "\";";
static const char __pyx_k__18[] = "?";
static const char __pyx_k__19[] = "\230!";
static const char __pyx_k__20[] = "\250!";
static const char __pyx_k__21[] = "_";
static const char __pyx_k_a_2[] = "\230a";
static const char __pyx_k_a_3[] = "\250a";
static const char __pyx_k_ast[] = "ast";
static const char __pyx_k_cls[] = "cls";
static const char __pyx_k_col[] = "col";
static const char __pyx_k_con[] = "_con";
static const char __pyx_k_dic[] = "dic";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_exp[] = "exp";
static const char __pyx_k_fix[] = "fix";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_idx[] = "idx";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_lb0[] = "lb0";
static const char __pyx_k_lb1[] = "lb1";
static const char __pyx_k_lb2[] = "lb2";
static const char __pyx_k_lbs[] = "lbs";
static const char __pyx_k_let[] = "let {} := {};";
static const char __pyx_k_lrc[] = "lrc";
static const char __pyx_k_lst[] = "lst";
static const char __pyx_k_map[] = "map";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_num[] = "num";
static const char __pyx_k_obj[] = "_obj";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_row[] = "row";
static const char __pyx_k_set[] = "set";
static const char __pyx_k_sol[] = ".sol\";";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_t_c[] = "t_c";
static const char __pyx_k_ub0[] = "ub0";
static const char __pyx_k_ub1[] = "ub1";
static const char __pyx_k_ub2[] = "ub2";
static const char __pyx_k_ubs[] = "ubs";
static const char __pyx_k_urc[] = "urc";
static const char __pyx_k_val[] = "val";
static const char __pyx_k_var[] = "_var";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_AMPL[] = "AMPL";
static const char __pyx_k_A_HA[] = "\210A\330\020\024\220H\230A";
static const char __pyx_k_A_ha[] = "\200A\360\024\000\t\023\220'\230\021\230$\230h\240a";
static const char __pyx_k_A_t1[] = "\200A\360\010\000\t\020\210t\2201";
static const char __pyx_k_A_t5[] = "\210A\330\020\027\220t\2305\240\010\250\001\250\021";
static const char __pyx_k_A_t6[] = "\200A\360\010\000\t\020\210t\2206\230\027\240\001\240\021";
static const char __pyx_k_CALL[] = "CALL";
static const char __pyx_k_DATA[] = "DATA";
static const char __pyx_k_DROP[] = "DROP";
static const char __pyx_k_ELSE[] = "_ELSE";
static const char __pyx_k_EXIT[] = "EXIT";
static const char __pyx_k_Kind[] = "Kind";
static const char __pyx_k_LOAD[] = "LOAD";
static const char __pyx_k_MISC[] = "MISC";
static const char __pyx_k_None[] = "None";
static const char __pyx_k_READ[] = "READ";
static const char __pyx_k_Real[] = "Real";
static const char __pyx_k_SHOW[] = "SHOW";
static const char __pyx_k_Sets[] = "Sets";
static const char __pyx_k_THEN[] = "THEN";
static const char __pyx_k_XREF[] = "XREF";
static const char __pyx_k_ampl[] = "ampl";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_body[] = "body";
static const char __pyx_k_bool[] = "bool";
static const char __pyx_k_copt[] = "copt";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_df_c[] = "df_c";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_drop[] = "drop";
static const char __pyx_k_dual[] = "dual";
static const char __pyx_k_eval[] = "eval";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_find[] = "find";
static const char __pyx_k_flat[] = "flat";
static const char __pyx_k_func[] = "__func__";
static const char __pyx_k_impl[] = "_impl";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_kind[] = "kind";
static const char __pyx_k_line[] = "line ";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_next[] = "next";
static const char __pyx_k_open[] = "open";
static const char __pyx_k_path[] = "path";
static const char __pyx_k_read[] = "read";
static const char __pyx_k_scip[] = "scip";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_sets[] = "sets";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_spec[] = "__spec__";
static const char __pyx_k_stmt[] = "stmt";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_xref[] = "xref";
static const char __pyx_k_A_E_1[] = "\210A\330\020\024\220E\230\030\240\021\240%\240{\260!\2601";
static const char __pyx_k_A_F_j[] = "\200A\360\030\000\t\025\220F\230/\250\021\250$\250j\270\n\300'\310\021\310!";
static const char __pyx_k_A_q_1[] = "\200A\360\010\000\t\031\230\007\230q\240\013\2501";
static const char __pyx_k_A_vZq[] = "\200A\360\010\000\t\020\210v\220Z\230q\240\001";
static const char __pyx_k_A_z_2[] = "\200A\360\n\000\t\032\230\021\330\014\r\360\006\000\r\016\360\006\000\r\016\360\014\000\r\016\360\006\000\t\020\210z\230\021\230!";
static const char __pyx_k_BREAK[] = "BREAK";
static const char __pyx_k_CHECK[] = "CHECK";
static const char __pyx_k_CLOSE[] = "CLOSE";
static const char __pyx_k_ENDIF[] = "ENDIF";
static const char __pyx_k_PRINT[] = "PRINT";
static const char __pyx_k_PURGE[] = "PURGE";
static const char __pyx_k_RESET[] = "RESET";
static const char __pyx_k_SOLVE[] = "SOLVE";
static const char __pyx_k_SSTEP[] = "SSTEP";
static const char __pyx_k_Table[] = "Table";
static const char __pyx_k_UNFIX[] = "UNFIX";
static const char __pyx_k_WRITE[] = "WRITE";
static const char __pyx_k_arity[] = "arity";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_chain[] = "chain";
static const char __pyx_k_check[] = "check";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_cname[] = "cname";
static const char __pyx_k_con_2[] = "con";
static const char __pyx_k_cplex[] = "cplex";
static const char __pyx_k_dimen[] = "dimen";
static const char __pyx_k_dinit[] = "dinit";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_exprs[] = "exprs";
static const char __pyx_k_flush[] = "flush";
static const char __pyx_k_highs[] = "highs";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_init0[] = "init0";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_ldual[] = "ldual";
static const char __pyx_k_model[] = "model";
static const char __pyx_k_names[] = "names";
static const char __pyx_k_ncols[] = "ncols";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_obj_2[] = "obj";
static const char __pyx_k_pa_df[] = "pa_df";
static const char __pyx_k_param[] = "_param";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_reset[] = "reset";
static const char __pyx_k_set_2[] = "_set";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_slack[] = "slack";
static const char __pyx_k_solve[] = "solve ";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_stack[] = "stack";
static const char __pyx_k_state[] = "state";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_tools[] = "tools";
static const char __pyx_k_tuple[] = "tuple";
static const char __pyx_k_udual[] = "udual";
static const char __pyx_k_unfix[] = "unfix";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_var_2[] = "var";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_A_F_Qd[] = "\200A\360\n\000\t\025\220F\230+\240Q\240d\250!";
static const char __pyx_k_A_Qa_a[] = "\200A\360\010\000\t\036\230Q\230a\330\010\016\210a";
static const char __pyx_k_A_s_4q[] = "\200A\330\010\017\210s\220!\2204\220q\230\001";
static const char __pyx_k_A_t5_0[] = "\210A\330\020\027\220t\2305\320 0\260\001";
static const char __pyx_k_A_t5_2[] = "\210A\330\020\027\220t\2305\240\t\250\021";
static const char __pyx_k_A_t5_a[] = "\210A\330\020\027\220t\2305\240\016\250a";
static const char __pyx_k_A_t5_q[] = "\210A\330\020\027\220t\2305\240\017\250q\260\001";
static const char __pyx_k_Column[] = "Column";
static const char __pyx_k_EXPAND[] = "EXPAND";
static const char __pyx_k_Entity[] = "Entity";
static const char __pyx_k_OPTION[] = "OPTION";
static const char __pyx_k_PRINTF[] = "PRINTF";
static const char __pyx_k_PROMPT[] = "PROMPT";
static const char __pyx_k_RBRACE[] = "RBRACE";
static const char __pyx_k_RELOAD[] = "RELOAD";
static const char __pyx_k_REMOVE[] = "REMOVE";
static const char __pyx_k_REPEAT[] = "REPEAT";
static const char __pyx_k_Series[] = "Series";
static const char __pyx_k_UNLOAD[] = "UNLOAD";
static const char __pyx_k_UPDATE[] = "UPDATE";
static const char __pyx_k_addRow[] = "_addRow";
static const char __pyx_k_amplpy[] = "amplpy";
static const char __pyx_k_cindex[] = "cindex";
static const char __pyx_k_column[] = "column";
static const char __pyx_k_data_c[] = "data_c";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_defeqn[] = "defeqn";
static const char __pyx_k_defvar[] = "defvar";
static const char __pyx_k_df_ref[] = "df_ref";
static const char __pyx_k_dict_2[] = "_dict";
static const char __pyx_k_dinit0[] = "dinit0";
static const char __pyx_k_driver[] = "driver";
static const char __pyx_k_enable[] = "enable";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_entity[] = "entity";
static const char __pyx_k_errors[] = "errors";
static const char __pyx_k_exists[] = "exists";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_getRow[] = "_getRow";
static const char __pyx_k_getSet[] = "getSet";
static const char __pyx_k_gurobi[] = "gurobi";
static const char __pyx_k_header[] = "header";
static const char __pyx_k_init_2[] = "init";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_line_2[] = "\nline ";
static const char __pyx_k_logger[] = "logger";
static const char __pyx_k_lslack[] = "lslack";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_name_c[] = "name_c";
static const char __pyx_k_nested[] = "nested";
static const char __pyx_k_number[] = "number";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_offset[] = "offset";
static const char __pyx_k_option[] = "_option";
static const char __pyx_k_output[] = "output";
static const char __pyx_k_pandas[] = "pandas";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_polars[] = "polars";
static const char __pyx_k_pylist[] = "pylist";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_rmtree[] = "rmtree";
static const char __pyx_k_shutil[] = "shutil";
static const char __pyx_k_solver[] = "solver";
static const char __pyx_k_status[] = "status";
static const char __pyx_k_stderr[] = "stderr";
static const char __pyx_k_stream[] = "stream";
static const char __pyx_k_tmpdir[] = "_tmpdir";
static const char __pyx_k_toDict[] = "toDict";
static const char __pyx_k_toList[] = "toList";
static const char __pyx_k_tolist[] = "tolist";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_uslack[] = "uslack";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_xpress[] = "xpress";
static const char __pyx_k_AMPL_cd[] = "AMPL.cd";
static const char __pyx_k_A_1_t1A[] = "\200A\360\n\000\t\024\2201\330\014\r\360\006\000\r\016\360\006\000\r\016\360\006\000\r\016\360\006\000\t\020\210t\2201\220A";
static const char __pyx_k_A_4_S_1[] = "\200A\360\020\000\t\n\330\014\023\2204\220{\240#\240S\250\001\340\014\023\2201";
static const char __pyx_k_A_F_j_q[] = "\200A\360\n\000\t\025\220F\230/\250\021\250$\250j\270\001\270\021\330\010\017\210q";
static const char __pyx_k_A_Qe4t6[] = "\200A\360\024\000\t\016\210Q\210e\2204\220t\2306\240\021";
static const char __pyx_k_A_a_waq[] = "\200A\360\n\000\t\027\220a\330\014\r\360\006\000\r\016\360\006\000\r\016\360\016\000\t\020\210w\220a\220q";
static const char __pyx_k_A_s_4xq[] = "\200A\330\010\017\210s\220!\2204\220x\230q";
static const char __pyx_k_A_t5_1A[] = "\210A\330\020\027\220t\2305\240\013\2501\250A";
static const char __pyx_k_A_t5_Qa[] = "\210A\330\020\027\220t\2305\240\r\250Q\250a";
static const char __pyx_k_A_t5_aq[] = "\210A\330\020\027\220t\2305\240\016\250a\250q";
static const char __pyx_k_A_t_b_1[] = "\200A\360\010\000\t\020\210t\220;\230b\240\010\250\003\2501";
static const char __pyx_k_A_t_b_Q[] = "\200A\360\010\000\t\020\210t\220;\230b\240\n\250#\250Q";
static const char __pyx_k_DISPLAY[] = "DISPLAY";
static const char __pyx_k_ENVIRON[] = "ENVIRON";
static const char __pyx_k_IOError[] = "IOError";
static const char __pyx_k_LOOPEND[] = "LOOPEND";
static const char __pyx_k_Options[] = "Options";
static const char __pyx_k_PROBLEM[] = "PROBLEM";
static const char __pyx_k_RESTORE[] = "RESTORE";
static const char __pyx_k_WAITING[] = "WAITING";
static const char __pyx_k_WARNING[] = "WARNING";
static const char __pyx_k_add_row[] = "_add_row";
static const char __pyx_k_astatus[] = "astatus";
static const char __pyx_k_bin_dir[] = "bin_dir";
static const char __pyx_k_c_array[] = "c_array";
static const char __pyx_k_columns[] = "columns";
static const char __pyx_k_disable[] = "disable";
static const char __pyx_k_display[] = "display";
static const char __pyx_k_environ[] = "environ";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_getData[] = "getData";
static const char __pyx_k_getSets[] = "getSets";
static const char __pyx_k_get_iis[] = "get_iis";
static const char __pyx_k_get_row[] = "_get_row";
static const char __pyx_k_get_set[] = "get_set";
static const char __pyx_k_getitem[] = "__getitem__";
static const char __pyx_k_handler[] = "handler";
static const char __pyx_k_headers[] = "headers";
static const char __pyx_k_iis_con[] = "iis_con";
static const char __pyx_k_iis_var[] = "iis_var";
static const char __pyx_k_index_c[] = "index_c";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_members[] = "members";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_model_c[] = "model_c";
static const char __pyx_k_ndarray[] = "ndarray";
static const char __pyx_k_nlevels[] = "nlevels";
static const char __pyx_k_numbers[] = "numbers";
static const char __pyx_k_objname[] = "objname";
static const char __pyx_k_options[] = "_options";
static const char __pyx_k_param_2[] = "param";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_problem[] = "problem";
static const char __pyx_k_py_list[] = "py_list";
static const char __pyx_k_pyarrow[] = "pyarrow";
static const char __pyx_k_replace[] = "replace";
static const char __pyx_k_restore[] = "restore";
static const char __pyx_k_setData[] = "setData";
static const char __pyx_k_setDual[] = "setDual";
static const char __pyx_k_setitem[] = "__setitem__";
static const char __pyx_k_solfile[] = "_solfile";
static const char __pyx_k_solve_2[] = "solve";
static const char __pyx_k_sstatus[] = "sstatus";
static const char __pyx_k_to_dict[] = "to_dict";
static const char __pyx_k_to_list[] = "to_list";
static const char __pyx_k_tuple_c[] = "tuple_c";
static const char __pyx_k_value_c[] = "value_c";
static const char __pyx_k_verbose[] = "verbose";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_workdir[] = "workdir";
static const char __pyx_k_A_1D_G1A[] = "\200A\360\016\000\016,\2501\250D\260\t\270\033\300G\3101\310A";
static const char __pyx_k_A_F_Qd_a[] = "\200A\360\n\000\t\025\220F\320\032-\250Q\250d\260&\270\n\300$\300a";
static const char __pyx_k_A_HA_Q_a[] = "\210A\330\020\024\220H\230A\330\020\024\320\024%\240Q\330\020\024\320\024&\240a";
static const char __pyx_k_A_Qk_q_a[] = "\200A\360\010\000\t\036\230Q\230k\250\026\250q\330\010\016\210a";
static const char __pyx_k_A_s_4q_2[] = "\200A\330\010\017\210s\220!\2204\220q";
static const char __pyx_k_A_s_6_vQ[] = "\200A\340\010\017\210s\220!\2206\230\026\230v\240Q";
static const char __pyx_k_A_t5_q_2[] = "\210A\330\020\027\220t\2305\240\017\250q";
static const char __pyx_k_COMMANDS[] = "COMMANDS";
static const char __pyx_k_CONTINUE[] = "CONTINUE";
static const char __pyx_k_Iterable[] = "Iterable";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_RUN_ARGS[] = "RUN_ARGS";
static const char __pyx_k_SOLUTION[] = "SOLUTION";
static const char __pyx_k_Set_size[] = "Set.size";
static const char __pyx_k_Variable[] = "Variable";
static const char __pyx_k_auxfiles[] = "auxfiles";
static const char __pyx_k_bin_name[] = "bin_name";
static const char __pyx_k_builtins[] = "builtins";
static const char __pyx_k_c_schema[] = "c_schema";
static const char __pyx_k_cast_row[] = "cast_row";
static const char __pyx_k_contains[] = "contains";
static const char __pyx_k_df_reset[] = "df_reset";
static const char __pyx_k_endswith[] = "endswith";
static const char __pyx_k_exitcode[] = "exitcode";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_fromDict[] = "fromDict";
static const char __pyx_k_getValue[] = "getValue";
static const char __pyx_k_get_data[] = "get_data";
static const char __pyx_k_get_next[] = "get_next";
static const char __pyx_k_get_sets[] = "get_sets";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_isScalar[] = "isScalar";
static const char __pyx_k_minimize[] = "minimize";
static const char __pyx_k_name_c_2[] = "_name_c";
static const char __pyx_k_ncolumns[] = "ncolumns";
static const char __pyx_k_nindices[] = "nindices";
static const char __pyx_k_offset_2[] = " offset ";
static const char __pyx_k_option_2[] = "option";
static const char __pyx_k_output_c[] = "output_c";
static const char __pyx_k_property[] = "property";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_readData[] = "readData";
static const char __pyx_k_rowindex[] = "rowindex";
static const char __pyx_k_setLevel[] = "setLevel";
static const char __pyx_k_setValue[] = "setValue";
static const char __pyx_k_set_data[] = "set_data";
static const char __pyx_k_set_dual[] = "set_dual";
static const char __pyx_k_set_name[] = "set_name";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_snapshot[] = "snapshot";
static const char __pyx_k_solution[] = "solution \"";
static const char __pyx_k_suffixes[] = "suffixes";
static const char __pyx_k_toPandas[] = "toPandas";
static const char __pyx_k_toString[] = "toString";
static const char __pyx_k_to_ampls[] = "to_ampls";
static const char __pyx_k_to_arrow[] = "to_arrow";
static const char __pyx_k_to_tuple[] = "to_tuple";
static const char __pyx_k_z_gQ_uAQ[] = "\210\001\330\014\017\210z\230\021\230$\230g\240Q\330\020\027\220u\230A\230Q\340\020\030\230\001";
static const char __pyx_k_AMPL__con[] = "AMPL._con";
static const char __pyx_k_AMPL__obj[] = "AMPL._obj";
static const char __pyx_k_AMPL__set[] = "AMPL._set";
static const char __pyx_k_AMPL__var[] = "AMPL._var";
static const char __pyx_k_AMPL_eval[] = "AMPL.eval";
static const char __pyx_k_AMPL_read[] = "AMPL.read";
static const char __pyx_k_A_F_4vZt1[] = "\200A\360\n\000\t\025\220F\320\032*\250!\2504\250v\260Z\270t\3001";
static const char __pyx_k_A_F_AT_81[] = "\200A\360\010\000\t\025\220F\320\032,\250A\250T\260\032\2708\3001";
static const char __pyx_k_A_Qd_31_a[] = "\210A\330\020\023\220:\230Q\230d\320\"3\2601\330\024\032\230$\230a\330\024\030\320\030*\250!\330\024\032\230!";
static const char __pyx_k_A_fJd_iWX[] = "\200A\360\010\000\t#\240'\250\021\250$\250f\260J\270d\300(\310$\310i\320WX";
static const char __pyx_k_DELETECMD[] = "DELETECMD";
static const char __pyx_k_DataFrame[] = "DataFrame";
static const char __pyx_k_EntityMap[] = "EntityMap";
static const char __pyx_k_Formatter[] = "Formatter";
static const char __pyx_k_OBJECTIVE[] = "OBJECTIVE";
static const char __pyx_k_Objective[] = "Objective";
static const char __pyx_k_Parameter[] = "Parameter";
static const char __pyx_k_READTABLE[] = "_READTABLE";
static const char __pyx_k_SEMICOLON[] = "SEMICOLON";
static const char __pyx_k_Set_arity[] = "Set.arity";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_Variables[] = "Variables";
static const char __pyx_k_addColumn[] = "_addColumn";
static const char __pyx_k_array_ptr[] = "array_ptr";
static const char __pyx_k_bin_dir_c[] = "bin_dir_c";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_errorinfo[] = "errorinfo";
static const char __pyx_k_exception[] = "exception";
static const char __pyx_k_formatter[] = "formatter";
static const char __pyx_k_fromNumpy[] = "fromNumpy";
static const char __pyx_k_from_dict[] = "from_dict";
static const char __pyx_k_getBinDir[] = "getBinDir";
static const char __pyx_k_getColumn[] = "_getColumn";
static const char __pyx_k_getEntity[] = "getEntity";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_getOffset[] = "getOffset";
static const char __pyx_k_getOption[] = "getOption";
static const char __pyx_k_getOutput[] = "getOutput";
static const char __pyx_k_getValues[] = "getValues";
static const char __pyx_k_get_value[] = "get_value";
static const char __pyx_k_indices_c[] = "indices_c";
static const char __pyx_k_instances[] = "instances";
static const char __pyx_k_isLogical[] = "isLogical";
static const char __pyx_k_isRunning[] = "isRunning";
static const char __pyx_k_is_scalar[] = "is_scalar";
static const char __pyx_k_isenabled[] = "isenabled";
static const char __pyx_k_isrunning[] = "isrunning";
static const char __pyx_k_itertools[] = "itertools";
static const char __pyx_k_lst_index[] = "lst_index";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_nanoarrow[] = "nanoarrow";
static const char __pyx_k_objname_c[] = "objname_c";
static const char __pyx_k_options_2[] = "options";
static const char __pyx_k_options_c[] = "options_c";
static const char __pyx_k_propagate[] = "propagate";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_readTable[] = "readTable";
static const char __pyx_k_read_data[] = "read_data";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_setBinDir[] = "setBinDir";
static const char __pyx_k_setColumn[] = "_setColumn";
static const char __pyx_k_setOption[] = "setOption";
static const char __pyx_k_setValues[] = "_setValues";
static const char __pyx_k_set_value[] = "set_value";
static const char __pyx_k_to_pandas[] = "to_pandas";
static const char __pyx_k_to_string[] = "to_string";
static const char __pyx_k_workdir_c[] = "workdir_c";
static const char __pyx_k_write_sol[] = "write_sol";
static const char __pyx_k_AMPL_close[] = "AMPL.close";
static const char __pyx_k_AMPL_reset[] = "AMPL.reset";
static const char __pyx_k_AMPL_solve[] = "AMPL.solve";
static const char __pyx_k_AMPL_write[] = "AMPL.write";
static const char __pyx_k_A_1D_3az_q[] = "\200A\360\n\000\016,\2501\250D\260\t\270\021\270!\330\010\023\2203\220a\220z\240\027\250\001\250\021\330\010\017\210q";
static const char __pyx_k_A_F_0_Zq_a[] = "\200A\360\020\000\t\025\220F\320\0320\260\001\260\024\260Z\270q\300\001\330\010\017\210\230a";
static const char __pyx_k_A_F_4z_7_1[] = "\200A\360\030\000\t\025\220F\320\032*\250!\2504\250z\270\032\3007\310!\3101";
static const char __pyx_k_A_F_Qd_a_2[] = "\200A\360\010\000\t\025\220F\320\032-\250Q\250d\260&\270\n\300$\300a";
static const char __pyx_k_BREAKPOINT[] = "BREAKPOINT";
static const char __pyx_k_Constraint[] = "Constraint";
static const char __pyx_k_ELSE_CHECK[] = "ELSE_CHECK";
static const char __pyx_k_Entity_get[] = "Entity.get";
static const char __pyx_k_MultiIndex[] = "MultiIndex";
static const char __pyx_k_Objectives[] = "Objectives";
static const char __pyx_k_Parameters[] = "Parameters";
static const char __pyx_k_READ_TABLE[] = "READ_TABLE";
static const char __pyx_k_REPEAT_END[] = "REPEAT_END";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_WRITETABLE[] = "_WRITETABLE";
static const char __pyx_k_addHandler[] = "addHandler";
static const char __pyx_k_add_column[] = "_add_column";
static const char __pyx_k_bin_name_c[] = "bin_name_c";
static const char __pyx_k_cast_value[] = "cast_value";
static const char __pyx_k_contains_c[] = "contains_c";
static const char __pyx_k_data_frame[] = "data_frame";
static const char __pyx_k_entitytype[] = "entitytype";
static const char __pyx_k_exportData[] = "exportData";
static const char __pyx_k_fromPandas[] = "fromPandas";
static const char __pyx_k_from_numpy[] = "from_numpy";
static const char __pyx_k_getBinName[] = "getBinName";
static const char __pyx_k_getHeaders[] = "_getHeaders";
static const char __pyx_k_getMessage[] = "getMessage";
static const char __pyx_k_getNumCols[] = "_getNumCols";
static const char __pyx_k_getNumRows[] = "_getNumRows";
static const char __pyx_k_get_column[] = "_get_column";
static const char __pyx_k_get_entity[] = "get_entity";
static const char __pyx_k_get_offset[] = "get_offset";
static const char __pyx_k_get_option[] = "get_option";
static const char __pyx_k_get_output[] = "get_output";
static const char __pyx_k_get_schema[] = "get_schema";
static const char __pyx_k_get_values[] = "get_values";
static const char __pyx_k_hasDefault[] = "hasDefault";
static const char __pyx_k_headers_py[] = "headers_py";
static const char __pyx_k_indexarity[] = "indexarity";
static const char __pyx_k_isSymbolic[] = "isSymbolic";
static const char __pyx_k_is_logical[] = "is_logical";
static const char __pyx_k_is_running[] = "is_running";
static const char __pyx_k_keep_files[] = "keep_files";
static const char __pyx_k_py_variant[] = "py_variant";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_read_table[] = "read_table";
static const char __pyx_k_schema_ptr[] = "schema_ptr";
static const char __pyx_k_setBinName[] = "setBinName";
static const char __pyx_k_set_column[] = "_set_column";
static const char __pyx_k_set_name_2[] = "__set_name__";
static const char __pyx_k_set_option[] = "set_option";
static const char __pyx_k_set_values[] = "set_values";
static const char __pyx_k_skip_index[] = "skip_index";
static const char __pyx_k_statements[] = "statements";
static const char __pyx_k_suffixes_c[] = "suffixes_c";
static const char __pyx_k_table_name[] = "table_name";
static const char __pyx_k_writeTable[] = "writeTable";
static const char __pyx_k_AMPL__param[] = "AMPL._param";
static const char __pyx_k_A_F_31D_s_1[] = "\200A\360\022\000\t\025\220F\320\0323\2601\260D\270\010\300\001\300\021\330\010\017\210s\220!\2201";
static const char __pyx_k_A_F_4vZt1_2[] = "\200A\360\010\000\t\025\220F\320\032*\250!\2504\250v\260Z\270t\3001";
static const char __pyx_k_ColIterator[] = "ColIterator";
static const char __pyx_k_Constraints[] = "Constraints";
static const char __pyx_k_Entity_find[] = "Entity.find";
static const char __pyx_k_Entity_name[] = "Entity.name";
static const char __pyx_k_Entity_xref[] = "Entity.xref";
static const char __pyx_k_EnvIterator[] = "EnvIterator";
static const char __pyx_k_Environment[] = "Environment";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_RowIterator[] = "RowIterator";
static const char __pyx_k_Set_members[] = "Set.members";
static const char __pyx_k_SystemError[] = "SystemError";
static const char __pyx_k_Variable_lb[] = "Variable.lb";
static const char __pyx_k_Variable_rc[] = "Variable.rc";
static const char __pyx_k_Variable_ub[] = "Variable.ub";
static const char __pyx_k_WRITE_TABLE[] = "WRITE_TABLE";
static const char __pyx_k_amplpy_ampl[] = "amplpy.ampl";
static const char __pyx_k_amplpy_copt[] = "amplpy_copt";
static const char __pyx_k_amplpy_scip[] = "amplpy_scip";
static const char __pyx_k_binary_name[] = "binary_name";
static const char __pyx_k_environment[] = "environment";
static const char __pyx_k_exportModel[] = "exportModel";
static const char __pyx_k_export_data[] = "export_data";
static const char __pyx_k_from_arrays[] = "from_arrays";
static const char __pyx_k_from_pandas[] = "from_pandas";
static const char __pyx_k_from_polars[] = "from_polars";
static const char __pyx_k_from_tuples[] = "from_tuples";
static const char __pyx_k_getVariable[] = "getVariable";
static const char __pyx_k_get_bin_dir[] = "get_bin_dir";
static const char __pyx_k_get_headers[] = "_get_headers";
static const char __pyx_k_get_message[] = "get_message";
static const char __pyx_k_hasHandlers[] = "hasHandlers";
static const char __pyx_k_has_default[] = "has_default";
static const char __pyx_k_index_names[] = "index_names";
static const char __pyx_k_is_symbolic[] = "is_symbolic";
static const char __pyx_k_line_number[] = "line_number";
static const char __pyx_k_loadSession[] = "_loadSession";
static const char __pyx_k_lst_columns[] = "lst_columns";
static const char __pyx_k_mro_entries[] = "__mro_entries__";
static const char __pyx_k_multi_index[] = "multi_index";
static const char __pyx_k_reset_index[] = "reset_index";
static const char __pyx_k_setValues_2[] = "setValues";
static const char __pyx_k_set_bin_dir[] = "set_bin_dir";
static const char __pyx_k_solver_list[] = "solver_list";
static const char __pyx_k_source_name[] = "source_name";
static const char __pyx_k_to_string_c[] = "to_string_c";
static const char __pyx_k_write_table[] = "write_table";
static const char __pyx_k_AMPL__option[] = "AMPL._option";
static const char __pyx_k_AMPL_display[] = "AMPL.display";
static const char __pyx_k_AMPL_get_iis[] = "AMPL.get_iis";
static const char __pyx_k_AMPL_get_set[] = "AMPL.get_set";
static const char __pyx_k_A_1_Y_NgUVVW[] = "\200A\360\016\000\0161\260\001\260\024\260Y\320>N\310g\320UV\320VW";
static const char __pyx_k_A_F_5Qd_hVZZ[] = "\200A\360\010\000\t\025\220F\320\0325\260Q\260d\270&\300\n\310$\310h\320VZ\320Z[";
static const char __pyx_k_A_set_called[] = "A set called ";
static const char __pyx_k_ErrorHandler[] = "ErrorHandler";
static const char __pyx_k_OPTION_RESET[] = "OPTION_RESET";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_SHELL_OUTPUT[] = "SHELL_OUTPUT";
static const char __pyx_k_Set_contains[] = "Set.contains";
static const char __pyx_k_Variable_fix[] = "Variable.fix";
static const char __pyx_k_Variable_lb0[] = "Variable.lb0";
static const char __pyx_k_Variable_lb1[] = "Variable.lb1";
static const char __pyx_k_Variable_lb2[] = "Variable.lb2";
static const char __pyx_k_Variable_lrc[] = "Variable.lrc";
static const char __pyx_k_Variable_ub0[] = "Variable.ub0";
static const char __pyx_k_Variable_ub1[] = "Variable.ub1";
static const char __pyx_k_Variable_ub2[] = "Variable.ub2";
static const char __pyx_k_Variable_urc[] = "Variable.urc";
static const char __pyx_k_ampl_libpath[] = "ampl_libpath";
static const char __pyx_k_amplpy_cplex[] = "amplpy_cplex";
static const char __pyx_k_amplpy_highs[] = "amplpy_highs";
static const char __pyx_k_array_stream[] = "array_stream";
static const char __pyx_k_column_names[] = "column_names";
static const char __pyx_k_conv_to_list[] = "conv_to_list";
static const char __pyx_k_export_model[] = "export_model";
static const char __pyx_k_getObjective[] = "getObjective";
static const char __pyx_k_getParameter[] = "getParameter";
static const char __pyx_k_getVariables[] = "getVariables";
static const char __pyx_k_get_bin_name[] = "get_bin_name";
static const char __pyx_k_get_num_cols[] = "_get_num_cols";
static const char __pyx_k_get_num_rows[] = "_get_num_rows";
static const char __pyx_k_get_solution[] = "get_solution";
static const char __pyx_k_get_variable[] = "get_variable";
static const char __pyx_k_initializing[] = "_initializing";
static const char __pyx_k_is_coroutine[] = "_is_coroutine";
static const char __pyx_k_literal_eval[] = "literal_eval";
static const char __pyx_k_load_session[] = "_load_session";
static const char __pyx_k_lst_solution[] = "lst_solution";
static const char __pyx_k_minimization[] = "minimization";
static const char __pyx_k_numInstances[] = "numInstances";
static const char __pyx_k_options_dict[] = "options_dict";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_setFormatter[] = "setFormatter";
static const char __pyx_k_set_bin_name[] = "set_bin_name";
static const char __pyx_k_set_option_2[] = "_set_option";
static const char __pyx_k_set_values_2[] = "_set_values";
static const char __pyx_k_solve_result[] = "solve_result";
static const char __pyx_k_statements_c[] = "statements_c";
static const char __pyx_k_stringsource[] = "<stringsource>";
static const char __pyx_k_use_setstate[] = "use_setstate";
static const char __pyx_k_AMPLException[] = "AMPLException";
static const char __pyx_k_AMPL_get_data[] = "AMPL.get_data";
static const char __pyx_k_AMPL_get_sets[] = "AMPL.get_sets";
static const char __pyx_k_AMPL_set_data[] = "AMPL.set_data";
static const char __pyx_k_AMPL_snapshot[] = "AMPL.snapshot";
static const char __pyx_k_AMPL_to_ampls[] = "AMPL.to_ampls";
static const char __pyx_k_A_3aq_Qd_9E_q[] = "\200A\360\010\000\t\024\2203\220a\220q\330\010\t\330\014\020\220\005\220Q\220d\230!\2309\240E\250\021\330\010\017\320\017\037\230q\330\014\021\220\021\220!";
static const char __pyx_k_A_F_31D_s_1_2[] = "\200A\360\020\000\t\025\220F\320\0323\2601\260D\270\010\300\001\300\021\330\010\017\210s\220!\2201";
static const char __pyx_k_A_F_Zs_9G1A_6[] = "\200A\360\034\000\t\025\220F\230.\250\001\250\024\250Z\260s\270!\2709\300G\3101\310A\330\010\014\320\014#\2406\250\021";
static const char __pyx_k_A_q_F_0_Zz_PQ[] = "\200A\360\020\000\t\r\320\014\037\230q\330\010\024\220F\320\0320\260\001\260\024\260Z\270z\310\027\320PQ";
static const char __pyx_k_A_wat84xtCSST[] = "\200A\360\010\000\t \230w\240a\240t\2508\2604\260x\270t\320CS\320ST";
static const char __pyx_k_Constraint_lb[] = "Constraint.lb";
static const char __pyx_k_Constraint_ub[] = "Constraint.ub";
static const char __pyx_k_OutputHandler[] = "OutputHandler";
static const char __pyx_k_Parameter_set[] = "Parameter.set";
static const char __pyx_k_Row_to_string[] = "Row.to_string";
static const char __pyx_k_SHELL_MESSAGE[] = "SHELL_MESSAGE";
static const char __pyx_k_Set_instances[] = "Set.instances";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_StreamHandler[] = "StreamHandler";
static const char __pyx_k_Variable_dual[] = "Variable.dual";
static const char __pyx_k_Variable_init[] = "Variable.init";
static const char __pyx_k_ampl_instance[] = "ampl_instance";
static const char __pyx_k_amplpy_gurobi[] = "amplpy_gurobi";
static const char __pyx_k_amplpy_xpress[] = "amplpy_xpress";
static const char __pyx_k_arrow_c_array[] = "__arrow_c_array__";
static const char __pyx_k_class_getitem[] = "__class_getitem__";
static const char __pyx_k_error_handler[] = "error_handler";
static const char __pyx_k_getConstraint[] = "getConstraint";
static const char __pyx_k_getLineNumber[] = "getLineNumber";
static const char __pyx_k_getNumIndices[] = "_getNumIndices";
static const char __pyx_k_getObjectives[] = "getObjectives";
static const char __pyx_k_getParameters[] = "getParameters";
static const char __pyx_k_getRowByIndex[] = "_getRowByIndex";
static const char __pyx_k_getSourceName[] = "getSourceName";
static const char __pyx_k_get_objective[] = "get_objective";
static const char __pyx_k_get_parameter[] = "get_parameter";
static const char __pyx_k_get_variables[] = "get_variables";
static const char __pyx_k_num_instances[] = "num_instances";
static const char __pyx_k_q_F_Qd_HG1JhV[] = "\320\004'\240q\360\022\000\t\025\220F\230+\240Q\240d\250*\260H\270G\3001\300J\310h\320V]\320]^\320^_";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_return_output[] = "return_output";
static const char __pyx_k_stopRecording[] = "_stopRecording";
static const char __pyx_k_z_q_1G1_t1A_q[] = "\210\001\330\014\017\210z\230\021\230'\240\021\330\020\027\220q\330\021\033\2301\230G\2401\330\020\027\220t\2301\230A\340\020\027\220q\230\001";
static const char __pyx_k_AMPL_get_value[] = "AMPL.get_value";
static const char __pyx_k_AMPL_read_data[] = "AMPL.read_data";
static const char __pyx_k_AMPL_to_string[] = "AMPL.to_string";
static const char __pyx_k_A_F_4waq_WAV86[] = "\200A\360\034\000\t\035\230F\240!\2404\240w\250a\250q\330\010\025\220W\230A\230V\2408\2506\260\021";
static const char __pyx_k_A_F_6at81A_s_1[] = "\200A\360\020\000\t\025\220F\320\0326\260a\260t\2708\3001\300A\330\010\017\210s\220!\2201";
static const char __pyx_k_A_F_AT_3ay_q_6[] = "\200A\360\032\000\t\025\220F\230*\240A\240T\250\032\2603\260a\260y\300\007\300q\310\001\330\010\014\320\014#\2406\250\021";
static const char __pyx_k_A_QgQ_5_1_5_1A[] = "\210A\330\020\023\220:\230Q\230g\240Q\330\024\030\230\005\230]\250!\2505\260\n\270!\2701\340\024\030\230\005\230]\250!\2505\260\013\2701\270A";
static const char __pyx_k_A_fAQ_A_t_3a_a[] = "\210A\330\020\021\330\024\030\230\016\240f\250A\250Q\330\020\027\220}\240A\330\024\027\220t\320\033+\2503\250a\330\030\034\320\034.\250a";
static const char __pyx_k_AssertionError[] = "AssertionError";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_Column_to_list[] = "Column.to_list";
static const char __pyx_k_Constraint_lbs[] = "Constraint.lbs";
static const char __pyx_k_Constraint_ubs[] = "Constraint.ubs";
static const char __pyx_k_Constraint_val[] = "Constraint.val";
static const char __pyx_k_DataFrameArrow[] = "DataFrameArrow";
static const char __pyx_k_EntityMap_size[] = "EntityMap.size";
static const char __pyx_k_Entity_to_dict[] = "Entity.to_dict";
static const char __pyx_k_Entity_to_list[] = "Entity.to_list";
static const char __pyx_k_Objective_drop[] = "Objective.drop";
static const char __pyx_k_Set_get_values[] = "Set.get_values";
static const char __pyx_k_Set_set_values[] = "Set.set_values";
static const char __pyx_k_Variable_init0[] = "Variable.init0";
static const char __pyx_k_Variable_slack[] = "Variable.slack";
static const char __pyx_k_Variable_unfix[] = "Variable.unfix";
static const char __pyx_k_Variable_value[] = "Variable.value";
static const char __pyx_k_amplpy_set_pxi[] = "amplpy/set.pxi";
static const char __pyx_k_arrow_c_schema[] = "__arrow_c_schema__";
static const char __pyx_k_c_array_stream[] = "c_array_stream";
static const char __pyx_k_c_double_array[] = "c_double_array";
static const char __pyx_k_c_string_array[] = "c_string_array";
static const char __pyx_k_getConstraints[] = "getConstraints";
static const char __pyx_k_get_constraint[] = "get_constraint";
static const char __pyx_k_get_objectives[] = "get_objectives";
static const char __pyx_k_get_parameters[] = "get_parameters";
static const char __pyx_k_last_exception[] = "last_exception";
static const char __pyx_k_output_handler[] = "output_handler";
static const char __pyx_k_preserve_index[] = "preserve_index";
static const char __pyx_k_set_data_arrow[] = "set_data_arrow";
static const char __pyx_k_startRecording[] = "_startRecording";
static const char __pyx_k_stop_recording[] = "_stop_recording";
static const char __pyx_k_z_q_1G1_uAQ_iq[] = "\220\001\330\024\027\220z\240\021\240'\250\021\330\030\037\230q\330\031#\2401\240G\2501\330\030\037\230u\240A\240Q\340\030\036\230i\240q\250\001";
static const char __pyx_k_AMPL_get_entity[] = "AMPL.get_entity";
static const char __pyx_k_AMPL_get_option[] = "AMPL.get_option";
static const char __pyx_k_AMPL_get_output[] = "AMPL.get_output";
static const char __pyx_k_AMPL_is_running[] = "AMPL.is_running";
static const char __pyx_k_AMPL_read_table[] = "AMPL.read_table";
static const char __pyx_k_AMPL_set_option[] = "AMPL.set_option";
static const char __pyx_k_A_1_Yaq_Qiwaq_q[] = "\200A\360\n\000\0161\260\001\260\024\260Y\270a\270q\330\010\022\220#\220Q\220i\230w\240a\240q\330\010\017\210q";
static const char __pyx_k_Constraint_body[] = "Constraint.body";
static const char __pyx_k_Constraint_drop[] = "Constraint.drop";
static const char __pyx_k_Constraint_dual[] = "Constraint.dual";
static const char __pyx_k_Objective_value[] = "Objective.value";
static const char __pyx_k_Parameter_value[] = "Parameter.value";
static const char __pyx_k_SUPPORT_MESSAGE[] = "_SUPPORT_MESSAGE";
static const char __pyx_k_Variable_defeqn[] = "Variable.defeqn";
static const char __pyx_k_Variable_lslack[] = "Variable.lslack";
static const char __pyx_k_Variable_status[] = "Variable.status";
static const char __pyx_k_Variable_uslack[] = "Variable.uslack";
static const char __pyx_k_amplpy_ampl_pyx[] = "amplpy/ampl.pyx";
static const char __pyx_k_arrow_array_ptr[] = "arrow_array_ptr";
static const char __pyx_k_c_array_capsule[] = "c_array_capsule";
static const char __pyx_k_cannot_be_found[] = " cannot be found.";
static const char __pyx_k_collections_abc[] = "collections.abc";
static const char __pyx_k_getErrorHandler[] = "getErrorHandler";
static const char __pyx_k_getIndexingSets[] = "getIndexingSets";
static const char __pyx_k_get_constraints[] = "get_constraints";
static const char __pyx_k_get_line_number[] = "get_line_number";
static const char __pyx_k_get_num_indices[] = "_get_num_indices";
static const char __pyx_k_get_source_name[] = "get_source_name";
static const char __pyx_k_import_entities[] = "import_entities";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setErrorHandler[] = "setErrorHandler";
static const char __pyx_k_set_locals_Sets[] = "_set.<locals>.Sets";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_start_recording[] = "_start_recording";
static const char __pyx_k_AMPL__set_option[] = "AMPL._set_option";
static const char __pyx_k_AMPL_export_data[] = "AMPL.export_data";
static const char __pyx_k_AMPL_write_table[] = "AMPL.write_table";
static const char __pyx_k_A_4y_q_k_a_1AT_1[] = "\200A\360\014\000\t\014\2104\210y\230\007\230q\330\014\030\230\006\230k\250\021\250$\250a\330\021\033\2301\230A\230T\240\021\330\014\020\220\013\2301";
static const char __pyx_k_A_F_1D_j_HAQ_s_1[] = "\200A\360\014\000\t\025\220F\320\032+\2501\250D\260\006\260j\300\004\300H\310A\310Q\330\010\017\210s\220!\2201";
static const char __pyx_k_A_at9AQ_Cq_7_1_q[] = "\200A\340\r&\240a\240t\2509\260A\260Q\330\010\024\220C\220q\230\013\2407\250!\2501\330\010\017\210q";
static const char __pyx_k_A_q_F_D_1_1_aq_q[] = "\200A\360\014\000\t\032\230\036\240q\250\004\250F\260*\270D\300\010\310\001\310\021\330\010\013\2101\330\014\030\230\001\230\021\330\010\025\220]\240!\2401\330\r\036\230a\230q\240\001\330\010\017\210q";
static const char __pyx_k_Column_to_string[] = "Column.to_string";
static const char __pyx_k_Constraint_dinit[] = "Constraint.dinit";
static const char __pyx_k_Constraint_ldual[] = "Constraint.ldual";
static const char __pyx_k_Constraint_slack[] = "Constraint.slack";
static const char __pyx_k_Constraint_udual[] = "Constraint.udual";
static const char __pyx_k_Entity_instances[] = "Entity.instances";
static const char __pyx_k_Entity_is_scalar[] = "Entity.is_scalar";
static const char __pyx_k_Entity_to_pandas[] = "Entity.to_pandas";
static const char __pyx_k_Entity_to_string[] = "Entity.to_string";
static const char __pyx_k_InstanceIterator[] = "InstanceIterator";
static const char __pyx_k_Objective_result[] = "Objective.result";
static const char __pyx_k_Variable_astatus[] = "Variable.astatus";
static const char __pyx_k_Variable_sstatus[] = "Variable.sstatus";
static const char __pyx_k_ampl_expressions[] = "ampl_expressions";
static const char __pyx_k_arrow_schema_ptr[] = "arrow_schema_ptr";
static const char __pyx_k_binary_directory[] = "binary_directory";
static const char __pyx_k_c_schema_capsule[] = "c_schema_capsule";
static const char __pyx_k_getOutputHandler[] = "getOutputHandler";
static const char __pyx_k_get_row_by_index[] = "_get_row_by_index";
static const char __pyx_k_setOutputHandler[] = "setOutputHandler";
static const char __pyx_k_solve_result_num[] = "solve_result_num";
static const char __pyx_k_unsupported_type[] = "unsupported type ";
static const char __pyx_k_AMPL_export_model[] = "AMPL.export_model";
static const char __pyx_k_AMPL_get_solution[] = "AMPL.get_solution";
static const char __pyx_k_AMPL_get_variable[] = "AMPL.get_variable";
static const char __pyx_k_A_F_31D_j_HTUUV_q[] = "\200A\360\014\000\t\025\220F\320\0323\2601\260D\270\006\270j\310\004\310H\320TU\320UV\330\010\017\210q";
static const char __pyx_k_A_F_5Qd_hVWWX_s_1[] = "\200A\360\n\000\t\025\220F\320\0325\260Q\260d\270&\300\n\310$\310h\320VW\320WX\330\010\017\210s\220!\2201";
static const char __pyx_k_A_F_7q_HF_QRR_WAT[] = "\200A\360\020\000\t\025\220F\320\0327\260q\270\004\270H\300F\310'\320QR\320R\\\320\\]\320]^\330\010\025\220W\230A\230T\240\030\250\021";
static const char __pyx_k_A_variable_called[] = "A variable called ";
static const char __pyx_k_Constraint_defvar[] = "Constraint.defvar";
static const char __pyx_k_Constraint_dinit0[] = "Constraint.dinit0";
static const char __pyx_k_Constraint_lslack[] = "Constraint.lslack";
static const char __pyx_k_Constraint_status[] = "Constraint.status";
static const char __pyx_k_Constraint_uslack[] = "Constraint.uslack";
static const char __pyx_k_DataFrame_to_dict[] = "DataFrame.to_dict";
static const char __pyx_k_DataFrame_to_list[] = "DataFrame.to_list";
static const char __pyx_k_Entity_get_values[] = "Entity.get_values";
static const char __pyx_k_Entity_indexarity[] = "Entity.indexarity";
static const char __pyx_k_Entity_set_values[] = "Entity.set_values";
static const char __pyx_k_Objective_astatus[] = "Objective.astatus";
static const char __pyx_k_Objective_message[] = "Objective.message";
static const char __pyx_k_Objective_restore[] = "Objective.restore";
static const char __pyx_k_Objective_sstatus[] = "Objective.sstatus";
static const char __pyx_k_PresolveException[] = "PresolveException";
static const char __pyx_k_Unknown_exception[] = "Unknown exception";
static const char __pyx_k_amplpy_entity_pxi[] = "amplpy/entity.pxi";
static const char __pyx_k_export_copt_model[] = "export_copt_model";
static const char __pyx_k_export_scip_model[] = "export_scip_model";
static const char __pyx_k_get_error_handler[] = "get_error_handler";
static const char __pyx_k_get_indexing_sets[] = "get_indexing_sets";
static const char __pyx_k_scalar_expression[] = "scalar_expression";
static const char __pyx_k_set_error_handler[] = "set_error_handler";
static const char __pyx_k_throw_on_warnings[] = "_throw_on_warnings";
static const char __pyx_k_AMPL__load_session[] = "AMPL._load_session";
static const char __pyx_k_AMPL_get_objective[] = "AMPL.get_objective";
static const char __pyx_k_AMPL_get_parameter[] = "AMPL.get_parameter";
static const char __pyx_k_AMPL_get_variables[] = "AMPL.get_variables";
static const char __pyx_k_A_7q_F_DPXXYYZ_1_1[] = "\200A\360\024\000\t\n\330\014\030\230\006\320\0367\260q\270\004\270F\300*\310D\320PX\320XY\320YZ\330\014\023\2201\330\017\020\330\014\023\2201";
static const char __pyx_k_A_QhfA_1E_Qa_1E_AQ[] = "\210A\330\020\023\220:\230Q\230h\240f\250A\330\024\030\230\005\230^\2501\250E\260\024\260Q\260a\340\024\030\230\005\230^\2501\250E\260\033\270A\270Q";
static const char __pyx_k_A_parameter_called[] = "A parameter called ";
static const char __pyx_k_A_z_31D_q_AQa_1_ha[] = "\200A\360\032\000\t(\240z\260\021\260!\330\010\031\320\0313\2601\260D\270\010\300\007\300q\310\001\330\r\034\230A\230Q\230a\330\010\013\2101\330\014\030\230\001\230\021\330\010\022\220'\230\021\230$\230h\240a";
static const char __pyx_k_Constraint_astatus[] = "Constraint.astatus";
static const char __pyx_k_Constraint_restore[] = "Constraint.restore";
static const char __pyx_k_Constraint_sstatus[] = "Constraint.sstatus";
static const char __pyx_k_DataFrame__add_row[] = "DataFrame._add_row";
static const char __pyx_k_DataFrame__get_row[] = "DataFrame._get_row";
static const char __pyx_k_ErrorHandler_error[] = "ErrorHandler.error";
static const char __pyx_k_Objective_exitcode[] = "Objective.exitcode";
static const char __pyx_k_Variable_set_value[] = "Variable.set_value";
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_export_cplex_model[] = "export_cplex_model";
static const char __pyx_k_export_highs_model[] = "export_highs_model";
static const char __pyx_k_get_output_handler[] = "get_output_handler";
static const char __pyx_k_set_output_handler[] = "set_output_handler";
static const char __pyx_k_AMPL_get_constraint[] = "AMPL.get_constraint";
static const char __pyx_k_AMPL_get_objectives[] = "AMPL.get_objectives";
static const char __pyx_k_AMPL_get_parameters[] = "AMPL.get_parameters";
static const char __pyx_k_AMPL_set_data_arrow[] = "AMPL.set_data_arrow";
static const char __pyx_k_A_F_31D_j_HTUUV_q_2[] = "\200A\360&\000\t\025\220F\320\0323\2601\260D\270\006\270j\310\004\310H\320TU\320UV\330\010\017\210q";
static const char __pyx_k_A_QgQ__AU_1A__AU_Qa[] = "\210A\330\020\023\220:\230Q\230g\240Q\330\024\030\230\005\230_\250A\250U\260)\2701\270A\340\024\030\230\005\230_\250A\250U\260+\270Q\270a";
static const char __pyx_k_A_constraint_called[] = "A constraint called ";
static const char __pyx_k_An_objective_called[] = "An objective called ";
static const char __pyx_k_Constraint_set_dual[] = "Constraint.set_dual";
static const char __pyx_k_DROP_OR_RESTORE_ALL[] = "DROP_OR_RESTORE_ALL";
static const char __pyx_k_DataFrame_from_dict[] = "DataFrame.from_dict";
static const char __pyx_k_DataFrame_to_pandas[] = "DataFrame.to_pandas";
static const char __pyx_k_DataFrame_to_string[] = "DataFrame.to_string";
static const char __pyx_k_ErrorHandlerWrapper[] = "ErrorHandlerWrapper";
static const char __pyx_k_MemberRangeIterator[] = "MemberRangeIterator";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_PresolveException_2[] = "PresolveException: ";
static const char __pyx_k_Row___reduce_cython[] = "Row.__reduce_cython__";
static const char __pyx_k_Set___reduce_cython[] = "Set.__reduce_cython__";
static const char __pyx_k_amplpy_variable_pxi[] = "amplpy/variable.pxi";
static const char __pyx_k_export_gurobi_model[] = "export_gurobi_model";
static const char __pyx_k_export_xpress_model[] = "export_xpress_model";
static const char __pyx_k_from_data_frame_ref[] = "_from_data_frame_ref";
static const char __pyx_k_getCurrentObjective[] = "getCurrentObjective";
static const char __pyx_k_getRecordedEntities[] = "getRecordedEntities";
static const char __pyx_k_A6_4z_E_a_F_AT_WAQ_6[] = "\200A\3606\000\t\014\2104\210z\230\031\240\"\240E\250\025\250a\330\014\032\230!\330\010\024\220F\230*\240A\240T\250\032\260:\270W\300A\300Q\330\010\014\320\014#\2406\250\021";
static const char __pyx_k_AMPL___reduce_cython[] = "AMPL.__reduce_cython__";
static const char __pyx_k_AMPL__stop_recording[] = "AMPL._stop_recording";
static const char __pyx_k_AMPL_get_constraints[] = "AMPL.get_constraints";
static const char __pyx_k_A_31F_a_a_F_q_JiwdRS[] = "\200A\360\016\000\t#\240!\330\014\r\360\n\000\r\016\360\016\000\r\016\360\024\000\r\016\360\014\000\t!\320 3\2601\260F\270!\340\010\014\320\014\036\230a\330\010\014\320\014&\240a\340\010\024\220F\320\032/\250q\260\004\260J\270i\300w\310d\320RS";
static const char __pyx_k_A_F_9_fJdRZZ_ggllmmn[] = "\200A\360\036\000\t\025\220F\320\0329\270\021\270$\270f\300J\310d\320RZ\320Z^\320^g\320gl\320lm\320mn";
static const char __pyx_k_A_F_Qd_RVV_bbkkllm_q[] = "\200A\360\n\000\t\025\220F\320\032=\270Q\270d\300&\310\n\320RV\320V^\320^b\320bk\320kl\320lm\330\010\030\230\007\230q\240\001";
static const char __pyx_k_DataFrame_from_numpy[] = "DataFrame.from_numpy";
static const char __pyx_k_Entity_num_instances[] = "Entity.num_instances";
static const char __pyx_k_ErrorHandler_warning[] = "ErrorHandler.warning";
static const char __pyx_k_OutputHandler_output[] = "OutputHandler.output";
static const char __pyx_k_Parameter_set_values[] = "Parameter.set_values";
static const char __pyx_k_Unexpected_data_type[] = "Unexpected data type: ";
static const char __pyx_k_Unknown_entity_class[] = "Unknown entity class.";
static const char __pyx_k_amplpy_dataframe_pxi[] = "amplpy/dataframe.pxi";
static const char __pyx_k_amplpy_iterators_pxi[] = "amplpy/iterators.pxi";
static const char __pyx_k_amplpy_objective_pxi[] = "amplpy/objective.pxi";
static const char __pyx_k_amplpy_parameter_pxi[] = "amplpy/parameter.pxi";
static const char __pyx_k_var_locals_Variables[] = "_var.<locals>.Variables";
static const char __pyx_k_AMPL__start_recording[] = "AMPL._start_recording";
static const char __pyx_k_A_4xwa_7q_F_DPXXYYZ_q[] = "\200A\360(\000\t\014\2104\210x\220w\230a\330\014\031\230\021\340\014\030\230\006\320\0367\260q\270\004\270F\300*\310D\320PX\320XY\320YZ\330\010\017\210q";
static const char __pyx_k_A_F_1_haq_1G7_1_Qaq_q[] = "\200A\340\010\024\220F\320\0321\260\021\260$\260h\270a\270q\330\010\020\220\003\2201\220G\2307\240!\2401\330\r\035\230Q\230a\230q\330\010\017\210q";
static const char __pyx_k_A_QgQ_t9AQ_E_AV3e1A_q[] = "\210A\330\020\023\220:\230Q\230g\240Q\330\024\027\220t\2309\240A\240Q\330\030\034\230E\240\033\250A\250V\2603\260e\2701\270A\340\024\030\230\005\230[\250\001\250\026\250q";
static const char __pyx_k_A_q_Jaq_1_AXWAQ_Qaq_q[] = "\200A\360\006\000\t\032\230\036\240q\250\004\250J\260a\260q\330\010\013\2101\330\014\030\230\001\230\021\330\010\021\220\023\220A\220X\230W\240A\240Q\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_Constraint_is_logical[] = "Constraint.is_logical";
static const char __pyx_k_DataFrame__add_column[] = "DataFrame._add_column";
static const char __pyx_k_DataFrame__get_column[] = "DataFrame._get_column";
static const char __pyx_k_DataFrame__set_column[] = "DataFrame._set_column";
static const char __pyx_k_DataFrame__set_values[] = "DataFrame._set_values";
static const char __pyx_k_DataFrame_from_pandas[] = "DataFrame.from_pandas";
static const char __pyx_k_Environment_to_string[] = "Environment.to_string";
static const char __pyx_k_Expected_a_dictionary[] = "Expected a dictionary";
static const char __pyx_k_InstanceIterator_size[] = "InstanceIterator.size";
static const char __pyx_k_Parameter_has_default[] = "Parameter.has_default";
static const char __pyx_k_Parameter_is_symbolic[] = "Parameter.is_symbolic";
static const char __pyx_k_Row___setstate_cython[] = "Row.__setstate_cython__";
static const char __pyx_k_Set___setstate_cython[] = "Set.__setstate_cython__";
static const char __pyx_k_amplpy_constraint_pxi[] = "amplpy/constraint.pxi";
static const char __pyx_k_amplpy_exceptions_pxi[] = "amplpy/exceptions.pxi";
static const char __pyx_k_display_error_message[] = "display_error_message";
static const char __pyx_k_error_handler_wrapper[] = "error_handler_wrapper";
static const char __pyx_k_get_current_objective[] = "get_current_objective";
static const char __pyx_k_hk_A_1_kkmmn_7_q0_a_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!k\320km\320mn\330\004\023\220=\240\010\250\001\250\021\330\004\007\200|\2207\230!\330\010/\250q\3200@\300\016\310a\330\004\013\2101";
static const char __pyx_k_import_ampls_solution[] = "import_ampls_solution";
static const char __pyx_k_iter___locals_genexpr[] = "__iter__.<locals>.genexpr";
static const char __pyx_k_levelname_s_message_s[] = "[%(levelname)s] %(message)s";
static const char __pyx_k_obj_locals_Objectives[] = "_obj.<locals>.Objectives";
static const char __pyx_k_option_locals_Options[] = "_option.<locals>.Options";
static const char __pyx_k_AMPL_NOT_FOUND_MESSAGE[] = "AMPL_NOT_FOUND_MESSAGE";
static const char __pyx_k_AMPL___setstate_cython[] = "AMPL.__setstate_cython__";
static const char __pyx_k_AMPL_get_error_handler[] = "AMPL.get_error_handler";
static const char __pyx_k_AMPL_set_error_handler[] = "AMPL.set_error_handler";
static const char __pyx_k_A_1_1_1_t9AU_a_1_4q_aq[] = "\320\004 \240\014\250A\360(\000\t\014\2101\330\014\023\2201\340\014\023\2201\330\010\027\220t\2309\240A\240U\250(\260!\260;\270a\330\010\013\2101\330\014\023\2204\220q\230\001\330\010\017\320\017&\240a\240q";
static const char __pyx_k_A_F_2_4vZt8SWW_aab_s_1[] = "\200A\360\n\000\t\025\220F\320\0322\260!\2604\260v\270Z\300t\3108\320SW\320W`\320`a\320ab\330\010\017\210s\220!\2201";
static const char __pyx_k_A_F_4waq_AT_81A_1_ha_a[] = "\200A\360\030\000\t\035\230F\240!\2404\240w\250a\250q\330\010\031\320\031,\250A\250T\260\032\2708\3001\300A\330\010\013\2101\330\014\020\220\001\220\021\330\014\030\230\001\230\021\330\010\013\210;\220h\230a\330\014\020\220\001\220\021\330\014\031\230\026\230{\250!\330\010\022\220'\230\021\230&\240\010\250\006\250a";
static const char __pyx_k_A_haq_A_t_3a_4uKq0Fc_2[] = "\210A\330\020\021\330\024\030\230\016\240h\250a\250q\330\020\027\220}\240A\330\024\027\220t\320\033+\2503\250a\330\030\033\2304\230u\240K\250q\3200F\300c\310\021\360\006\000\035!\320 2\260!";
static const char __pyx_k_A_q_J6GwazYZZ_1_1_aq_q[] = "\200A\360\"\000\t\032\230\036\240q\250\004\250J\3206G\300w\310a\310z\320YZ\320Z[\330\010\013\2101\330\014\030\230\001\230\021\340\010\025\220]\240!\2401\330\r\036\230a\230q\240\001\340\010\017\210q";
static const char __pyx_k_Column___reduce_cython[] = "Column.__reduce_cython__";
static const char __pyx_k_DataFrame__get_headers[] = "DataFrame._get_headers";
static const char __pyx_k_Entity___reduce_cython[] = "Entity.__reduce_cython__";
static const char __pyx_k_Failed_to_access_value[] = "Failed to access value";
static const char __pyx_k_InfeasibilityException[] = "InfeasibilityException";
static const char __pyx_k_Objective_minimization[] = "Objective.minimization";
static const char __pyx_k_amplpy_environment_pxi[] = "amplpy/environment.pxi";
static const char __pyx_k_con_locals_Constraints[] = "_con.<locals>.Constraints";
static const char __pyx_k_set_locals_Sets___init[] = "_set.<locals>.Sets.__init__";
static const char __pyx_k_set_locals_Sets___iter[] = "_set.<locals>.Sets.__iter__";
static const char __pyx_k_AMPL_get_output_handler[] = "AMPL.get_output_handler";
static const char __pyx_k_AMPL_set_output_handler[] = "AMPL.set_output_handler";
static const char __pyx_k_A_F_vQ_z_4y_1F_U_1_Kq_a[] = "\200A\330\010\014\210F\220)\230<\240v\250Q\330\014\017\210z\230\021\230'\240\021\330\020\023\2204\220y\240\001\240\021\330\024\030\230\013\2401\240F\250#\250U\260!\2601\340\020\024\220K\230q\240\006\240a";
static const char __pyx_k_DataFrame__get_num_cols[] = "DataFrame._get_num_cols";
static const char __pyx_k_DataFrame__get_num_rows[] = "DataFrame._get_num_rows";
static const char __pyx_k_Environment_get_bin_dir[] = "Environment.get_bin_dir";
static const char __pyx_k_Environment_set_bin_dir[] = "Environment.set_bin_dir";
static const char __pyx_k_Excepted_string_or_real[] = "Excepted string or real.";
static const char __pyx_k_Excepted_tuple_of_arity[] = "Excepted tuple of arity ";
static const char __pyx_k_amplpy_errorhandler_pxi[] = "amplpy/errorhandler.pxi";
static const char __pyx_k_nested_dict_of_suffixes[] = "nested_dict_of_suffixes";
static const char __pyx_k_param_locals_Parameters[] = "_param.<locals>.Parameters";
static const char __pyx_k_AMPLException_get_offset[] = "AMPLException.get_offset";
static const char __pyx_k_Column___setstate_cython[] = "Column.__setstate_cython__";
static const char __pyx_k_Entity___setstate_cython[] = "Entity.__setstate_cython__";
static const char __pyx_k_Entity_get_indexing_sets[] = "Entity.get_indexing_sets";
static const char __pyx_k_Environment_get_bin_name[] = "Environment.get_bin_name";
static const char __pyx_k_Environment_set_bin_name[] = "Environment.set_bin_name";
static const char __pyx_k_Expected_tuples_of_arity[] = "Expected tuples of arity ";
static const char __pyx_k_InfeasibilityException_2[] = "InfeasibilityException: ";
static const char __pyx_k_MemberRangeIterator_size[] = "MemberRangeIterator.size";
static const char __pyx_k_Variable___reduce_cython[] = "Variable.__reduce_cython__";
static const char __pyx_k_amplpy_outputhandler_pxi[] = "amplpy/outputhandler.pxi";
static const char __pyx_k_from_dict_locals_genexpr[] = "from_dict.<locals>.genexpr";
static const char __pyx_k_hk_A_1_kkmmn_xq_7_a_nA_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!k\320km\320mn\330\004\023\220<\230x\240q\250\001\330\004\007\200|\2207\230!\330\010.\250a\250\270n\310A\330\004\013\2101";
static const char __pyx_k_AMPLException_get_message[] = "AMPLException.get_message";
static const char __pyx_k_AMPL_could_not_be_started[] = "AMPL could not be started";
static const char __pyx_k_A_F_7q_F_DPXX_H_H_I_I_J_q[] = "\200A\360\n\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001H\002\360\000\000H\002I\002\360\000\000I\002J\002\330\010\017\210q";
static const char __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q[] = "\200A\360\014\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001I\002\360\000\000I\002J\002\360\000\000J\002K\002\330\010\017\210q";
static const char __pyx_k_A_F_7q_F_DPXX_J_J_K_K_L_q[] = "\200A\360\n\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001J\002\360\000\000J\002K\002\360\000\000K\002L\002\330\010\017\210q";
static const char __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q[] = "\200A\360\n\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001K\002\360\000\000K\002L\002\360\000\000L\002M\002\330\010\017\210q";
static const char __pyx_k_A_F_7q_F_DPXX_L_L_M_M_N_q[] = "\200A\360\n\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001L\002\360\000\000L\002M\002\360\000\000M\002N\002\330\010\017\210q";
static const char __pyx_k_DataFrame___reduce_cython[] = "DataFrame.__reduce_cython__";
static const char __pyx_k_EntityMap___reduce_cython[] = "EntityMap.__reduce_cython__";
static const char __pyx_k_Objective___reduce_cython[] = "Objective.__reduce_cython__";
static const char __pyx_k_Parameter___reduce_cython[] = "Parameter.__reduce_cython__";
static const char __pyx_k_add_column_locals_genexpr[] = "_add_column.<locals>.genexpr";
static const char __pyx_k_from_dict_locals_to_tuple[] = "from_dict.<locals>.to_tuple";
static const char __pyx_k_pyx_unpickle_ErrorHandler[] = "__pyx_unpickle_ErrorHandler";
static const char __pyx_k_set_locals_Sets___getitem[] = "_set.<locals>.Sets.__getitem__";
static const char __pyx_k_set_locals_Sets___setitem[] = "_set.<locals>.Sets.__setitem__";
static const char __pyx_k_set_option_locals_genexpr[] = "_set_option.<locals>.genexpr";
static const char __pyx_k_set_values_locals_genexpr[] = "set_values.<locals>.genexpr";
static const char __pyx_k_AMPL_get_current_objective[] = "AMPL.get_current_objective";
static const char __pyx_k_AMPL_import_ampls_solution[] = "AMPL.import_ampls_solution";
static const char __pyx_k_A_F_4waq_AT_81A_1_ha_1_xvQ[] = "\200A\360\030\000\t\035\230F\240!\2404\240w\250a\250q\330\010\031\320\031,\250A\250T\260\032\2708\3001\300A\330\010\013\2101\330\014\020\220\001\220\021\330\014\030\230\001\230\021\330\010\013\210;\220h\230a\330\014\020\220\001\220\021\330\014\031\230\026\320\0371\260\021\330\010\031\230\027\240\001\240\026\240x\250v\260Q";
static const char __pyx_k_A_G1F_a_vWA_q_q_q_T_G1_T_A[] = "\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220q\330\004\007\200q\330\010\017\320\017-\250T\260\021\260'\270\033\300G\3101\340\010\017\320\017-\250T\260\021\260'\270\033\300A";
static const char __pyx_k_A_Zq_2_4vZt8SYY____AQa_1_q[] = "\200A\360\024\000\t&\240Z\250q\260\001\330\010\031\320\0312\260!\2604\260v\270Z\300t\3108\320SY\320Y^\320^_\320_`\330\r\034\230A\230Q\230a\330\010\013\2101\330\014\030\230\001\230\021\330\010\017\210q";
static const char __pyx_k_Constraint___reduce_cython[] = "Constraint.__reduce_cython__";
static const char __pyx_k_DataFrameArrow_from_pandas[] = "DataFrameArrow.from_pandas";
static const char __pyx_k_DataFrameArrow_from_polars[] = "DataFrameArrow.from_polars";
static const char __pyx_k_DataFrame__get_num_indices[] = "DataFrame._get_num_indices";
static const char __pyx_k_Variable___setstate_cython[] = "Variable.__setstate_cython__";
static const char __pyx_k_amplpy_dataframe_arrow_pxi[] = "amplpy/dataframe_arrow.pxi";
static const char __pyx_k_get_headers_locals_genexpr[] = "_get_headers.<locals>.genexpr";
static const char __pyx_k_pyx_unpickle_AMPLException[] = "__pyx_unpickle_AMPLException";
static const char __pyx_k_pyx_unpickle_OutputHandler[] = "__pyx_unpickle_OutputHandler";
static const char __pyx_k_set_values_locals_cast_row[] = "set_values.<locals>.cast_row";
static const char __pyx_k_A_31D_j_HTUUV_1_AXWAQ_Qaq_q[] = "\200A\360\006\000\t\032\320\0313\2601\260D\270\006\270j\310\004\310H\320TU\320UV\330\010\013\2101\330\014\030\230\001\230\021\330\010\021\220\023\220A\220X\230W\240A\240Q\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_A_F_4AT_z_XUYYz_I_I_J_J_K_q[] = "\200A\360\014\000\t\025\220F\320\0324\260A\260T\270\026\270z\310\024\310X\320UY\320Yz\360\000\000{\001I\002\360\000\000I\002J\002\360\000\000J\002K\002\330\010\017\210q";
static const char __pyx_k_A_F_4AT_z_XUYYz_K_K_L_L_M_q[] = "\200A\360\014\000\t\025\220F\320\0324\260A\260T\270\026\270z\310\024\310X\320UY\320Yz\360\000\000{\001K\002\360\000\000K\002L\002\360\000\000L\002M\002\330\010\017\210q";
static const char __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2[] = "\200A\360\n\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001I\002\360\000\000I\002J\002\360\000\000J\002K\002\330\010\017\210q";
static const char __pyx_k_A_F_7q_F_DPXX_J_J_K_K_L_q_2[] = "\200A\360\024\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001J\002\360\000\000J\002K\002\360\000\000K\002L\002\330\010\017\210q";
static const char __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q_2[] = "\200A\360\014\000\t\025\220F\320\0327\260q\270\004\270F\300*\310D\320PX\320X\\\320\\}\360\000\000~\001K\002\360\000\000K\002L\002\360\000\000L\002M\002\330\010\017\210q";
static const char __pyx_k_ColIterator___reduce_cython[] = "ColIterator.__reduce_cython__";
static const char __pyx_k_DataFrame___setstate_cython[] = "DataFrame.__setstate_cython__";
static const char __pyx_k_DataFrame__get_row_by_index[] = "DataFrame._get_row_by_index";
static const char __pyx_k_EntityMap___setstate_cython[] = "EntityMap.__setstate_cython__";
static const char __pyx_k_EnvIterator___reduce_cython[] = "EnvIterator.__reduce_cython__";
static const char __pyx_k_Environment___reduce_cython[] = "Environment.__reduce_cython__";
static const char __pyx_k_Objective___setstate_cython[] = "Objective.__setstate_cython__";
static const char __pyx_k_Parameter___setstate_cython[] = "Parameter.__setstate_cython__";
static const char __pyx_k_RowIterator___reduce_cython[] = "RowIterator.__reduce_cython__";
static const char __pyx_k_var_locals_Variables___init[] = "_var.<locals>.Variables.__init__";
static const char __pyx_k_var_locals_Variables___iter[] = "_var.<locals>.Variables.__iter__";
static const char __pyx_k_6_A_7q_F_DPXX_at6_SWW__ccllm[] = "\320\004\030\230\001\360\020\000\t\014\2106\220\023\220A\330\014\030\230\006\320\0367\260q\270\004\270F\300*\310D\320PX\320X\\\320\\]\340\014\030\230\006\320\036>\270a\270t\3006\310\032\320SW\320W_\320_c\320cl\320lm";
static const char __pyx_k_A_F_4waq_AT_81A_1_ha_0_q_hfA[] = "\200A\360\030\000\t\035\230F\240!\2404\240w\250a\250q\330\010\031\320\031,\250A\250T\260\032\2708\3001\300A\330\010\013\2101\330\014\020\220\001\220\021\330\014\030\230\001\230\021\330\010\013\210;\220h\230a\330\014\020\220\001\220\021\330\014\031\230\026\320\0370\260\001\330\010\030\230\007\230q\240\006\240h\250f\260A";
static const char __pyx_k_Constraint___setstate_cython[] = "Constraint.__setstate_cython__";
static const char __pyx_k_ErrorHandler___reduce_cython[] = "ErrorHandler.__reduce_cython__";
static const char __pyx_k_obj_locals_Objectives___init[] = "_obj.<locals>.Objectives.__init__";
static const char __pyx_k_obj_locals_Objectives___iter[] = "_obj.<locals>.Objectives.__iter__";
static const char __pyx_k_option_locals_Options___init[] = "_option.<locals>.Options.__init__";
static const char __pyx_k_set_values_locals_cast_value[] = "set_values.<locals>.cast_value";
static const char __pyx_k_AMPLException___reduce_cython[] = "AMPLException.__reduce_cython__";
static const char __pyx_k_AMPLException_get_line_number[] = "AMPLException.get_line_number";
static const char __pyx_k_AMPLException_get_source_name[] = "AMPLException.get_source_name";
static const char __pyx_k_A_2_4z_1_Qiwaq_Qaq_83a_1_4_Qa[] = "\200A\360\014\000\t\032\320\0312\260!\2604\260z\300\021\300!\330\010\013\2101\330\014\030\230\001\230\021\330\010\022\220#\220Q\220i\230w\240a\240q\330\r\035\230Q\230a\230q\330\010\013\2108\2203\220a\330\014\023\2201\340\014\023\2204\220~\240Q\240a";
static const char __pyx_k_A_4z_E_a_F_j_TUUV_AXWAQ_Qaq_q[] = "\200A\360\032\000\t\014\2104\210z\230\031\240\"\240E\250\025\250a\330\014\032\230!\340\010\024\220F\230/\250\021\250$\250j\270\n\300'\310\021\310*\320TU\320UV\330\010\021\220\023\220A\220X\230W\240A\240Q\330\r\035\230Q\230a\230q\330\010\017\210q";
static const char __pyx_k_A_F_4waq_AT_81A_1_ha_q_wavXV1[] = "\200A\360\030\000\t\035\230F\240!\2404\240w\250a\250q\330\010\031\320\031,\250A\250T\260\032\2708\3001\300A\330\010\013\2101\330\014\020\220\001\220\021\330\014\030\230\001\230\021\330\010\013\210;\220h\230a\330\014\020\220\001\220\021\330\014\031\230\026\320\037/\250q\330\010\027\220w\230a\230v\240X\250V\2601";
static const char __pyx_k_A_N_4_E_a_aq_3auCq_L_3awc_r_b[] = "\200A\360\016\000\t\021\220\004\220N\240!\330\010\023\2204\320\027(\250\001\340\010\t\360\020\000\t\r\210E\220\031\230&\240\006\240a\330\014\022\220,\230a\230q\330\014\023\2203\220a\220u\230C\230q\330\014\024\220L\240\001\240\021\330\014\023\2203\220a\220w\230c\240\026\240r\250\021\330\014\020\220\t\230\021\230$\230b\240\001";
static const char __pyx_k_ColIterator___setstate_cython[] = "ColIterator.__setstate_cython__";
static const char __pyx_k_EnvIterator___setstate_cython[] = "EnvIterator.__setstate_cython__";
static const char __pyx_k_Environment___setstate_cython[] = "Environment.__setstate_cython__";
static const char __pyx_k_OutputHandler___reduce_cython[] = "OutputHandler.__reduce_cython__";
static const char __pyx_k_RowIterator___setstate_cython[] = "RowIterator.__setstate_cython__";
static const char __pyx_k_amplpy_copt_package_not_found[] = "amplpy_copt package not found";
static const char __pyx_k_amplpy_scip_package_not_found[] = "amplpy_scip package not found";
static const char __pyx_k_con_locals_Constraints___init[] = "_con.<locals>.Constraints.__init__";
static const char __pyx_k_con_locals_Constraints___iter[] = "_con.<locals>.Constraints.__iter__";
static const char __pyx_k_1_q_JhgQjPSSVVYYZZ_1_AXWAQ_Qaq[] = "\320\004#\2401\360\024\000\t\032\230\036\240q\250\004\250J\260h\270g\300Q\300j\320PS\320SV\320VY\320YZ\320Z[\330\010\013\2101\330\014\030\230\001\230\021\330\010\021\220\023\220A\220X\230W\240A\240Q\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_4_S_Qd_AT_U_q_NRS_4_AS_E_at_QR[] = "\320\004!\240\021\360\016\000\t\014\2104\210~\230S\240\002\240!\330\014\022\220!\330\020\025\220Q\220d\320\032,\250A\250T\260\024\260U\270%\270q\300\004\300N\320RS\360\006\000\r\023\220!\2204\320\027)\250\021\250\"\250A\250S\260\004\260E\270\025\270a\270t\300>\320QR\330\010\013\2101\330\014\024\220D\230\016\240a\330\014\027\220t\320\033,\250A\330\014\017\210v\220R\220y\240\003\2401\330\020\027\220q\230\003\2301\230C\230q\240\004\240A\240S\250\004\250G\2601\340\020\027\220q\230\003\2301\230K\240t\2507\260!\340\014\023\2201";
static const char __pyx_k_A_2_4xq_aq_1_U_a_E_aq_7_1_AQ_q[] = "\200A\360\024\000\t\032\320\0312\260!\2604\260x\270q\300\006\300a\300q\330\010\013\2101\330\014\030\230\001\230\021\330\010\025\220U\230$\230a\330\010\014\210E\220\025\220a\220q\330\021!\240\021\240!\2407\250!\2501\330\010\014\210A\210Q\330\010\017\210q";
static const char __pyx_k_A_F_31D_aq_E_aq_4AT_s_iqPQ_7_q[] = "\200A\330\010\022\220!\360\010\000\t\025\220F\320\0323\2601\260D\270\006\270a\270q\330\010\014\210E\220\025\220a\220q\330\014\030\230\006\320\0364\260A\260T\270\026\270s\300$\300i\310q\320PQ\330\014\023\2207\230!\230=\250\001\250\021\330\010\017\210q";
static const char __pyx_k_A_G1F_a_vWA_q_q_q_d_7_WA_d_7_Q[] = "\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220q\330\004\007\200q\330\010\017\320\017.\250d\260!\2607\270+\300W\310A\340\010\017\320\017.\250d\260!\2607\270+\300Q";
static const char __pyx_k_A_q_JhgQjPSSVVYYZZ_1_AXWAQ_Qaq[] = "\320\004$\240A\360\024\000\t\032\230\036\240q\250\004\250J\260h\270g\300Q\300j\320PS\320SV\320VY\320YZ\320Z[\330\010\013\2101\330\014\030\230\001\230\021\330\010\021\220\023\220A\220X\230W\240A\240Q\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_A_s_4_m1_D_AWHCt_WAQ_gRq_3a_Cr[] = "\320\004$\240A\360\010\000\t\020\210s\220'\230\021\330\010\023\2204\320\027(\250\001\330\010\022\220$\220m\2401\330\010\022\220!\330\014\024\220D\230\014\240A\240W\250H\260C\260t\270:\300W\310A\310Q\340\010\026\220g\230R\230q\330\010\013\2103\210a\210}\230C\230r\240\024\240\\\260\023\260A\330\014\024\220B\220k\240\034\250Q\330\020\021\220\024\220\\\240\021\240'\250\030\260\023\260D\270\n\300!\330\020\026\220a\340\014\023\2202\220Z\230q\240\t\250\026\250q\340\014\024\220C\220r\230\021\230$\230l\250!\2507\260(\270#\270T\300\032\3101\330\014\024\220A\220W\230C\230q\240\005\240R\240w\250c\260\021\260#\260T\270\027\300\001\330\014\017\210v\220S\230\001\330\020\027\220r\230\032\2401\240I\250V\2601\340\020\027\220r\230\032\2401\240I\250V\2601";
static const char __pyx_k_DataFrameArrow___reduce_cython[] = "DataFrameArrow.__reduce_cython__";
static const char __pyx_k_DataFrame__from_data_frame_ref[] = "DataFrame._from_data_frame_ref";
static const char __pyx_k_ErrorHandler___setstate_cython[] = "ErrorHandler.__setstate_cython__";
static const char __pyx_k_K_3Gq_HIV6_vYaq_Kq_4xs_wc_Kq_T[] = "\320\004\034\230K\240|\3203G\300q\360$\000\t\r\210H\220I\230V\2406\250\021\330\014\017\210v\220Y\230a\230q\330\020\024\220K\230q\240\010\250\001\330\010\013\2104\210x\220s\230!\330\014\017\210w\220c\230\021\330\020\024\220K\230q\240\n\250!\330\014\025\220T\230\033\240A\240R\240z\260\021\330\014\017\210q\330\020\027\220q\340\014\030\230\006\230k\250\021\250$\250j\270\007\270w\300a\300z\320QW\320W^\320^_\320_`";
static const char __pyx_k_Please_make_sure_that_the_AMPL[] = "\nPlease make sure that the AMPL directory is in the system search path, or\nadd it before instantiating the AMPL object with:\n\n    from amplpy import AMPL, add_to_path\n    add_to_path(r\"full path to the AMPL installation directory\")\n    ampl = AMPL()\n\nOr, if you are using amplpy.modules, please make sure that they are installed:\n\n    # Install solver modules (e.g., HiGHS, CBC, Gurobi)\n    $ python -m amplpy.modules install highs cbc gurobi\n";
static const char __pyx_k_a_4z_s_d_AWBl_A_y_AQ_A_Jha_9Cq[] = "\320\004&\240a\360\034\000\t\014\2104\210z\230\021\230&\240\001\330\014\017\210s\220'\230\025\230d\240*\250A\250W\260B\260l\300\"\300A\330\020\027\220y\240\014\250A\250Q\330\010$\240A\330\010,\250J\260h\270a\330\010\013\2109\220C\220q\330\014\030\230\006\230m\2501\250D\260\n\270(\300!\340\014\030\230\006\230m\2501\250D\260\n\270(\300(\310'\320QR\320RS";
static const char __pyx_k_amplpy_cplex_package_not_found[] = "amplpy_cplex package not found";
static const char __pyx_k_amplpy_highs_package_not_found[] = "amplpy_highs package not found";
static const char __pyx_k_is_not_supported_please_choose[] = " is not supported, please choose from: ";
static const char __pyx_k_param_locals_Parameters___init[] = "_param.<locals>.Parameters.__init__";
static const char __pyx_k_param_locals_Parameters___iter[] = "_param.<locals>.Parameters.__iter__";
static const char __pyx_k_set_values_locals_conv_to_list[] = "_set_values.<locals>.conv_to_list";
static const char __pyx_k_var_locals_Variables___getitem[] = "_var.<locals>.Variables.__getitem__";
static const char __pyx_k_var_locals_Variables___setitem[] = "_var.<locals>.Variables.__setitem__";
static const char __pyx_k_1_1_Q_q_JhgQjPYYaallmmn_1_AXWAQ[] = "\320\004 \240\n\250+\260^\3001\360\036\000\t\034\2301\330\010\032\230!\330\010\035\230Q\340\010\031\230\036\240q\250\004\250J\260h\270g\300Q\300j\320PY\320Ya\320al\320lm\320mn\330\010\013\2101\330\014\030\230\001\230\021\330\010\021\220\023\220A\220X\230W\240A\240Q\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_1_iq_Q_iq_Q_5_1_Qa_Qa_d_1_d_1_y[] = "\320\004\033\2301\360<\000\t\023\220$\220i\230q\330\014\r\330\t\021\220\021\220+\230Q\330\010\022\220$\220i\230q\330\014\r\330\t\021\220\021\220+\230Q\330\010\013\2105\220\003\2201\330\014\026\320\026-\250Q\250a\330\014\026\320\026-\250Q\250a\340\014\026\220d\230!\2301\330\014\026\220d\230!\2301\330\010\017\210y\230\001";
static const char __pyx_k_22HHZZ_QgQ_Q_q_QgQ_wc_E_N_E_N_Z[] = "\320\0042\3202H\320HZ\320Z[\330\010\013\210:\220Q\220g\230Q\330\014\020\220\005\220Q\330\020\022\220%\220q\330*+\360\006\000\r\016\330\010\013\210:\220Q\220g\230Q\330\014\017\210w\220c\230\021\330\020\024\220E\230\021\230\"\230N\250!\340\020\024\220E\230\021\230\"\230N\250'\260\021\330\014\r\330\017\020\330\010\r\210Z\220q\330\010\014\210E\220\021\220\"\220N\240%\240q\330\010\013\2101\330\014\020\220\005\220Q\220e\320\033/\250q\330\010\013\2104\210q\330\014\022\220'\230\021\230%\230q";
static const char __pyx_k_3aq_1_a_7_Q_Q_5_1_1D_gUVVW_3axs[] = "\320\004)\250\021\360\030\000\t\034\2303\230a\230q\330\010+\2501\330\010&\240a\330\010\013\2107\220#\220Q\330\014\025\220Q\330\010\013\2105\220\003\2201\330\014\030\230\006\320\036;\2701\270D\300\010\310\006\310g\320UV\320VW\340\014\023\2203\220a\220x\230s\240$\240n\260A\330\014\035\230Q\330\020!\240\037\260\006\260a\260u\270B\270a\330\020\023\2204\220z\240\021\240)\2506\260\021\330\024\035\230T\240\021\240!\330\020\024\220E\230\025\230a\230q\330\024\"\240!\2405\250\006\250a\250v\260Q\260b\270\007\270q\300\001\330\020!\320!?\270q\300\004\300H\310F\320RY\320YZ\320Zd\320de\330\020\024\220E\230\025\230a\230q\330\024\027\220~\240Q\240c\250\023\250A\330\030\034\230A\230^\2501\250A\330\020\024\220A\220Q\330\020\023\2201\330\024 \240\001\240\021\330\037 \330\020\031\230\024\230Q\230c\240\021\240'\250\021\330\020!\240\032\2506\260\021\260%\260r\270\021\330\020\024\220E\230\025\230a\230q\330\024\"\240!\2405\250\006\250a\250q\330\020!\320!?\270q\300\004\300H\310F\320RY\320YZ\320Zd\320de\330\020\024\220A\220Q\330\020\023\2201\330\024 \240\001\240\021\340\020\026\220a";
static const char __pyx_k_9Cq_31D_j_HTZZ___z_A_1A_4q_1E_A[] = "\320\004\"\240!\360.\000\t\014\2109\220C\220q\330\014\020\220\001\330\014\030\230\006\320\0363\2601\260D\270\006\270j\310\004\310H\320TZ\320Z]\320]^\320^_\340\014\017\210z\230\021\230*\240A\330\020\033\2301\230A\340\020\033\2304\230q\240\003\2401\240E\250\021\330\014\031\230\031\240&\250\001\250\023\250A\250Z\260r\270\021\330\014\020\220\005\220U\230!\2303\230a\230q\330\020\032\230!\2305\240\006\240a\240x\250q\260\002\260'\270\021\270!\330\014\020\220\003\2201\220A\330\014\030\230\006\320\0363\2601\260D\270\006\270j\310\004\310H\320T`\320`c\320cd\320de\330\014\020\220\005\220U\230!\2303\230a\230q\330\020\024\220A\220Z\230q\240\001\330\014\020\220\001\220\021\340\010\030\230\007\230q\240\001";
static const char __pyx_k_AMPLException___setstate_cython[] = "AMPLException.__setstate_cython__";
static const char __pyx_k_A_4_1D_jPTT_a_B_B_M_M_N_N_O_1_1[] = "\200A\360\n\000\t\014\2104\210{\230!\330\014\030\230\006\320\036;\2701\270D\300\006\300j\320PT\320T\\\320\\`\360\000\000a\001B\002\360\000\000B\002M\002\360\000\000M\002N\002\360\000\000N\002O\002\330\014\023\2201\340\014\023\2201";
static const char __pyx_k_A_4z_s_d_AWBl_A_q_1_81_9Cq_0_Zx[] = "\320\004,\250A\340\010\013\2104\210z\230\021\230&\240\001\330\014\017\210s\220'\230\025\230d\240*\250A\250W\260B\260l\300\"\300A\330\020\035\230^\250<\260q\270\001\330\0101\260\032\2708\3001\330\010\013\2109\220C\220q\330\014\030\230\006\320\0360\260\001\260\024\260Z\270x\300q\340\014\030\230\006\320\0360\260\001\260\024\260Z\270x\300x\310w\320VW\320WX";
static const char __pyx_k_A_AS_a_1A_auBa_E_aq_vQe1BgQa_at[] = "\200A\360\"\000\t\021\220\004\220A\220S\230\001\230\025\230a\330\010\030\230\003\2301\230A\330\010\"\240.\260\006\260a\260u\270B\270a\340\010\014\210E\220\025\220a\220q\330\014\021\220\021\220%\220v\230Q\230e\2401\240B\240g\250Q\250a\340\010\022\220!\330\010\031\320\031>\270a\270t\300:\310W\320T[\320[\\\320\\f\320fz\360\000\000{\001B\002\360\000\000B\002C\002\330\010\014\210E\220\025\220a\220q\330\014\020\220\001\220\025\220a\220q\330\010\014\210A\210Q\330\010\013\2101\330\014\030\230\001\230\021";
static const char __pyx_k_A_QgQ_AT_zQUU_aajjoouuv_AT_zQUU[] = "\200A\360\020\000\t\014\210:\220Q\220g\230Q\330\014\030\230\006\320\036<\270A\270T\300\026\300z\320QU\320U]\320]a\320aj\320jo\320ou\320uv\340\014\030\230\006\320\036<\270A\270T\300\026\300z\320QU\320U]\320]a\320aj\320jo\320op\320pq";
static const char __pyx_k_A_a_Q_3aq_QfAT_YfAU_A_U_1_auF_6[] = "\200A\360\024\000\t'\240a\330\010%\240Q\330\010\033\2303\230a\230q\330\010\013\210:\220Q\220f\230A\230T\240\021\330\014\035\230Y\240f\250A\250U\260\"\260A\330\014\020\220\005\220U\230!\2301\330\020\036\230a\230u\240F\250!\2506\260\021\260\"\260G\2701\270A\330\014\035\320\035>\270a\270t\3008\3106\320QX\320XY\320Yc\320cs\320st\330\014\020\220\005\220U\230!\2301\330\020\023\220>\240\021\240#\240S\250\001\330\024\030\230\001\230\036\240q\250\001\330\014\020\220\001\220\021\330\014\017\210q\330\020\034\230A\230Q\340\014\035\230Z\240v\250Q\250e\2602\260Q\330\014\020\220\005\220U\230!\2301\330\020\023\220<\230q\240\006\240a\240q\330\024\"\240!\2405\250\r\260Q\260f\270A\270Q\340\024\037\230q\330\024\"\240!\2405\320(8\270\001\270\026\270q\300\001\330\024\027\220~\240Q\330\030\036\230i\240q\250\001\330\014\035\320\035>\270a\270t\3008\3106\320QX\320XY\320Yc\320cs\320st\330\014\020\220\001\220\021\330\014\017\210q\330\020\034\230A\230Q";
static const char __pyx_k_A_s_QfBa_A_s_4xs_IT_AT_A_Be2U_c[] = "\200A\360\n\000\t\020\210s\220'\230\021\330\010\013\210:\220Q\220f\230B\230a\330\014\024\220A\330\014\017\210s\220!\2204\220x\230s\240!\330\020\032\230\"\230I\240T\250\027\260\001\330\021\024\220A\220T\230\030\240\023\240A\330\020\032\230\"\230B\230e\2402\240U\250$\250c\260\027\270\t\300\021\300#\300R\300t\3107\320RS\340\020\026\220a\340\014\022\220!\330\010\017\210s\220!\2206\230\027\240\010\250\001";
static const char __pyx_k_OutputHandler___setstate_cython[] = "OutputHandler.__setstate_cython__";
static const char __pyx_k_Q_1G1_r_AZxq_XQfA_q_fARvQ_har_q[] = "\320\000%\240Q\330\004\n\210)\2201\220G\2301\330\004\n\210%\210r\220\023\220A\220Z\230x\240q\320(:\270#\270X\300Q\300f\310A\330\004\007\200q\330\010\016\210f\220A\220R\220v\230Q\340\010\016\210h\220a\220r\230\026\230q";
static const char __pyx_k_Q_iq_4wa_81_E_xt2T_Qb_T_1Cq_r_a[] = "\200\001\330\004\r\210Q\330\004\010\210\006\210i\220q\330\010\013\2104\210w\220a\330\014\022\220!\2208\2301\340\014\020\220\004\220E\230\021\230!\330\014\017\210x\220t\2302\230T\240\034\250Q\250b\260\005\260T\270\021\270!\2701\270C\270q\330\014\017\210r\220\027\230\001\330\020\026\220a\220u\230A\330\014\017\210s\220!\2207\230#\230Q\330\020\030\230\005\230Q\230a\330\014\022\220!\2202\220Q\220i\230q\330\004\013\2101";
static const char __pyx_k_Represents_the_type_of_the_outp[] = "\n    Represents the type of the output coming from the interpreter.\n    ";
static const char __pyx_k_a_5_1_XQd_AQ_Yat_T_1A_1_Qiwaq_Q[] = "\320\004\026\220a\360\"\000\t\014\2105\220\003\2201\330\014\035\230X\240Q\240d\250*\260A\260Q\340\014\035\230Y\240a\240t\250:\260T\270\027\300\001\300\032\3101\310A\330\010\013\2101\330\014\030\230\001\230\021\330\010\022\220#\220Q\220i\230w\240a\240q\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_amplpy_gurobi_package_not_found[] = "amplpy_gurobi package not found";
static const char __pyx_k_amplpy_xpress_package_not_found[] = "amplpy_xpress package not found";
static const char __pyx_k_con_locals_Constraints___getite[] = "_con.<locals>.Constraints.__getitem__";
static const char __pyx_k_con_locals_Constraints___setite[] = "_con.<locals>.Constraints.__setitem__";
static const char __pyx_k_i_in_1__ncons__con_i_iis_non__c[] = "{i in 1.._ncons: _con[i].iis != 'non'} (_conname[i], _con[i].iis)";
static const char __pyx_k_i_in_1__nvars__var_i_iis_non__v[] = "{i in 1.._nvars: _var[i].iis != 'non'} (_varname[i], _var[i].iis)";
static const char __pyx_k_i_in_1__nvars__var_i_val_0__var[] = "{i in 1.._nvars: _var[i].val != 0} (_varname[i], _var[i].val)";
static const char __pyx_k_i_in_1__nvars__varname_i__var_i[] = "{i in 1.._nvars} (_varname[i], _var[i].val)";
static const char __pyx_k_obj_locals_Objectives___getitem[] = "_obj.<locals>.Objectives.__getitem__";
static const char __pyx_k_option_locals_Options___getitem[] = "_option.<locals>.Options.__getitem__";
static const char __pyx_k_option_locals_Options___setitem[] = "_option.<locals>.Options.__setitem__.<locals>.genexpr";
static const char __pyx_k_param_locals_Parameters___getit[] = "_param.<locals>.Parameters.__getitem__";
static const char __pyx_k_param_locals_Parameters___setit[] = "_param.<locals>.Parameters.__setitem__";
static const char __pyx_k_q_7_Q_k_avQ_Cq_k_QfA_Cq_k_AV1_C[] = "\320\004'\240q\330\010\013\2107\220#\220Q\330\014\r\330\020\025\320\025*\250!\330\023\024\330\020\026\220k\240\021\240!\330\014\023\320\023&\240a\240v\250Q\330\r\024\220C\220q\330\014\r\330\020\025\320\025)\250\021\330\023\024\330\020\026\220k\240\021\240!\330\014\023\320\023%\240Q\240f\250A\330\r\024\220C\220q\330\014\r\330\020\025\320\025(\250\001\330\023\024\330\020\026\220k\240\021\240!\330\014\023\320\023$\240A\240V\2501\330\r\024\220C\220q\330\014\r\330\020\025\320\025(\250\001\330\023\024\330\020\026\220k\240\021\240!\330\014\023\320\023$\240A\240V\2501\330\r\024\220C\220q\330\014\r\330\020\025\320\025)\250\021\330\023\024\330\020\026\220k\240\021\240!\330\014\023\320\023%\240Q\240f\250A\330\r\024\220C\220q\330\014\r\330\020\025\320\025*\250!\330\023\024\330\020\026\220k\240\021\240!\330\014\023\320\023&\240a\240v\250Q\330\010\026\220a\330\010\016\210j\230\001\230\022\2304\320\037N\310a";
static const char __pyx_k_self__df_cannot_be_converted_to[] = "self._df cannot be converted to a Python object for pickling";
static const char __pyx_k_self__index_cannot_be_converted[] = "self._index cannot be converted to a Python object for pickling";
static const char __pyx_k_z_q_q_1E_uAQ_1E_uAS_Q_6_A_1A_AR[] = "\220\001\330\024\027\220z\240\021\240%\240q\330\030\037\230q\330\031#\2401\240E\250\021\330\030\037\230u\240A\240Q\330\031#\2401\240E\250\021\330\030\037\230u\240A\240S\250\001\250\034\260Q\340\030\033\2306\240\023\240A\330\034\"\240)\2501\250A\340\034\"\240*\250A\250R\320/K\3101";
static const char __pyx_k_A4_F_q_F_D_PTT___QfA_2XQ_2_4vZyP[] = "\200A\3604\000\t\025\220F\320\032/\250q\260\004\260F\270*\300D\310\010\320PT\320T]\320]^\320^_\330\010\013\210:\220Q\220f\230A\330\014\021\220\021\330\014\023\2202\220X\230Q\330\014\035\320\0352\260!\2604\260v\270Z\300y\320PQ\330\021!\240\021\240!\2401\330\014\017\210q\330\020\034\230A\230Q\330\r\027\220q\230\006\230a\330\014\021\220\031\230*\240A\240Q\330\014\023\2202\220X\230Q\330\014\035\320\0352\260!\2604\260v\270Z\300y\320PQ\330\021!\240\021\240!\2401\330\014\017\210q\330\020\034\230A\230Q\340\014\017\210u\220H\230D\240\004\240D\250\004\250J\260a\260w\270b\300\014\310B\310a\330\020\035\230^\250<\260q\270\006\270k\310\024\310[\320XY\330\020!\320!;\2701\270D\300\006\300j\320PY\320Yc\320ck\320kl\340\025%\240Q\240a\240q\330\020\023\2201\330\024 \240\001\240\021\330\020\021\330\021\024\220G\2305\240\004\240J\250a\250w\260b\270\014\300B\300a\330\020\025\220Y\230l\250!\2506\260\033\270D\300\013\3101\330\020\027\220r\230\030\240\021\330\020!\320!6\260a\260t\2706\300\032\3109\320TU\340\025%\240Q\240a\240q\330\020\023\2201\330\024 \240\001\240\021\330\020\021\330\014\022\220)\2301\230B\320\0368\270\004\270A\270Q";
static const char __pyx_k_AD_9F_3a_2Q_E_as_1_fAZq_at_3a_TU[] = "\200A\360D\001\000\t$\2409\250F\260!\2603\260a\260|\3002\300Q\330\010\014\210E\220\025\220a\220s\230!\2301\330\014\030\230\001\230\025\230f\240A\240Z\250q\260\002\260'\270\021\270!\330\010\031\230\035\240a\240t\250:\260^\3003\300a\300}\320TU\320UV\330\010\014\210E\220\025\220a\220s\230!\2301\330\014\020\220\001\220\034\230Q\230a\330\010\014\210A\210Q\330\010\013\2101\330\014\030\230\001\230\021\330\010\030\230\007\230q\240\001";
static const char __pyx_k_A_1_F_5Qd_hVWW___E_aq_t1Cs_gQd_2[] = "\200A\360\032\000\t\034\2301\330\010\024\220F\320\0325\260Q\260d\270&\300\n\310$\310h\320VW\320W]\320]^\320^_\330\010\014\210E\220\025\220a\220q\330\014\017\210t\2201\220C\220s\230!\330\020\026\220g\230Q\230d\240!\2402\240W\250A\250Q\340\020\026\220g\230Q\230a\330\021!\240\021\240!\2404\240q\250\001\330\010\014\210A\210Q\340\010\017\210q";
static const char __pyx_k_A_1_F_Qd_havUVVW_E_aq_t1Cs_gQd_2[] = "\200A\360\022\000\t\034\2301\330\010\024\220F\320\032-\250Q\250d\260&\270\n\300$\300h\310a\310v\320UV\320VW\330\010\014\210E\220\025\220a\220q\330\014\017\210t\2201\220C\220s\230!\330\020\026\220g\230Q\230d\240!\2402\240W\250A\250Q\330\025%\240Q\240a\240t\2501\250A\340\020\026\220g\230Q\230a\330\010\014\210A\210Q\330\010\017\210q";
static const char __pyx_k_A_1_z_q_s_5_1_D_AZs_q_d_3az_G1_S[] = "\200A\330(;\2701\360\022\000\t\020\210z\230\021\230%\230q\330\010\017\210s\220!\2205\230\003\2301\340\010\t\360\014\000\t\025\220D\230\001\230\023\230A\230Z\240s\250%\250q\330\010\026\220d\230!\2303\230a\230z\250\023\250G\2601\330\010\022\220+\230S\240\001\240\031\250!\2505\260\003\2601\260K\270q\300\001\330\010\017\210|\2303\230e\2403\240i\250s\260#\260Q\260a\330\010\017\210}\230C\230u\240C\240y\260\003\2603\260a\260q\330\010\032\230!\330\010\032\230!\340\010\020\220\003\2202\220Q\330\010\022\220#\220R\220q\340\010\013\210<\220s\230!\330\014\032\230!\2302\230Y\240a\240t\2505\260\005\260Q\260a\340\010\013\210=\230\003\2301\330\014\033\2301\230B\230i\240q\250\004\250E\260\025\260a\260q\340\010\020\220\002\220+\230Q\230d\240(\250$\250c\260\032\2709\300A\300S\310\002\310!\330\010\022\220!\330\r\031\230\021\230$\230h\240d\250#\250Z\260y\300\001\300\023\300B\300a\340\010\017\210s\220!\2206\230\027\240\010\250\001";
static const char __pyx_k_A_3aq_F_j8J_RYYZZ_F_AT_Na_F_AT_8[] = "\200A\360\010\000\t\024\2203\220a\220q\330\010\024\220F\230/\250\021\250$\250j\3208J\310(\320RY\320YZ\320Z[\330\010\024\220F\320\032,\250A\250T\260\032\320;N\310a\330\010\024\220F\320\032,\250A\250T\260\032\2708\3001";
static const char __pyx_k_A_3awc_4z_q_WA_E_s_7_T_q_1E_at81[] = "\200A\360\026\000\t\014\2103\210a\210w\220c\230\022\2304\230z\250\021\250%\250q\260\005\260W\270A\330\014\024\220E\230\021\230!\330\010\017\210s\220!\2207\230#\230T\240\036\250q\330\010)\250\032\2601\260E\270\021\270!\330\010\031\320\031.\250a\250t\2608\2701\330\r\034\230A\230Q\230a\330\010\013\2101\330\014\030\230\001\230\021";
static const char __pyx_k_A_6at6_4xW_I_I_J_J_K_1_1G7_1_Qaq[] = "\200A\360\016\000\t\032\320\0316\260a\260t\2706\300\032\3104\310x\320W[\320[{\360\000\000|\001I\002\360\000\000I\002J\002\360\000\000J\002K\002\330\010\013\2101\330\014\030\230\001\230\021\330\010\020\220\003\2201\220G\2307\240!\2401\330\r\035\230Q\230a\230q\340\010\013\2106\220\023\220A\330\014\023\2201\340\014\023\2201";
static const char __pyx_k_A_6at6_4xW_J_J_K_K_L_1_1G7_1_Qaq[] = "\200A\360\014\000\t\032\320\0316\260a\260t\2706\300\032\3104\310x\320W[\320[{\360\000\000|\001J\002\360\000\000J\002K\002\360\000\000K\002L\002\330\010\013\2101\330\014\030\230\001\230\021\330\010\020\220\003\2201\220G\2307\240!\2401\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq[] = "\200A\360\014\000\t\032\320\0316\260a\260t\2706\300\032\3104\310x\320W[\320[{\360\000\000|\001K\002\360\000\000K\002L\002\360\000\000L\002M\002\330\010\013\2101\330\014\030\230\001\230\021\330\010\020\220\003\2201\220G\2307\240!\2401\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_A_A_4_9Cq_AQ_s_d_awhc_Zt_PQ_G1_y[] = "\200A\360\010\000\t\r\210A\330\010\023\2204\320\027(\250\001\330\010\013\2109\220C\220q\330\014\022\220*\230A\230Q\330\010\017\210s\220!\330\r\016\210d\220,\230a\230w\240h\250c\260\024\260Z\270t\300=\320PQ\340\010\014\210G\2201\330\014\017\210y\230\003\2301\330\020\026\220c\230\021\230!\340\020\026\220e\2301\230C\230r\240\021\330\014\017\210s\220!\2205\230\002\230)\2403\240a\330\020\021\220\021\220'\230\021\330\021\024\220A\220U\230\"\230I\240S\250\001\330\020\021\220\021\220'\230\023\230A\230Q\340\020\021\220\021\220'\230\025\230a\230s\240!\2401\330\010\017\210q";
static const char __pyx_k_A_A_4t_Q_t_Qha_iq_a_AV_aq_q_A_fJ[] = "\200A\360:\000\t\035\230A\330\010\013\2104\210t\220:\230Q\330\014\017\210t\220:\230Q\230h\240a\330\020\026\220i\230q\240\001\330\014\020\220\007\220{\240&\250\006\250a\330\020\024\220A\220V\230;\240a\240q\330\r\027\220q\230\010\240\001\330\014\021\220\021\330\014\030\230\006\320\036A\300\021\300$\300f\310J\320VZ\320Zb\320bf\320fo\320oq\320qy\320yz\330\r\027\220q\230\010\240\001\330\014\024\220D\230\006\230a\330\014\017\210v\220S\230\002\320\032,\250A\330\020\023\2204\220z\240\021\240)\2506\260\021\330\024\035\230T\240\021\240!\330\020\034\230I\240Q\240d\250&\260\n\270$\270h\300d\310)\320S[\320[^\320^_\320_`\330\020\023\2201\330\024 \240\001\240\021\330\021\027\220s\230\"\320\034.\250a\330\020\031\230\024\230Q\230c\240\021\240'\250\021\330\020\034\230I\240Q\240d\250&\260\n\270$\270h\300d\310)\320S[\320[^\320^_\320_`\330\020\023\2201\330\024 \240\001\240\021\360\006\000\021\022\360\020\000\021\022\360\032\000\021\032\230\021\230(\240!\2405\250\004\250G\2601\330\020\023\2206\230\023\230A\330\024%\240Q\330\030\036\230j\250\001\330\034\036\320\036J\310!\360\006\000\025\026\33034\360\006\000\031\037\230j\250\001\250\022\320+H\310\001\330\020\034\230I\240Q\240d\250&\260\n\270$\270h\300d\310)\320S[\320[^\320^_\320_`\330\020\023\2201\330\024 \240\001\240\021\340\014\022\220+\230Q\230f\240A";
static const char __pyx_k_A_Qha_t1_q_F_D_q_AQ_q_QfA_uD_9Bl[] = "\200A\360\"\000\t\014\210:\220Q\220h\230a\330\014\017\210t\2201\330\020\021\330\014\030\230\017\240q\250\004\250F\260*\270D\300\010\310\001\330\014\017\210q\330\020\034\230A\230Q\330\r\027\220q\230\010\240\001\330\014\022\220+\230Q\230f\240A\330\r\020\220\007\220u\230D\240\n\250!\2509\260B\260l\300\"\300A\330\014\022\220+\230Q\230f\240A\330\r\020\220\007\220u\230D\240\n\250!\2508\2602\260Q\330\014\017\210s\220!\2206\230\030\240\023\240A\330\020\024\220K\230q\240\006\240g\250Q\340\020\024\220K\230q\240\005\240Q\240i\250v\260R\260v\270W\300A\330\r\027\220q\230\010\240\001\330\014\035\230Q\330\020\023\2204\220z\240\021\240)\2506\260\021\330\024\035\230T\240\021\240!\330\020\034\320\034-\250Q\250d\260&\270\n\300$\300h\310a\330\020\023\2201\330\024 \240\001\240\021\330\037 \330\020\031\230\024\230Q\230c\240\021\240'\250\021\330\020\034\320\034-\250Q\250d\260&\270\n\300$\300h\310a\330\020\023\2201\330\024 \240\001\240\021\340\020\026\220k\240\021\240&\250\001\340\014\022\220+\230Q\230f\240A";
static const char __pyx_k_A_Zt7_QhVWWX_1_waq_Qaq_1_s_1_5_1[] = "\200A\360$\000\t\032\230\037\250\001\250\024\250Z\260t\2707\300!\300:\310Q\310h\320VW\320WX\330\010\013\2101\330\014\030\230\001\230\021\340\010\020\220\007\220w\230a\230q\330\r\035\230Q\230a\230q\330\010\013\2101\330\014\r\330\020\027\220s\230!\2301\330\023\024\330\020\021\330\024\033\2305\240\001\240\021\330\027\030\330\024\033\2301";
static const char __pyx_k_A_q_1_j_G1JVW_q_q_0_Zt7_UV_q_q_0[] = "\200A\360\034\000\t\014\210<\220q\230\001\330\014\030\230\006\320\0361\260\021\260$\260j\300\004\300G\3101\310J\320VW\330\r\027\220q\230\007\230q\330\014\030\230\006\320\0360\260\001\260\024\260Z\270t\3007\310!\310:\320UV\330\r\027\220q\230\007\230q\330\014\030\230\006\320\0360\260\001\260\024\260Z\270t\3007\310!\310:\320UV\330\r\027\220q\230\007\230q\330\014\030\230\006\230o\250Q\250d\260*\270D\300\007\300q\310\n\320RW\320W^\320^_\320_`\340\014\022\220!";
static const char __pyx_k_A_s_6_S_3avS_D_z_4vZtS_aab_1G1_9[] = "\200A\360\036\000\t\020\210s\220!\2206\230\024\230S\240\001\360\006\000\t\014\2103\210a\210v\220S\230\001\330\014\024\220D\230\001\230\021\340\014\017\210z\230\021\230'\240\021\330\020!\320!:\270!\2704\270v\300Z\310t\320S[\320[`\320`a\320ab\330\021\033\2301\230G\2401\330\020!\320!9\270\021\270$\270f\300J\310d\320RZ\320Z_\320_f\320fg\320gh\340\020\026\220a\340\014\023\2208\2301\330\014\017\210t\220:\230Q\230h\240g\250Q\330\020\030\230\001\230\021\330\014\026\220j\240\001\240\021\330\014\017\210z\230\021\230'\240\021\330\020!\320!G\300q\310\004\310F\320R\\\320\\`\320`h\320hq\320qv\320vw\320wx\330\025$\240A\240Q\240a\330\021\033\2301\230G\2401\330\020!\320!F\300a\300t\3106\320Q[\320[_\320_g\320gp\320pu\320u|\320|}\320}~\330\025$\240A\240Q\240a\340\025$\240A\240Q\240a\330\020\026\220a\330\010\013\2101\330\014\030\230\001\230\021";
static const char __pyx_k_A_s_Qd_A_Qa_Qd_A_3at3a_3avRvXXRx[] = "\200A\330):\270!\360\020\000\t\020\210s\220'\230\021\330\010\013\210:\220Q\220d\230\"\230A\330\014\021\220\022\220:\230Q\230a\340\014\023\220:\230Q\230d\240\"\240A\330\010\013\2103\210a\210t\2203\220a\330\014\023\2203\220a\220v\230R\230v\240X\250X\260R\260x\270w\300a\330\010\013\210:\220Q\220b\230\006\230a\230t\2401\330\014\016\210i\220r\230\033\240L\260\001\260\022\2606\270\027\300\001\330\010\013\210;\220c\230\022\2306\240\031\250\"\250A\330\014\021\220\022\2206\230\021\330\014\017\210z\230\021\230$\230b\240\001\330\020\025\220R\220z\240\021\240!\330\010\013\210:\220Q\220b\230\006\230a\230t\2401\330\014\023\2202\220V\2307\240!\340\014\023\2202\220V\2304\230w\240b\250\001\330\010\020\220\002\220\"\220I\230R\230x\240t\2503\250j\270\t\300\021\300#\300R\300q\330\010\013\210<\220w\230a\330\014\023\2203\220a\220w\230c\240\023\240A\240Q\330\014\020\220\005\220U\230!\2303\230a\230q\330\020\025\220Q\220f\230K\240q\250\004\250E\260\021\260\"\260A\260Q\330\010\022\220\"\220C\220q\230\010\240\002\240!\2406\250\027\260\004\260D\270\t\300\022\3008\3107\320RS\330\010\017\210s\220!\2206\230\027\240\010\250\001";
static const char __pyx_k_A_s_d_AT_1_2Ya_6_B_A_V9B_33MMaab[] = "\200A\360\n\000\t\020\210s\220'\230\025\230d\240*\250A\250T\260\022\2601\330\010\021\220\022\220?\240!\2402\240Y\250a\340\010\033\2306\240\033\250B\320.A\300\021\330\010\013\320\013\035\230V\2409\250B\320.@\300\001\340\0103\3203M\320Ma\320ab\320bt\320tu\330\0101\3201J\320J^\320^_\320_p\320pq\340\010\"\240.\260\001\340\010\013\320\013\033\2301\230L\250\013\2601\330\010\017\210q";
static const char __pyx_k_A_t_1A_at6_4xqP_1_E_aq_ay_c_E_aq[] = "\200A\360\016\000\t\020\210t\220?\240'\250\021\360\006\000\t*\250\032\2601\260A\360\006\000\t\032\320\031.\250a\250t\2606\270\032\3004\300x\310q\320P[\320[\\\320\\]\330\010\013\2101\330\014\030\230\001\230\021\330\010\014\210E\220\025\220a\220q\330\014\024\320\024&\240a\240y\260\t\270\021\270$\270c\300\021\330\020\024\220E\230\025\230a\230q\330\031(\250\001\250\021\250)\2601\260A\330\020\024\220A\220Q\330\020\027\220}\240A\240T\320)9\270\024\270X\300T\310\030\320QZ\320Z[\330\010\014\210E\220\025\220a\220q\330\021 \240\001\240\021\240)\2501\250A\330\010\014\210A\210Q\330\r\034\230A\230Q\230a\330\010\017\210q";
static const char __pyx_k_A_t_3awc_4z_q_WA_E_D_3awc_5T_XVS[] = "\200A\360\020\000\t\020\210t\220?\240'\250\021\360\006\000\t\014\2103\210a\210w\220c\230\022\2304\230z\250\021\250%\250q\260\005\260W\270A\330\014\024\220E\230\021\230!\330\014\024\220D\230\001\230\021\330\010\013\2103\210a\210w\220c\230\021\330\014\023\220=\240\001\240\024\320%5\260T\270\030\300\024\300X\310V\320ST\340\014\027\220z\240\021\240!\330\014\017\210t\220?\240(\250!\330\020!\320!6\260a\260t\2706\300\032\3104\310x\320W`\320`a\320ab\330\025$\240A\240Q\240a\330\020\023\2201\330\024 \240\001\240\021\330\020\031\230\035\240a\240t\320+;\2704\270x\300x\310v\320UZ\320Z`\320`a\330\020\027\220q\340\020\027\220}\240A\240T\320)9\270\024\270X\300T\310\030\320QZ\320Z[";
static const char __pyx_k_A_uHD_D_JauBl_A_Qd_A_Qa_3at3a_AQ[] = "\200A\330):\270!\360\022\000\t\020\210u\220H\230D\240\004\240D\250\004\250J\260a\260u\270B\270l\310\"\310A\340\010\013\210:\220Q\220d\230\"\230A\330\014\021\220\022\220:\230Q\230a\340\010\013\2103\210a\210t\2203\220a\330\014\022\220*\230A\230Q\340\010\013\210:\220Q\220b\230\006\230a\230t\2401\330\014\016\210i\220r\230\033\240L\260\001\260\022\2606\270\027\300\001\330\r\017\210v\220Y\230c\240\022\2404\240t\250:\260Q\260b\270\010\300\002\300!\330\014\016\210i\220r\230\033\240L\260\001\260\022\2606\270\024\270W\300B\300a\340\010\013\210;\220g\230U\240$\240k\260\023\260B\260f\270I\300R\300q\330\014\021\220\022\2206\230\021\330\014\017\210z\230\021\230$\230b\240\001\330\020\025\220R\220z\240\021\240!\340\010\013\210<\220w\230a\330\014\023\2203\220a\220}\240C\240r\250\026\250q\330\014\016\210f\220I\230Q\340\010\023\2202\220\\\240\021\340\010\020\220\002\220&\230\014\240A\240Z\250\270a\340\010\027\220r\230\037\250\001\250\021\330\010\032\320\032,\250L\270\t\300\022\320CU\320UV\340\0103\3203G\320G[\320[\\\320\\n\320no\330\0101\3201D\320DX\320XY\320Yj\320jk\360\020\000\t#\240.\260\001\330\010\013\320\013\036\230a\330\010\013\320\013\035\230Q\340\010 \240\002\240&\250\014\260K\270s\300*\310A\330\010\013\320\013\033\2301\320\034.\320.?\270q\330\010\017\210q";
static const char __pyx_k_All_values_must_be_either_number[] = "All values must be either numbers or strings";
static const char __pyx_k_Cannot_create_DataFrameArrow_fro[] = "Cannot create DataFrameArrow from empty DataFrame";
static const char __pyx_k_DataFrameArrow___setstate_cython[] = "DataFrameArrow.__setstate_cython__";
static const char __pyx_k_Dictionary_must_contain_either_a[] = "Dictionary must contain either all strings or all numbers";
static const char __pyx_k_Excepted_dictionary_of_set_membe[] = "Excepted dictionary of set members for each index.";
static const char __pyx_k_Failed_to_cast_value_to_int_floa[] = "Failed to cast value to int/float/double";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())";
static const char __pyx_k_InstanceIterator___reduce_cython[] = "InstanceIterator.__reduce_cython__";
static const char __pyx_k_InstanceIterator___setstate_cyth[] = "InstanceIterator.__setstate_cython__";
static const char __pyx_k_MemberRangeIterator___reduce_cyt[] = "MemberRangeIterator.__reduce_cython__";
static const char __pyx_k_MemberRangeIterator___setstate_c[] = "MemberRangeIterator.__setstate_cython__";
static const char __pyx_k_Trying_to_assign_tuples_to_set_o[] = "Trying to assign tuples to set of arity ";
static const char __pyx_k_cannot_convert_to_dictionary_wit[] = "cannot convert to dictionary without an index";
static const char __pyx_k_copt_cplex_gurobi_highs_scip_xpr[] = "copt, cplex, gurobi, highs, scip, xpress";
static const char __pyx_k_import_ampls_solution_locals_gen[] = "import_ampls_solution.<locals>.genexpr";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_self__c_ampl_cannot_be_converted[] = "self._c_ampl cannot be converted to a Python object for pickling";
static const char __pyx_k_self__c_ampl_self__index_self_be[] = "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling";
static const char __pyx_k_self_begin_cannot_be_converted_t[] = "self.begin cannot be converted to a Python object for pickling";
static const char __pyx_k_self_begin_self_end_self_env_c_s[] = "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling";
static const char __pyx_k_set_error_handler_locals_ErrorHa[] = "set_error_handler.<locals>.ErrorHandlerWrapper";
static const char __pyx_k_option_locals_Options___setitem_2[] = "_option.<locals>.Options.__setitem__";
static const char __pyx_k_A_6at6_4xW_J_J_K_K_L_1_1G7_1_Qaq_2[] = "\200A\360\016\000\t\032\320\0316\260a\260t\2706\300\032\3104\310x\320W[\320[{\360\000\000|\001J\002\360\000\000J\002K\002\360\000\000K\002L\002\330\010\013\2101\330\014\030\230\001\230\021\330\010\020\220\003\2201\220G\2307\240!\2401\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq_2[] = "\200A\360\016\000\t\032\320\0316\260a\260t\2706\300\032\3104\310x\320W[\320[{\360\000\000|\001K\002\360\000\000K\002L\002\360\000\000L\002M\002\330\010\013\2101\330\014\030\230\001\230\021\330\010\020\220\003\2201\220G\2307\240!\2401\330\r\035\230Q\230a\230q\340\010\017\210q";
static const char __pyx_k_set_error_handler_locals_ErrorHa_2[] = "set_error_handler.<locals>.ErrorHandlerWrapper.__init__";
static const char __pyx_k_set_error_handler_locals_ErrorHa_3[] = "set_error_handler.<locals>.ErrorHandlerWrapper.error";
static const char __pyx_k_set_error_handler_locals_ErrorHa_4[] = "set_error_handler.<locals>.ErrorHandlerWrapper.warning";
static const char __pyx_k_set_error_handler_locals_ErrorHa_5[] = "set_error_handler.<locals>.ErrorHandlerWrapper.check";
/* #### Code section: decls ### */
static int __pyx_pf_6amplpy_4ampl_10Constraint___setitem__(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_2is_logical(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_4drop(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_6restore(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_8body(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_10astatus(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_12defvar(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_14dinit(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_16dinit0(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_18dual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_20lb(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_22ub(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_24lbs(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_26ubs(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_28ldual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_30udual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_32lslack(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_34uslack(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_36slack(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_38sstatus(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_40status(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_42set_dual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self, PyObject *__pyx_v_dual); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_44val(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_46__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_48__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Row___str__(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Row_2__iter__(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Row_4__getitem__(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Row_6to_string(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Row_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Row_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Column___str__(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Column_2__iter__(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Column_4to_string(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Column_6to_list(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Column_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Column_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6amplpy_4ampl_9DataFrame___cinit__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_columns, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_6amplpy_4ampl_9DataFrame_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_4to_string(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_6__str__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_8__iter___genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_8__iter__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_10_get_num_cols(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_12_get_num_rows(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_14_get_num_indices(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_16_add_row(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_11_add_column_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_11_add_column_3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_18_add_column(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_header, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_20_get_column(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_header); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_22_set_column(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_header, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_24_get_row(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_26_get_row_by_index(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_12_get_headers_genexpr(PyObject *__pyx_self, size_t __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_28_get_headers(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_11_set_values_conv_to_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_30_set_values(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_32to_dict(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_34to_list(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_skip_index); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_36to_pandas(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_multi_index); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_to_tuple(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_2genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_5genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_38from_dict(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_dic, PyObject *__pyx_v_index_names, PyObject *__pyx_v_column_names); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_40from_pandas(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df, PyObject *__pyx_v_index_names, PyObject *__pyx_v_indexarity); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_42from_numpy(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_44_from_data_frame_ref(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df_ref); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_46__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_48__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6amplpy_4ampl_14DataFrameArrow___cinit__(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self); /* proto */
static void __pyx_pf_6amplpy_4ampl_14DataFrameArrow_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_4from_polars(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_6from_pandas(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df, PyObject *__pyx_v_index_names, PyObject *__pyx_v_indexarity); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_pf_6amplpy_4ampl_6Entity___dealloc__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_2to_string(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_4__str__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_6__iter__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_8__getitem__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_10get(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_12find(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_14instances(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_16name(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_18indexarity(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_20is_scalar(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_22num_instances(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_24get_indexing_sets(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_26xref(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_28get_values(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_suffixes); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_30to_pandas(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_32to_dict(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_34to_list(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_36set_values(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_38__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_40__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6amplpy_4ampl_11Environment___cinit__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_binary_directory, PyObject *__pyx_v_binary_name); /* proto */
static void __pyx_pf_6amplpy_4ampl_11Environment_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_4__str__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_6__iter__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto */
static int __pyx_pf_6amplpy_4ampl_11Environment_8__setitem__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_10__getitem__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_12to_string(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_14set_bin_dir(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_binary_directory); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_16get_bin_dir(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_18set_bin_name(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_binary_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_20get_bin_name(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_display_error_message(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_exception, PyObject *__pyx_v_error); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_error(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self, PyObject *__pyx_v_exception); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_2warning(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self, PyObject *__pyx_v_exception); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_4__reduce_cython__(struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_6__setstate_cython__(struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6amplpy_4ampl_13AMPLException___init__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self, PyObject *__pyx_v_source_name, PyObject *__pyx_v_line_number, PyObject *__pyx_v_offset, PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_2get_source_name(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_4get_line_number(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_6get_offset(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_8get_message(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_10__str__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_12__reduce_cython__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_14__setstate_cython__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator___iter__(struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator_2__next__(struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_pf_6amplpy_4ampl_9EntityMap___dealloc__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_2__iter__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_4__next__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_6__getitem__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_8size(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_6amplpy_4ampl_9EntityMap_10__len__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_pf_6amplpy_4ampl_16InstanceIterator___dealloc__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_2__iter__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_4__next__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_6__getitem__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_8size(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_6amplpy_4ampl_16InstanceIterator_10__len__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_pf_6amplpy_4ampl_19MemberRangeIterator___dealloc__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_2size(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_4__len__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_6__iter__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_8__next__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator___iter__(struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator_2__next__(struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator___iter__(struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator_2__next__(struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_value(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_2astatus(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_4sstatus(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_6exitcode(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_8message(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_10result(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_12drop(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_14restore(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_16minimization(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13OutputHandler_output(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kind, PyObject *__pyx_v_msg); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13OutputHandler_2__reduce_cython__(struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_13OutputHandler_4__setstate_cython__(struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6amplpy_4ampl_9Parameter___setitem__(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_2is_symbolic(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_4has_default(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_6__getitem__(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_8value(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_10set(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_10set_values_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_10set_values_3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_12set_values(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6amplpy_4ampl_3Set___setitem__(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_2__iter__(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_4instances(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_6arity(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_8get_values(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10members(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_12size(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_14contains(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_cast_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_2cast_row(PyObject *__pyx_self, PyObject *__pyx_v_row); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_4genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_7genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_10genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_13genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_16set_values(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_3Set_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6amplpy_4ampl_8Variable___setitem__(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_2value(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_4fix(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_6unfix(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_8set_value(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_10astatus(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_12defeqn(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_14dual(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_16init(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_18init0(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_20lb(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_22ub(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_24lb0(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_26ub0(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_28lb1(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_30ub1(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_32lb2(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_34ub2(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_36lrc(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_38urc(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_40lslack(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_42uslack(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_44rc(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_46slack(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_48sstatus(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_50status(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_52__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_54__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_2nested_dict_of_suffixes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lst); /* proto */
static int __pyx_pf_6amplpy_4ampl_4AMPL___init__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_environment); /* proto */
static void __pyx_pf_6amplpy_4ampl_4AMPL_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4get_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_statements); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6get_entity(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_8get_variable(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_10get_constraint(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_12get_objective(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_14get_set(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_16get_parameter(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_18eval(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_statements); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_20get_output(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_statements); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_22reset(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_24close(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_26is_running(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_28solve(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_problem, PyObject *__pyx_v_solver, PyObject *__pyx_v_verbose, PyObject *__pyx_v_return_output, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_30cd(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_32set_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_34get_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_36read(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_38read_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_40get_value(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_scalar_expression); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_42set_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_set_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_44set_data_arrow(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_set_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_46read_table(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_table_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_48write_table(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_table_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_50display(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_ampl_expressions); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_52set_output_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_output_handler); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl_instance, PyObject *__pyx_v_error_handler); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_2error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_exception); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_4warning(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_exception); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_6check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_54set_error_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_error_handler); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_56get_output_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_58get_error_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_60get_variables(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_62get_constraints(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_64get_objectives(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_66get_sets(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_68get_parameters(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_70get_current_objective(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_72_var(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_74_con(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives_4__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_76_obj(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_78_set(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_80_param(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_82_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_11_set_option_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_84_set_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_options_dict); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_86export_model(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_88export_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_90snapshot(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_model, PyObject *__pyx_v_data, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_92write(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_auxfiles); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_12solve_result___get__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_16solve_result_num___get__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_94get_iis(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_flat); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_96get_solution(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_flat, PyObject *__pyx_v_zeros); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_98_start_recording(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_100_stop_recording(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_102_load_session(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_104to_ampls(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_driver, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_21import_ampls_solution_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_106import_ampls_solution(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_number, PyObject *__pyx_v_import_entities, PyObject *__pyx_v_keep_files); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_108to_string(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_110__str__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_112__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_114__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_4__pyx_unpickle_ErrorHandler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_6__pyx_unpickle_AMPLException(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6amplpy_4ampl_8__pyx_unpickle_OutputHandler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_6amplpy_4ampl_Row(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Column(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_DataFrame(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_DataFrameArrow(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Entity(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Constraint(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Environment(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_ErrorHandler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_EnvIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_EntityMap(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_InstanceIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_MemberRangeIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_ColIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_RowIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Objective(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_OutputHandler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Parameter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Set(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_Variable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl_AMPL(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_4__get_headers(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_6_from_dict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_8_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_9_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_10_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_11_set_values(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_12_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_13_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_14_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_15_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_16_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_17_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_18_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  #ifdef __Pyx_CyFunction_USED
  PyTypeObject *__pyx_CyFunctionType;
  #endif
  #ifdef __Pyx_FusedFunction_USED
  PyTypeObject *__pyx_FusedFunctionType;
  #endif
  #ifdef __Pyx_Generator_USED
  PyTypeObject *__pyx_GeneratorType;
  #endif
  #ifdef __Pyx_IterableCoroutine_USED
  PyTypeObject *__pyx_IterableCoroutineType;
  #endif
  #ifdef __Pyx_Coroutine_USED
  PyTypeObject *__pyx_CoroutineAwaitType;
  #endif
  #ifdef __Pyx_Coroutine_USED
  PyTypeObject *__pyx_CoroutineType;
  #endif
  PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
  PyObject *__pyx_type_6amplpy_4ampl_Row;
  PyObject *__pyx_type_6amplpy_4ampl_Column;
  PyObject *__pyx_type_6amplpy_4ampl_DataFrame;
  PyObject *__pyx_type_6amplpy_4ampl_DataFrameArrow;
  PyObject *__pyx_type_6amplpy_4ampl_Entity;
  PyObject *__pyx_type_6amplpy_4ampl_Constraint;
  PyObject *__pyx_type_6amplpy_4ampl_Environment;
  PyObject *__pyx_type_6amplpy_4ampl_ErrorHandler;
  PyObject *__pyx_type_6amplpy_4ampl_AMPLException;
  PyObject *__pyx_type_6amplpy_4ampl_EnvIterator;
  PyObject *__pyx_type_6amplpy_4ampl_EntityMap;
  PyObject *__pyx_type_6amplpy_4ampl_InstanceIterator;
  PyObject *__pyx_type_6amplpy_4ampl_MemberRangeIterator;
  PyObject *__pyx_type_6amplpy_4ampl_ColIterator;
  PyObject *__pyx_type_6amplpy_4ampl_RowIterator;
  PyObject *__pyx_type_6amplpy_4ampl_Objective;
  PyObject *__pyx_type_6amplpy_4ampl_OutputHandler;
  PyObject *__pyx_type_6amplpy_4ampl_Parameter;
  PyObject *__pyx_type_6amplpy_4ampl_Set;
  PyObject *__pyx_type_6amplpy_4ampl_Variable;
  PyObject *__pyx_type_6amplpy_4ampl_AMPL;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct____iter__;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr;
  PyObject *__pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Row;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Column;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_DataFrame;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_DataFrameArrow;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Entity;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Constraint;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Environment;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_ErrorHandler;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_AMPLException;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_EnvIterator;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_EntityMap;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_InstanceIterator;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_MemberRangeIterator;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_ColIterator;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_RowIterator;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Objective;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_OutputHandler;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Parameter;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Set;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_Variable;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl_AMPL;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr;
  PyTypeObject *__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  PyObject *__pyx_k_;
  PyObject *__pyx_tuple[30];
  PyObject *__pyx_codeobj_tab[267];
  PyObject *__pyx_string_tab[984];
  PyObject *__pyx_float_1_0;
  PyObject *__pyx_int_0;
  PyObject *__pyx_int_1;
  PyObject *__pyx_int_222419149;
  PyObject *__pyx_int_228825662;
  PyObject *__pyx_int_238750788;
  PyObject *__pyx_int_neg_1;
/* #### Code section: module_state_contents ### */
/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif


#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct____iter__[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct____iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_1_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_1_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_2_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_2_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_3_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_3_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_4__get_headers[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_4__get_headers;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_5_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_5_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_6_from_dict[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_6_from_dict;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_7_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_7_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_8_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_8_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_9_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_9_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_10_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_10_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_11_set_values[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_11_set_values;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_12_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_12_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_13_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_13_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_14_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_14_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_15_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_15_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_16_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_16_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_17_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_17_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_18_genexpr[8];
int __pyx_freecount_6amplpy_4ampl___pyx_scope_struct_18_genexpr;
#endif
/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* IterNextPlain.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
#endif

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_75 __pyx_string_tab[0]
#define __pyx_n_u_AMPL __pyx_string_tab[1]
#define __pyx_n_u_AMPLException __pyx_string_tab[2]
#define __pyx_n_u_AMPLException___reduce_cython __pyx_string_tab[3]
#define __pyx_n_u_AMPLException___setstate_cython __pyx_string_tab[4]
#define __pyx_n_u_AMPLException_get_line_number __pyx_string_tab[5]
#define __pyx_n_u_AMPLException_get_message __pyx_string_tab[6]
#define __pyx_n_u_AMPLException_get_offset __pyx_string_tab[7]
#define __pyx_n_u_AMPLException_get_source_name __pyx_string_tab[8]
#define __pyx_n_u_AMPL_NOT_FOUND_MESSAGE __pyx_string_tab[9]
#define __pyx_n_u_AMPL___reduce_cython __pyx_string_tab[10]
#define __pyx_n_u_AMPL___setstate_cython __pyx_string_tab[11]
#define __pyx_n_u_AMPL__con __pyx_string_tab[12]
#define __pyx_n_u_AMPL__load_session __pyx_string_tab[13]
#define __pyx_n_u_AMPL__obj __pyx_string_tab[14]
#define __pyx_n_u_AMPL__option __pyx_string_tab[15]
#define __pyx_n_u_AMPL__param __pyx_string_tab[16]
#define __pyx_n_u_AMPL__set __pyx_string_tab[17]
#define __pyx_n_u_AMPL__set_option __pyx_string_tab[18]
#define __pyx_n_u_AMPL__start_recording __pyx_string_tab[19]
#define __pyx_n_u_AMPL__stop_recording __pyx_string_tab[20]
#define __pyx_n_u_AMPL__var __pyx_string_tab[21]
#define __pyx_n_u_AMPL_cd __pyx_string_tab[22]
#define __pyx_n_u_AMPL_close __pyx_string_tab[23]
#define __pyx_kp_u_AMPL_could_not_be_started __pyx_string_tab[24]
#define __pyx_n_u_AMPL_display __pyx_string_tab[25]
#define __pyx_n_u_AMPL_eval __pyx_string_tab[26]
#define __pyx_n_u_AMPL_export_data __pyx_string_tab[27]
#define __pyx_n_u_AMPL_export_model __pyx_string_tab[28]
#define __pyx_n_u_AMPL_get_constraint __pyx_string_tab[29]
#define __pyx_n_u_AMPL_get_constraints __pyx_string_tab[30]
#define __pyx_n_u_AMPL_get_current_objective __pyx_string_tab[31]
#define __pyx_n_u_AMPL_get_data __pyx_string_tab[32]
#define __pyx_n_u_AMPL_get_entity __pyx_string_tab[33]
#define __pyx_n_u_AMPL_get_error_handler __pyx_string_tab[34]
#define __pyx_n_u_AMPL_get_iis __pyx_string_tab[35]
#define __pyx_n_u_AMPL_get_objective __pyx_string_tab[36]
#define __pyx_n_u_AMPL_get_objectives __pyx_string_tab[37]
#define __pyx_n_u_AMPL_get_option __pyx_string_tab[38]
#define __pyx_n_u_AMPL_get_output __pyx_string_tab[39]
#define __pyx_n_u_AMPL_get_output_handler __pyx_string_tab[40]
#define __pyx_n_u_AMPL_get_parameter __pyx_string_tab[41]
#define __pyx_n_u_AMPL_get_parameters __pyx_string_tab[42]
#define __pyx_n_u_AMPL_get_set __pyx_string_tab[43]
#define __pyx_n_u_AMPL_get_sets __pyx_string_tab[44]
#define __pyx_n_u_AMPL_get_solution __pyx_string_tab[45]
#define __pyx_n_u_AMPL_get_value __pyx_string_tab[46]
#define __pyx_n_u_AMPL_get_variable __pyx_string_tab[47]
#define __pyx_n_u_AMPL_get_variables __pyx_string_tab[48]
#define __pyx_n_u_AMPL_import_ampls_solution __pyx_string_tab[49]
#define __pyx_n_u_AMPL_is_running __pyx_string_tab[50]
#define __pyx_n_u_AMPL_read __pyx_string_tab[51]
#define __pyx_n_u_AMPL_read_data __pyx_string_tab[52]
#define __pyx_n_u_AMPL_read_table __pyx_string_tab[53]
#define __pyx_n_u_AMPL_reset __pyx_string_tab[54]
#define __pyx_n_u_AMPL_set_data __pyx_string_tab[55]
#define __pyx_n_u_AMPL_set_data_arrow __pyx_string_tab[56]
#define __pyx_n_u_AMPL_set_error_handler __pyx_string_tab[57]
#define __pyx_n_u_AMPL_set_option __pyx_string_tab[58]
#define __pyx_n_u_AMPL_set_output_handler __pyx_string_tab[59]
#define __pyx_n_u_AMPL_snapshot __pyx_string_tab[60]
#define __pyx_n_u_AMPL_solve __pyx_string_tab[61]
#define __pyx_n_u_AMPL_to_ampls __pyx_string_tab[62]
#define __pyx_n_u_AMPL_to_string __pyx_string_tab[63]
#define __pyx_n_u_AMPL_write __pyx_string_tab[64]
#define __pyx_n_u_AMPL_write_table __pyx_string_tab[65]
#define __pyx_kp_u_A_constraint_called __pyx_string_tab[66]
#define __pyx_kp_u_A_parameter_called __pyx_string_tab[67]
#define __pyx_kp_u_A_set_called __pyx_string_tab[68]
#define __pyx_kp_u_A_variable_called __pyx_string_tab[69]
#define __pyx_kp_u_All_values_must_be_either_number __pyx_string_tab[70]
#define __pyx_kp_u_An_objective_called __pyx_string_tab[71]
#define __pyx_n_u_AssertionError __pyx_string_tab[72]
#define __pyx_n_u_AttributeError __pyx_string_tab[73]
#define __pyx_n_u_BREAK __pyx_string_tab[74]
#define __pyx_n_u_BREAKPOINT __pyx_string_tab[75]
#define __pyx_n_u_CALL __pyx_string_tab[76]
#define __pyx_n_u_CD __pyx_string_tab[77]
#define __pyx_n_u_CHECK __pyx_string_tab[78]
#define __pyx_n_u_CLOSE __pyx_string_tab[79]
#define __pyx_n_u_COMMANDS __pyx_string_tab[80]
#define __pyx_n_u_CONTINUE __pyx_string_tab[81]
#define __pyx_kp_u_Cannot_create_DataFrameArrow_fro __pyx_string_tab[82]
#define __pyx_n_u_ColIterator __pyx_string_tab[83]
#define __pyx_n_u_ColIterator___reduce_cython __pyx_string_tab[84]
#define __pyx_n_u_ColIterator___setstate_cython __pyx_string_tab[85]
#define __pyx_n_u_Column __pyx_string_tab[86]
#define __pyx_n_u_Column___reduce_cython __pyx_string_tab[87]
#define __pyx_n_u_Column___setstate_cython __pyx_string_tab[88]
#define __pyx_n_u_Column_to_list __pyx_string_tab[89]
#define __pyx_n_u_Column_to_string __pyx_string_tab[90]
#define __pyx_n_u_Constraint __pyx_string_tab[91]
#define __pyx_n_u_Constraint___reduce_cython __pyx_string_tab[92]
#define __pyx_n_u_Constraint___setstate_cython __pyx_string_tab[93]
#define __pyx_n_u_Constraint_astatus __pyx_string_tab[94]
#define __pyx_n_u_Constraint_body __pyx_string_tab[95]
#define __pyx_n_u_Constraint_defvar __pyx_string_tab[96]
#define __pyx_n_u_Constraint_dinit __pyx_string_tab[97]
#define __pyx_n_u_Constraint_dinit0 __pyx_string_tab[98]
#define __pyx_n_u_Constraint_drop __pyx_string_tab[99]
#define __pyx_n_u_Constraint_dual __pyx_string_tab[100]
#define __pyx_n_u_Constraint_is_logical __pyx_string_tab[101]
#define __pyx_n_u_Constraint_lb __pyx_string_tab[102]
#define __pyx_n_u_Constraint_lbs __pyx_string_tab[103]
#define __pyx_n_u_Constraint_ldual __pyx_string_tab[104]
#define __pyx_n_u_Constraint_lslack __pyx_string_tab[105]
#define __pyx_n_u_Constraint_restore __pyx_string_tab[106]
#define __pyx_n_u_Constraint_set_dual __pyx_string_tab[107]
#define __pyx_n_u_Constraint_slack __pyx_string_tab[108]
#define __pyx_n_u_Constraint_sstatus __pyx_string_tab[109]
#define __pyx_n_u_Constraint_status __pyx_string_tab[110]
#define __pyx_n_u_Constraint_ub __pyx_string_tab[111]
#define __pyx_n_u_Constraint_ubs __pyx_string_tab[112]
#define __pyx_n_u_Constraint_udual __pyx_string_tab[113]
#define __pyx_n_u_Constraint_uslack __pyx_string_tab[114]
#define __pyx_n_u_Constraint_val __pyx_string_tab[115]
#define __pyx_n_u_Constraints __pyx_string_tab[116]
#define __pyx_n_u_DATA __pyx_string_tab[117]
#define __pyx_n_u_DELETECMD __pyx_string_tab[118]
#define __pyx_n_u_DISPLAY __pyx_string_tab[119]
#define __pyx_n_u_DROP __pyx_string_tab[120]
#define __pyx_n_u_DROP_OR_RESTORE_ALL __pyx_string_tab[121]
#define __pyx_n_u_DataFrame __pyx_string_tab[122]
#define __pyx_n_u_DataFrameArrow __pyx_string_tab[123]
#define __pyx_n_u_DataFrameArrow___reduce_cython __pyx_string_tab[124]
#define __pyx_n_u_DataFrameArrow___setstate_cython __pyx_string_tab[125]
#define __pyx_n_u_DataFrameArrow_from_pandas __pyx_string_tab[126]
#define __pyx_n_u_DataFrameArrow_from_polars __pyx_string_tab[127]
#define __pyx_n_u_DataFrame___reduce_cython __pyx_string_tab[128]
#define __pyx_n_u_DataFrame___setstate_cython __pyx_string_tab[129]
#define __pyx_n_u_DataFrame__add_column __pyx_string_tab[130]
#define __pyx_n_u_DataFrame__add_row __pyx_string_tab[131]
#define __pyx_n_u_DataFrame__from_data_frame_ref __pyx_string_tab[132]
#define __pyx_n_u_DataFrame__get_column __pyx_string_tab[133]
#define __pyx_n_u_DataFrame__get_headers __pyx_string_tab[134]
#define __pyx_n_u_DataFrame__get_num_cols __pyx_string_tab[135]
#define __pyx_n_u_DataFrame__get_num_indices __pyx_string_tab[136]
#define __pyx_n_u_DataFrame__get_num_rows __pyx_string_tab[137]
#define __pyx_n_u_DataFrame__get_row __pyx_string_tab[138]
#define __pyx_n_u_DataFrame__get_row_by_index __pyx_string_tab[139]
#define __pyx_n_u_DataFrame__set_column __pyx_string_tab[140]
#define __pyx_n_u_DataFrame__set_values __pyx_string_tab[141]
#define __pyx_n_u_DataFrame_from_dict __pyx_string_tab[142]
#define __pyx_n_u_DataFrame_from_numpy __pyx_string_tab[143]
#define __pyx_n_u_DataFrame_from_pandas __pyx_string_tab[144]
#define __pyx_n_u_DataFrame_to_dict __pyx_string_tab[145]
#define __pyx_n_u_DataFrame_to_list __pyx_string_tab[146]
#define __pyx_n_u_DataFrame_to_pandas __pyx_string_tab[147]
#define __pyx_n_u_DataFrame_to_string __pyx_string_tab[148]
#define __pyx_kp_u_Dictionary_must_contain_either_a __pyx_string_tab[149]
#define __pyx_n_u_ELSE __pyx_string_tab[150]
#define __pyx_n_u_ELSE_CHECK __pyx_string_tab[151]
#define __pyx_n_u_ENDIF __pyx_string_tab[152]
#define __pyx_n_u_ENVIRON __pyx_string_tab[153]
#define __pyx_n_u_EXIT __pyx_string_tab[154]
#define __pyx_n_u_EXPAND __pyx_string_tab[155]
#define __pyx_n_u_Entity __pyx_string_tab[156]
#define __pyx_n_u_EntityMap __pyx_string_tab[157]
#define __pyx_n_u_EntityMap___reduce_cython __pyx_string_tab[158]
#define __pyx_n_u_EntityMap___setstate_cython __pyx_string_tab[159]
#define __pyx_n_u_EntityMap_size __pyx_string_tab[160]
#define __pyx_n_u_Entity___reduce_cython __pyx_string_tab[161]
#define __pyx_n_u_Entity___setstate_cython __pyx_string_tab[162]
#define __pyx_n_u_Entity_find __pyx_string_tab[163]
#define __pyx_n_u_Entity_get __pyx_string_tab[164]
#define __pyx_n_u_Entity_get_indexing_sets __pyx_string_tab[165]
#define __pyx_n_u_Entity_get_values __pyx_string_tab[166]
#define __pyx_n_u_Entity_indexarity __pyx_string_tab[167]
#define __pyx_n_u_Entity_instances __pyx_string_tab[168]
#define __pyx_n_u_Entity_is_scalar __pyx_string_tab[169]
#define __pyx_n_u_Entity_name __pyx_string_tab[170]
#define __pyx_n_u_Entity_num_instances __pyx_string_tab[171]
#define __pyx_n_u_Entity_set_values __pyx_string_tab[172]
#define __pyx_n_u_Entity_to_dict __pyx_string_tab[173]
#define __pyx_n_u_Entity_to_list __pyx_string_tab[174]
#define __pyx_n_u_Entity_to_pandas __pyx_string_tab[175]
#define __pyx_n_u_Entity_to_string __pyx_string_tab[176]
#define __pyx_n_u_Entity_xref __pyx_string_tab[177]
#define __pyx_n_u_EnvIterator __pyx_string_tab[178]
#define __pyx_n_u_EnvIterator___reduce_cython __pyx_string_tab[179]
#define __pyx_n_u_EnvIterator___setstate_cython __pyx_string_tab[180]
#define __pyx_n_u_Environment __pyx_string_tab[181]
#define __pyx_n_u_Environment___reduce_cython __pyx_string_tab[182]
#define __pyx_n_u_Environment___setstate_cython __pyx_string_tab[183]
#define __pyx_n_u_Environment_get_bin_dir __pyx_string_tab[184]
#define __pyx_n_u_Environment_get_bin_name __pyx_string_tab[185]
#define __pyx_n_u_Environment_set_bin_dir __pyx_string_tab[186]
#define __pyx_n_u_Environment_set_bin_name __pyx_string_tab[187]
#define __pyx_n_u_Environment_to_string __pyx_string_tab[188]
#define __pyx_n_u_ErrorHandler __pyx_string_tab[189]
#define __pyx_n_u_ErrorHandlerWrapper __pyx_string_tab[190]
#define __pyx_n_u_ErrorHandler___reduce_cython __pyx_string_tab[191]
#define __pyx_n_u_ErrorHandler___setstate_cython __pyx_string_tab[192]
#define __pyx_n_u_ErrorHandler_error __pyx_string_tab[193]
#define __pyx_n_u_ErrorHandler_warning __pyx_string_tab[194]
#define __pyx_kp_u_Excepted_dictionary_of_set_membe __pyx_string_tab[195]
#define __pyx_kp_u_Excepted_string_or_real __pyx_string_tab[196]
#define __pyx_kp_u_Excepted_tuple_of_arity __pyx_string_tab[197]
#define __pyx_kp_u_Expected_a_dictionary __pyx_string_tab[198]
#define __pyx_kp_u_Expected_tuples_of_arity __pyx_string_tab[199]
#define __pyx_n_u_FIX __pyx_string_tab[200]
#define __pyx_n_u_FOR __pyx_string_tab[201]
#define __pyx_kp_u_Failed_to_access_value __pyx_string_tab[202]
#define __pyx_kp_u_Failed_to_cast_value_to_int_floa __pyx_string_tab[203]
#define __pyx_n_u_Formatter __pyx_string_tab[204]
#define __pyx_n_u_IF __pyx_string_tab[205]
#define __pyx_n_u_IOError __pyx_string_tab[206]
#define __pyx_n_u_ImportError __pyx_string_tab[207]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0 __pyx_string_tab[208]
#define __pyx_n_u_InfeasibilityException __pyx_string_tab[209]
#define __pyx_kp_u_InfeasibilityException_2 __pyx_string_tab[210]
#define __pyx_n_u_InstanceIterator __pyx_string_tab[211]
#define __pyx_n_u_InstanceIterator___reduce_cython __pyx_string_tab[212]
#define __pyx_n_u_InstanceIterator___setstate_cyth __pyx_string_tab[213]
#define __pyx_n_u_InstanceIterator_size __pyx_string_tab[214]
#define __pyx_n_u_Iterable __pyx_string_tab[215]
#define __pyx_n_u_KeyError __pyx_string_tab[216]
#define __pyx_n_u_Kind __pyx_string_tab[217]
#define __pyx_n_u_LET __pyx_string_tab[218]
#define __pyx_n_u_LOAD __pyx_string_tab[219]
#define __pyx_n_u_LOOPEND __pyx_string_tab[220]
#define __pyx_n_u_MISC __pyx_string_tab[221]
#define __pyx_n_u_MemberRangeIterator __pyx_string_tab[222]
#define __pyx_n_u_MemberRangeIterator___reduce_cyt __pyx_string_tab[223]
#define __pyx_n_u_MemberRangeIterator___setstate_c __pyx_string_tab[224]
#define __pyx_n_u_MemberRangeIterator_size __pyx_string_tab[225]
#define __pyx_n_u_MultiIndex __pyx_string_tab[226]
#define __pyx_kp_u_None __pyx_string_tab[227]
#define __pyx_n_u_NotImplementedError __pyx_string_tab[228]
#define __pyx_n_u_OBJECTIVE __pyx_string_tab[229]
#define __pyx_n_u_OPTION __pyx_string_tab[230]
#define __pyx_n_u_OPTION_RESET __pyx_string_tab[231]
#define __pyx_n_u_Objective __pyx_string_tab[232]
#define __pyx_n_u_Objective___reduce_cython __pyx_string_tab[233]
#define __pyx_n_u_Objective___setstate_cython __pyx_string_tab[234]
#define __pyx_n_u_Objective_astatus __pyx_string_tab[235]
#define __pyx_n_u_Objective_drop __pyx_string_tab[236]
#define __pyx_n_u_Objective_exitcode __pyx_string_tab[237]
#define __pyx_n_u_Objective_message __pyx_string_tab[238]
#define __pyx_n_u_Objective_minimization __pyx_string_tab[239]
#define __pyx_n_u_Objective_restore __pyx_string_tab[240]
#define __pyx_n_u_Objective_result __pyx_string_tab[241]
#define __pyx_n_u_Objective_sstatus __pyx_string_tab[242]
#define __pyx_n_u_Objective_value __pyx_string_tab[243]
#define __pyx_n_u_Objectives __pyx_string_tab[244]
#define __pyx_n_u_Options __pyx_string_tab[245]
#define __pyx_n_u_OutputHandler __pyx_string_tab[246]
#define __pyx_n_u_OutputHandler___reduce_cython __pyx_string_tab[247]
#define __pyx_n_u_OutputHandler___setstate_cython __pyx_string_tab[248]
#define __pyx_n_u_OutputHandler_output __pyx_string_tab[249]
#define __pyx_n_u_PRINT __pyx_string_tab[250]
#define __pyx_n_u_PRINTF __pyx_string_tab[251]
#define __pyx_n_u_PROBLEM __pyx_string_tab[252]
#define __pyx_n_u_PROMPT __pyx_string_tab[253]
#define __pyx_n_u_PURGE __pyx_string_tab[254]
#define __pyx_n_u_Parameter __pyx_string_tab[255]
#define __pyx_n_u_Parameter___reduce_cython __pyx_string_tab[256]
#define __pyx_n_u_Parameter___setstate_cython __pyx_string_tab[257]
#define __pyx_n_u_Parameter_has_default __pyx_string_tab[258]
#define __pyx_n_u_Parameter_is_symbolic __pyx_string_tab[259]
#define __pyx_n_u_Parameter_set __pyx_string_tab[260]
#define __pyx_n_u_Parameter_set_values __pyx_string_tab[261]
#define __pyx_n_u_Parameter_value __pyx_string_tab[262]
#define __pyx_n_u_Parameters __pyx_string_tab[263]
#define __pyx_n_u_PickleError __pyx_string_tab[264]
#define __pyx_kp_u_Please_make_sure_that_the_AMPL __pyx_string_tab[265]
#define __pyx_n_u_PresolveException __pyx_string_tab[266]
#define __pyx_kp_u_PresolveException_2 __pyx_string_tab[267]
#define __pyx_n_u_RBRACE __pyx_string_tab[268]
#define __pyx_n_u_READ __pyx_string_tab[269]
#define __pyx_n_u_READTABLE __pyx_string_tab[270]
#define __pyx_n_u_READ_TABLE __pyx_string_tab[271]
#define __pyx_n_u_RELOAD __pyx_string_tab[272]
#define __pyx_n_u_REMOVE __pyx_string_tab[273]
#define __pyx_n_u_REPEAT __pyx_string_tab[274]
#define __pyx_n_u_REPEAT_END __pyx_string_tab[275]
#define __pyx_n_u_RESET __pyx_string_tab[276]
#define __pyx_n_u_RESTORE __pyx_string_tab[277]
#define __pyx_n_u_RUN_ARGS __pyx_string_tab[278]
#define __pyx_n_u_Real __pyx_string_tab[279]
#define __pyx_kp_u_Represents_the_type_of_the_outp __pyx_string_tab[280]
#define __pyx_n_u_Row __pyx_string_tab[281]
#define __pyx_n_u_RowIterator __pyx_string_tab[282]
#define __pyx_n_u_RowIterator___reduce_cython __pyx_string_tab[283]
#define __pyx_n_u_RowIterator___setstate_cython __pyx_string_tab[284]
#define __pyx_n_u_Row___reduce_cython __pyx_string_tab[285]
#define __pyx_n_u_Row___setstate_cython __pyx_string_tab[286]
#define __pyx_n_u_Row_to_string __pyx_string_tab[287]
#define __pyx_n_u_RuntimeError __pyx_string_tab[288]
#define __pyx_n_u_SEMICOLON __pyx_string_tab[289]
#define __pyx_n_u_SHELL_MESSAGE __pyx_string_tab[290]
#define __pyx_n_u_SHELL_OUTPUT __pyx_string_tab[291]
#define __pyx_n_u_SHOW __pyx_string_tab[292]
#define __pyx_n_u_SOLUTION __pyx_string_tab[293]
#define __pyx_n_u_SOLVE __pyx_string_tab[294]
#define __pyx_n_u_SSTEP __pyx_string_tab[295]
#define __pyx_n_u_SUPPORT_MESSAGE __pyx_string_tab[296]
#define __pyx_n_u_Series __pyx_string_tab[297]
#define __pyx_n_u_Set __pyx_string_tab[298]
#define __pyx_n_u_Set___reduce_cython __pyx_string_tab[299]
#define __pyx_n_u_Set___setstate_cython __pyx_string_tab[300]
#define __pyx_n_u_Set_arity __pyx_string_tab[301]
#define __pyx_n_u_Set_contains __pyx_string_tab[302]
#define __pyx_n_u_Set_get_values __pyx_string_tab[303]
#define __pyx_n_u_Set_instances __pyx_string_tab[304]
#define __pyx_n_u_Set_members __pyx_string_tab[305]
#define __pyx_n_u_Set_set_values __pyx_string_tab[306]
#define __pyx_n_u_Set_size __pyx_string_tab[307]
#define __pyx_n_u_Sets __pyx_string_tab[308]
#define __pyx_n_u_StopIteration __pyx_string_tab[309]
#define __pyx_n_u_StreamHandler __pyx_string_tab[310]
#define __pyx_n_u_SystemError __pyx_string_tab[311]
#define __pyx_n_u_THEN __pyx_string_tab[312]
#define __pyx_n_u_Table __pyx_string_tab[313]
#define __pyx_kp_u_Trying_to_assign_tuples_to_set_o __pyx_string_tab[314]
#define __pyx_n_u_TypeError __pyx_string_tab[315]
#define __pyx_n_u_UNFIX __pyx_string_tab[316]
#define __pyx_n_u_UNLOAD __pyx_string_tab[317]
#define __pyx_n_u_UPDATE __pyx_string_tab[318]
#define __pyx_kp_u_Unexpected_data_type __pyx_string_tab[319]
#define __pyx_kp_u_Unknown_entity_class __pyx_string_tab[320]
#define __pyx_kp_u_Unknown_exception __pyx_string_tab[321]
#define __pyx_n_u_ValueError __pyx_string_tab[322]
#define __pyx_n_u_Variable __pyx_string_tab[323]
#define __pyx_n_u_Variable___reduce_cython __pyx_string_tab[324]
#define __pyx_n_u_Variable___setstate_cython __pyx_string_tab[325]
#define __pyx_n_u_Variable_astatus __pyx_string_tab[326]
#define __pyx_n_u_Variable_defeqn __pyx_string_tab[327]
#define __pyx_n_u_Variable_dual __pyx_string_tab[328]
#define __pyx_n_u_Variable_fix __pyx_string_tab[329]
#define __pyx_n_u_Variable_init __pyx_string_tab[330]
#define __pyx_n_u_Variable_init0 __pyx_string_tab[331]
#define __pyx_n_u_Variable_lb __pyx_string_tab[332]
#define __pyx_n_u_Variable_lb0 __pyx_string_tab[333]
#define __pyx_n_u_Variable_lb1 __pyx_string_tab[334]
#define __pyx_n_u_Variable_lb2 __pyx_string_tab[335]
#define __pyx_n_u_Variable_lrc __pyx_string_tab[336]
#define __pyx_n_u_Variable_lslack __pyx_string_tab[337]
#define __pyx_n_u_Variable_rc __pyx_string_tab[338]
#define __pyx_n_u_Variable_set_value __pyx_string_tab[339]
#define __pyx_n_u_Variable_slack __pyx_string_tab[340]
#define __pyx_n_u_Variable_sstatus __pyx_string_tab[341]
#define __pyx_n_u_Variable_status __pyx_string_tab[342]
#define __pyx_n_u_Variable_ub __pyx_string_tab[343]
#define __pyx_n_u_Variable_ub0 __pyx_string_tab[344]
#define __pyx_n_u_Variable_ub1 __pyx_string_tab[345]
#define __pyx_n_u_Variable_ub2 __pyx_string_tab[346]
#define __pyx_n_u_Variable_unfix __pyx_string_tab[347]
#define __pyx_n_u_Variable_urc __pyx_string_tab[348]
#define __pyx_n_u_Variable_uslack __pyx_string_tab[349]
#define __pyx_n_u_Variable_value __pyx_string_tab[350]
#define __pyx_n_u_Variables __pyx_string_tab[351]
#define __pyx_n_u_WAITING __pyx_string_tab[352]
#define __pyx_n_u_WARNING __pyx_string_tab[353]
#define __pyx_n_u_WRITE __pyx_string_tab[354]
#define __pyx_n_u_WRITETABLE __pyx_string_tab[355]
#define __pyx_n_u_WRITE_TABLE __pyx_string_tab[356]
#define __pyx_n_u_XREF __pyx_string_tab[357]
#define __pyx_kp_u__10 __pyx_string_tab[358]
#define __pyx_kp_u__11 __pyx_string_tab[359]
#define __pyx_kp_u__12 __pyx_string_tab[360]
#define __pyx_kp_u__13 __pyx_string_tab[361]
#define __pyx_kp_u__14 __pyx_string_tab[362]
#define __pyx_kp_u__15 __pyx_string_tab[363]
#define __pyx_kp_u__16 __pyx_string_tab[364]
#define __pyx_kp_u__17 __pyx_string_tab[365]
#define __pyx_kp_u__18 __pyx_string_tab[366]
#define __pyx_kp_u__2 __pyx_string_tab[367]
#define __pyx_n_u__21 __pyx_string_tab[368]
#define __pyx_kp_u__3 __pyx_string_tab[369]
#define __pyx_kp_u__4 __pyx_string_tab[370]
#define __pyx_kp_u__5 __pyx_string_tab[371]
#define __pyx_kp_u__6 __pyx_string_tab[372]
#define __pyx_kp_u__7 __pyx_string_tab[373]
#define __pyx_kp_u__8 __pyx_string_tab[374]
#define __pyx_kp_u__9 __pyx_string_tab[375]
#define __pyx_n_u_addColumn __pyx_string_tab[376]
#define __pyx_n_u_addHandler __pyx_string_tab[377]
#define __pyx_n_u_addRow __pyx_string_tab[378]
#define __pyx_n_u_add_column __pyx_string_tab[379]
#define __pyx_n_u_add_column_locals_genexpr __pyx_string_tab[380]
#define __pyx_n_u_add_row __pyx_string_tab[381]
#define __pyx_n_u_ampl __pyx_string_tab[382]
#define __pyx_n_u_ampl_expressions __pyx_string_tab[383]
#define __pyx_n_u_ampl_instance __pyx_string_tab[384]
#define __pyx_n_u_ampl_libpath __pyx_string_tab[385]
#define __pyx_n_u_amplpy __pyx_string_tab[386]
#define __pyx_n_u_amplpy_ampl __pyx_string_tab[387]
#define __pyx_kp_u_amplpy_ampl_pyx __pyx_string_tab[388]
#define __pyx_kp_u_amplpy_constraint_pxi __pyx_string_tab[389]
#define __pyx_n_u_amplpy_copt __pyx_string_tab[390]
#define __pyx_kp_u_amplpy_copt_package_not_found __pyx_string_tab[391]
#define __pyx_n_u_amplpy_cplex __pyx_string_tab[392]
#define __pyx_kp_u_amplpy_cplex_package_not_found __pyx_string_tab[393]
#define __pyx_kp_u_amplpy_dataframe_arrow_pxi __pyx_string_tab[394]
#define __pyx_kp_u_amplpy_dataframe_pxi __pyx_string_tab[395]
#define __pyx_kp_u_amplpy_entity_pxi __pyx_string_tab[396]
#define __pyx_kp_u_amplpy_environment_pxi __pyx_string_tab[397]
#define __pyx_kp_u_amplpy_errorhandler_pxi __pyx_string_tab[398]
#define __pyx_kp_u_amplpy_exceptions_pxi __pyx_string_tab[399]
#define __pyx_n_u_amplpy_gurobi __pyx_string_tab[400]
#define __pyx_kp_u_amplpy_gurobi_package_not_found __pyx_string_tab[401]
#define __pyx_n_u_amplpy_highs __pyx_string_tab[402]
#define __pyx_kp_u_amplpy_highs_package_not_found __pyx_string_tab[403]
#define __pyx_kp_u_amplpy_iterators_pxi __pyx_string_tab[404]
#define __pyx_kp_u_amplpy_objective_pxi __pyx_string_tab[405]
#define __pyx_kp_u_amplpy_outputhandler_pxi __pyx_string_tab[406]
#define __pyx_kp_u_amplpy_parameter_pxi __pyx_string_tab[407]
#define __pyx_n_u_amplpy_scip __pyx_string_tab[408]
#define __pyx_kp_u_amplpy_scip_package_not_found __pyx_string_tab[409]
#define __pyx_kp_u_amplpy_set_pxi __pyx_string_tab[410]
#define __pyx_kp_u_amplpy_variable_pxi __pyx_string_tab[411]
#define __pyx_n_u_amplpy_xpress __pyx_string_tab[412]
#define __pyx_kp_u_amplpy_xpress_package_not_found __pyx_string_tab[413]
#define __pyx_n_u_args __pyx_string_tab[414]
#define __pyx_n_u_arity __pyx_string_tab[415]
#define __pyx_n_u_array __pyx_string_tab[416]
#define __pyx_n_u_array_ptr __pyx_string_tab[417]
#define __pyx_n_u_array_stream __pyx_string_tab[418]
#define __pyx_n_u_arrow_array_ptr __pyx_string_tab[419]
#define __pyx_n_u_arrow_c_array __pyx_string_tab[420]
#define __pyx_n_u_arrow_c_schema __pyx_string_tab[421]
#define __pyx_n_u_arrow_schema_ptr __pyx_string_tab[422]
#define __pyx_n_u_ast __pyx_string_tab[423]
#define __pyx_n_u_astatus __pyx_string_tab[424]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[425]
#define __pyx_n_u_auxfiles __pyx_string_tab[426]
#define __pyx_n_u_bin_dir __pyx_string_tab[427]
#define __pyx_n_u_bin_dir_c __pyx_string_tab[428]
#define __pyx_n_u_bin_name __pyx_string_tab[429]
#define __pyx_n_u_bin_name_c __pyx_string_tab[430]
#define __pyx_n_u_binary_directory __pyx_string_tab[431]
#define __pyx_n_u_binary_name __pyx_string_tab[432]
#define __pyx_n_u_body __pyx_string_tab[433]
#define __pyx_n_u_bool __pyx_string_tab[434]
#define __pyx_n_u_builtins __pyx_string_tab[435]
#define __pyx_n_u_c __pyx_string_tab[436]
#define __pyx_n_u_c_array __pyx_string_tab[437]
#define __pyx_n_u_c_array_capsule __pyx_string_tab[438]
#define __pyx_n_u_c_array_stream __pyx_string_tab[439]
#define __pyx_n_u_c_double_array __pyx_string_tab[440]
#define __pyx_n_u_c_schema __pyx_string_tab[441]
#define __pyx_n_u_c_schema_capsule __pyx_string_tab[442]
#define __pyx_n_u_c_string_array __pyx_string_tab[443]
#define __pyx_kp_u_cannot_be_found __pyx_string_tab[444]
#define __pyx_kp_u_cannot_convert_to_dictionary_wit __pyx_string_tab[445]
#define __pyx_n_u_cast_row __pyx_string_tab[446]
#define __pyx_n_u_cast_value __pyx_string_tab[447]
#define __pyx_n_u_cd __pyx_string_tab[448]
#define __pyx_n_u_chain __pyx_string_tab[449]
#define __pyx_n_u_check __pyx_string_tab[450]
#define __pyx_n_u_cindex __pyx_string_tab[451]
#define __pyx_n_u_class_getitem __pyx_string_tab[452]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[453]
#define __pyx_n_u_close __pyx_string_tab[454]
#define __pyx_n_u_cls __pyx_string_tab[455]
#define __pyx_n_u_cname __pyx_string_tab[456]
#define __pyx_n_u_col __pyx_string_tab[457]
#define __pyx_n_u_collections_abc __pyx_string_tab[458]
#define __pyx_n_u_column __pyx_string_tab[459]
#define __pyx_n_u_column_names __pyx_string_tab[460]
#define __pyx_n_u_columns __pyx_string_tab[461]
#define __pyx_n_u_con __pyx_string_tab[462]
#define __pyx_n_u_con_2 __pyx_string_tab[463]
#define __pyx_n_u_con_locals_Constraints __pyx_string_tab[464]
#define __pyx_n_u_con_locals_Constraints___getite __pyx_string_tab[465]
#define __pyx_n_u_con_locals_Constraints___init __pyx_string_tab[466]
#define __pyx_n_u_con_locals_Constraints___iter __pyx_string_tab[467]
#define __pyx_n_u_con_locals_Constraints___setite __pyx_string_tab[468]
#define __pyx_n_u_contains __pyx_string_tab[469]
#define __pyx_n_u_contains_c __pyx_string_tab[470]
#define __pyx_n_u_conv_to_list __pyx_string_tab[471]
#define __pyx_n_u_copt __pyx_string_tab[472]
#define __pyx_kp_u_copt_cplex_gurobi_highs_scip_xpr __pyx_string_tab[473]
#define __pyx_n_u_cplex __pyx_string_tab[474]
#define __pyx_n_u_d __pyx_string_tab[475]
#define __pyx_n_u_data __pyx_string_tab[476]
#define __pyx_n_u_data_c __pyx_string_tab[477]
#define __pyx_n_u_data_frame __pyx_string_tab[478]
#define __pyx_n_u_decode __pyx_string_tab[479]
#define __pyx_n_u_defeqn __pyx_string_tab[480]
#define __pyx_n_u_defvar __pyx_string_tab[481]
#define __pyx_n_u_df __pyx_string_tab[482]
#define __pyx_n_u_df_c __pyx_string_tab[483]
#define __pyx_n_u_df_ref __pyx_string_tab[484]
#define __pyx_n_u_df_reset __pyx_string_tab[485]
#define __pyx_n_u_dic __pyx_string_tab[486]
#define __pyx_n_u_dict __pyx_string_tab[487]
#define __pyx_n_u_dict_2 __pyx_string_tab[488]
#define __pyx_n_u_dimen __pyx_string_tab[489]
#define __pyx_n_u_dinit __pyx_string_tab[490]
#define __pyx_n_u_dinit0 __pyx_string_tab[491]
#define __pyx_kp_u_disable __pyx_string_tab[492]
#define __pyx_n_u_display __pyx_string_tab[493]
#define __pyx_n_u_display_error_message __pyx_string_tab[494]
#define __pyx_n_u_doc __pyx_string_tab[495]
#define __pyx_n_u_driver __pyx_string_tab[496]
#define __pyx_n_u_drop __pyx_string_tab[497]
#define __pyx_n_u_dual __pyx_string_tab[498]
#define __pyx_n_u_e __pyx_string_tab[499]
#define __pyx_kp_u_enable __pyx_string_tab[500]
#define __pyx_n_u_encode __pyx_string_tab[501]
#define __pyx_n_u_end __pyx_string_tab[502]
#define __pyx_n_u_endswith __pyx_string_tab[503]
#define __pyx_n_u_entity __pyx_string_tab[504]
#define __pyx_n_u_entitytype __pyx_string_tab[505]
#define __pyx_n_u_enumerate __pyx_string_tab[506]
#define __pyx_n_u_environ __pyx_string_tab[507]
#define __pyx_n_u_environment __pyx_string_tab[508]
#define __pyx_n_u_error __pyx_string_tab[509]
#define __pyx_n_u_error_handler __pyx_string_tab[510]
#define __pyx_n_u_error_handler_wrapper __pyx_string_tab[511]
#define __pyx_n_u_errorinfo __pyx_string_tab[512]
#define __pyx_n_u_errors __pyx_string_tab[513]
#define __pyx_n_u_eval __pyx_string_tab[514]
#define __pyx_n_u_exception __pyx_string_tab[515]
#define __pyx_n_u_exists __pyx_string_tab[516]
#define __pyx_n_u_exitcode __pyx_string_tab[517]
#define __pyx_n_u_exp __pyx_string_tab[518]
#define __pyx_n_u_exportData __pyx_string_tab[519]
#define __pyx_n_u_exportModel __pyx_string_tab[520]
#define __pyx_n_u_export_copt_model __pyx_string_tab[521]
#define __pyx_n_u_export_cplex_model __pyx_string_tab[522]
#define __pyx_n_u_export_data __pyx_string_tab[523]
#define __pyx_n_u_export_gurobi_model __pyx_string_tab[524]
#define __pyx_n_u_export_highs_model __pyx_string_tab[525]
#define __pyx_n_u_export_model __pyx_string_tab[526]
#define __pyx_n_u_export_scip_model __pyx_string_tab[527]
#define __pyx_n_u_export_xpress_model __pyx_string_tab[528]
#define __pyx_n_u_exprs __pyx_string_tab[529]
#define __pyx_n_u_file __pyx_string_tab[530]
#define __pyx_n_u_filename __pyx_string_tab[531]
#define __pyx_n_u_find __pyx_string_tab[532]
#define __pyx_n_u_fix __pyx_string_tab[533]
#define __pyx_n_u_flat __pyx_string_tab[534]
#define __pyx_n_u_flush __pyx_string_tab[535]
#define __pyx_n_u_format __pyx_string_tab[536]
#define __pyx_n_u_formatter __pyx_string_tab[537]
#define __pyx_n_u_fromDict __pyx_string_tab[538]
#define __pyx_n_u_fromNumpy __pyx_string_tab[539]
#define __pyx_n_u_fromPandas __pyx_string_tab[540]
#define __pyx_n_u_from_arrays __pyx_string_tab[541]
#define __pyx_n_u_from_data_frame_ref __pyx_string_tab[542]
#define __pyx_n_u_from_dict __pyx_string_tab[543]
#define __pyx_n_u_from_dict_locals_genexpr __pyx_string_tab[544]
#define __pyx_n_u_from_dict_locals_to_tuple __pyx_string_tab[545]
#define __pyx_n_u_from_numpy __pyx_string_tab[546]
#define __pyx_n_u_from_pandas __pyx_string_tab[547]
#define __pyx_n_u_from_polars __pyx_string_tab[548]
#define __pyx_n_u_from_tuples __pyx_string_tab[549]
#define __pyx_n_u_func __pyx_string_tab[550]
#define __pyx_kp_u_gc __pyx_string_tab[551]
#define __pyx_n_u_genexpr __pyx_string_tab[552]
#define __pyx_n_u_get __pyx_string_tab[553]
#define __pyx_n_u_getBinDir __pyx_string_tab[554]
#define __pyx_n_u_getBinName __pyx_string_tab[555]
#define __pyx_n_u_getColumn __pyx_string_tab[556]
#define __pyx_n_u_getConstraint __pyx_string_tab[557]
#define __pyx_n_u_getConstraints __pyx_string_tab[558]
#define __pyx_n_u_getCurrentObjective __pyx_string_tab[559]
#define __pyx_n_u_getData __pyx_string_tab[560]
#define __pyx_n_u_getEntity __pyx_string_tab[561]
#define __pyx_n_u_getErrorHandler __pyx_string_tab[562]
#define __pyx_n_u_getHeaders __pyx_string_tab[563]
#define __pyx_n_u_getIndexingSets __pyx_string_tab[564]
#define __pyx_n_u_getLineNumber __pyx_string_tab[565]
#define __pyx_n_u_getLogger __pyx_string_tab[566]
#define __pyx_n_u_getMessage __pyx_string_tab[567]
#define __pyx_n_u_getNumCols __pyx_string_tab[568]
#define __pyx_n_u_getNumIndices __pyx_string_tab[569]
#define __pyx_n_u_getNumRows __pyx_string_tab[570]
#define __pyx_n_u_getObjective __pyx_string_tab[571]
#define __pyx_n_u_getObjectives __pyx_string_tab[572]
#define __pyx_n_u_getOffset __pyx_string_tab[573]
#define __pyx_n_u_getOption __pyx_string_tab[574]
#define __pyx_n_u_getOutput __pyx_string_tab[575]
#define __pyx_n_u_getOutputHandler __pyx_string_tab[576]
#define __pyx_n_u_getParameter __pyx_string_tab[577]
#define __pyx_n_u_getParameters __pyx_string_tab[578]
#define __pyx_n_u_getRecordedEntities __pyx_string_tab[579]
#define __pyx_n_u_getRow __pyx_string_tab[580]
#define __pyx_n_u_getRowByIndex __pyx_string_tab[581]
#define __pyx_n_u_getSet __pyx_string_tab[582]
#define __pyx_n_u_getSets __pyx_string_tab[583]
#define __pyx_n_u_getSourceName __pyx_string_tab[584]
#define __pyx_n_u_getValue __pyx_string_tab[585]
#define __pyx_n_u_getValues __pyx_string_tab[586]
#define __pyx_n_u_getVariable __pyx_string_tab[587]
#define __pyx_n_u_getVariables __pyx_string_tab[588]
#define __pyx_n_u_get_bin_dir __pyx_string_tab[589]
#define __pyx_n_u_get_bin_name __pyx_string_tab[590]
#define __pyx_n_u_get_column __pyx_string_tab[591]
#define __pyx_n_u_get_constraint __pyx_string_tab[592]
#define __pyx_n_u_get_constraints __pyx_string_tab[593]
#define __pyx_n_u_get_current_objective __pyx_string_tab[594]
#define __pyx_n_u_get_data __pyx_string_tab[595]
#define __pyx_n_u_get_entity __pyx_string_tab[596]
#define __pyx_n_u_get_error_handler __pyx_string_tab[597]
#define __pyx_n_u_get_headers __pyx_string_tab[598]
#define __pyx_n_u_get_headers_locals_genexpr __pyx_string_tab[599]
#define __pyx_n_u_get_iis __pyx_string_tab[600]
#define __pyx_n_u_get_indexing_sets __pyx_string_tab[601]
#define __pyx_n_u_get_line_number __pyx_string_tab[602]
#define __pyx_n_u_get_message __pyx_string_tab[603]
#define __pyx_n_u_get_next __pyx_string_tab[604]
#define __pyx_n_u_get_num_cols __pyx_string_tab[605]
#define __pyx_n_u_get_num_indices __pyx_string_tab[606]
#define __pyx_n_u_get_num_rows __pyx_string_tab[607]
#define __pyx_n_u_get_objective __pyx_string_tab[608]
#define __pyx_n_u_get_objectives __pyx_string_tab[609]
#define __pyx_n_u_get_offset __pyx_string_tab[610]
#define __pyx_n_u_get_option __pyx_string_tab[611]
#define __pyx_n_u_get_output __pyx_string_tab[612]
#define __pyx_n_u_get_output_handler __pyx_string_tab[613]
#define __pyx_n_u_get_parameter __pyx_string_tab[614]
#define __pyx_n_u_get_parameters __pyx_string_tab[615]
#define __pyx_n_u_get_row __pyx_string_tab[616]
#define __pyx_n_u_get_row_by_index __pyx_string_tab[617]
#define __pyx_n_u_get_schema __pyx_string_tab[618]
#define __pyx_n_u_get_set __pyx_string_tab[619]
#define __pyx_n_u_get_sets __pyx_string_tab[620]
#define __pyx_n_u_get_solution __pyx_string_tab[621]
#define __pyx_n_u_get_source_name __pyx_string_tab[622]
#define __pyx_n_u_get_value __pyx_string_tab[623]
#define __pyx_n_u_get_values __pyx_string_tab[624]
#define __pyx_n_u_get_variable __pyx_string_tab[625]
#define __pyx_n_u_get_variables __pyx_string_tab[626]
#define __pyx_n_u_getitem __pyx_string_tab[627]
#define __pyx_n_u_getstate __pyx_string_tab[628]
#define __pyx_n_u_gurobi __pyx_string_tab[629]
#define __pyx_n_u_handler __pyx_string_tab[630]
#define __pyx_n_u_hasDefault __pyx_string_tab[631]
#define __pyx_n_u_hasHandlers __pyx_string_tab[632]
#define __pyx_n_u_has_default __pyx_string_tab[633]
#define __pyx_n_u_header __pyx_string_tab[634]
#define __pyx_n_u_headers __pyx_string_tab[635]
#define __pyx_n_u_headers_py __pyx_string_tab[636]
#define __pyx_n_u_highs __pyx_string_tab[637]
#define __pyx_n_u_i __pyx_string_tab[638]
#define __pyx_kp_u_i_in_1__ncons__con_i_iis_non__c __pyx_string_tab[639]
#define __pyx_kp_u_i_in_1__nvars__var_i_iis_non__v __pyx_string_tab[640]
#define __pyx_kp_u_i_in_1__nvars__var_i_val_0__var __pyx_string_tab[641]
#define __pyx_kp_u_i_in_1__nvars__varname_i__var_i __pyx_string_tab[642]
#define __pyx_n_u_idx __pyx_string_tab[643]
#define __pyx_n_u_iis_con __pyx_string_tab[644]
#define __pyx_n_u_iis_var __pyx_string_tab[645]
#define __pyx_n_u_impl __pyx_string_tab[646]
#define __pyx_n_u_import_ampls_solution __pyx_string_tab[647]
#define __pyx_n_u_import_ampls_solution_locals_gen __pyx_string_tab[648]
#define __pyx_n_u_import_entities __pyx_string_tab[649]
#define __pyx_n_u_index __pyx_string_tab[650]
#define __pyx_n_u_index_c __pyx_string_tab[651]
#define __pyx_n_u_index_names __pyx_string_tab[652]
#define __pyx_n_u_indexarity __pyx_string_tab[653]
#define __pyx_n_u_indices_c __pyx_string_tab[654]
#define __pyx_n_u_init __pyx_string_tab[655]
#define __pyx_n_u_init0 __pyx_string_tab[656]
#define __pyx_n_u_init_2 __pyx_string_tab[657]
#define __pyx_n_u_initializing __pyx_string_tab[658]
#define __pyx_n_u_instances __pyx_string_tab[659]
#define __pyx_n_u_isLogical __pyx_string_tab[660]
#define __pyx_n_u_isRunning __pyx_string_tab[661]
#define __pyx_n_u_isScalar __pyx_string_tab[662]
#define __pyx_n_u_isSymbolic __pyx_string_tab[663]
#define __pyx_n_u_is_coroutine __pyx_string_tab[664]
#define __pyx_n_u_is_logical __pyx_string_tab[665]
#define __pyx_kp_u_is_not_supported_please_choose __pyx_string_tab[666]
#define __pyx_n_u_is_running __pyx_string_tab[667]
#define __pyx_n_u_is_scalar __pyx_string_tab[668]
#define __pyx_n_u_is_symbolic __pyx_string_tab[669]
#define __pyx_kp_u_isenabled __pyx_string_tab[670]
#define __pyx_n_u_isrunning __pyx_string_tab[671]
#define __pyx_n_u_items __pyx_string_tab[672]
#define __pyx_n_u_iter __pyx_string_tab[673]
#define __pyx_n_u_iter___locals_genexpr __pyx_string_tab[674]
#define __pyx_n_u_itertools __pyx_string_tab[675]
#define __pyx_n_u_j __pyx_string_tab[676]
#define __pyx_n_u_k __pyx_string_tab[677]
#define __pyx_n_u_keep_files __pyx_string_tab[678]
#define __pyx_n_u_key __pyx_string_tab[679]
#define __pyx_n_u_keys __pyx_string_tab[680]
#define __pyx_n_u_kind __pyx_string_tab[681]
#define __pyx_n_u_kwargs __pyx_string_tab[682]
#define __pyx_n_u_last_exception __pyx_string_tab[683]
#define __pyx_n_u_lb __pyx_string_tab[684]
#define __pyx_n_u_lb0 __pyx_string_tab[685]
#define __pyx_n_u_lb1 __pyx_string_tab[686]
#define __pyx_n_u_lb2 __pyx_string_tab[687]
#define __pyx_n_u_lbs __pyx_string_tab[688]
#define __pyx_n_u_ldual __pyx_string_tab[689]
#define __pyx_kp_u_let __pyx_string_tab[690]
#define __pyx_kp_u_levelname_s_message_s __pyx_string_tab[691]
#define __pyx_kp_u_line __pyx_string_tab[692]
#define __pyx_kp_u_line_2 __pyx_string_tab[693]
#define __pyx_n_u_line_number __pyx_string_tab[694]
#define __pyx_n_u_literal_eval __pyx_string_tab[695]
#define __pyx_n_u_loadSession __pyx_string_tab[696]
#define __pyx_n_u_load_session __pyx_string_tab[697]
#define __pyx_n_u_logger __pyx_string_tab[698]
#define __pyx_n_u_logging __pyx_string_tab[699]
#define __pyx_n_u_lrc __pyx_string_tab[700]
#define __pyx_n_u_lslack __pyx_string_tab[701]
#define __pyx_n_u_lst __pyx_string_tab[702]
#define __pyx_n_u_lst_columns __pyx_string_tab[703]
#define __pyx_n_u_lst_index __pyx_string_tab[704]
#define __pyx_n_u_lst_solution __pyx_string_tab[705]
#define __pyx_n_u_main __pyx_string_tab[706]
#define __pyx_n_u_map __pyx_string_tab[707]
#define __pyx_n_u_members __pyx_string_tab[708]
#define __pyx_n_u_message __pyx_string_tab[709]
#define __pyx_n_u_metaclass __pyx_string_tab[710]
#define __pyx_n_u_minimization __pyx_string_tab[711]
#define __pyx_n_u_minimize __pyx_string_tab[712]
#define __pyx_n_u_model __pyx_string_tab[713]
#define __pyx_n_u_model_c __pyx_string_tab[714]
#define __pyx_n_u_module __pyx_string_tab[715]
#define __pyx_n_u_mro_entries __pyx_string_tab[716]
#define __pyx_n_u_msg __pyx_string_tab[717]
#define __pyx_n_u_multi_index __pyx_string_tab[718]
#define __pyx_n_u_n __pyx_string_tab[719]
#define __pyx_n_u_na __pyx_string_tab[720]
#define __pyx_n_u_name __pyx_string_tab[721]
#define __pyx_n_u_name_2 __pyx_string_tab[722]
#define __pyx_n_u_name_c __pyx_string_tab[723]
#define __pyx_n_u_name_c_2 __pyx_string_tab[724]
#define __pyx_n_u_names __pyx_string_tab[725]
#define __pyx_n_u_nanoarrow __pyx_string_tab[726]
#define __pyx_n_u_ncols __pyx_string_tab[727]
#define __pyx_n_u_ncolumns __pyx_string_tab[728]
#define __pyx_n_u_ndarray __pyx_string_tab[729]
#define __pyx_n_u_nested __pyx_string_tab[730]
#define __pyx_n_u_nested_dict_of_suffixes __pyx_string_tab[731]
#define __pyx_n_u_new __pyx_string_tab[732]
#define __pyx_n_u_next __pyx_string_tab[733]
#define __pyx_n_u_nindices __pyx_string_tab[734]
#define __pyx_n_u_nlevels __pyx_string_tab[735]
#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[736]
#define __pyx_n_u_np __pyx_string_tab[737]
#define __pyx_n_u_nt __pyx_string_tab[738]
#define __pyx_n_u_num __pyx_string_tab[739]
#define __pyx_n_u_numInstances __pyx_string_tab[740]
#define __pyx_n_u_num_instances __pyx_string_tab[741]
#define __pyx_n_u_number __pyx_string_tab[742]
#define __pyx_n_u_numbers __pyx_string_tab[743]
#define __pyx_n_u_numpy __pyx_string_tab[744]
#define __pyx_n_u_obj __pyx_string_tab[745]
#define __pyx_n_u_obj_2 __pyx_string_tab[746]
#define __pyx_n_u_obj_locals_Objectives __pyx_string_tab[747]
#define __pyx_n_u_obj_locals_Objectives___getitem __pyx_string_tab[748]
#define __pyx_n_u_obj_locals_Objectives___init __pyx_string_tab[749]
#define __pyx_n_u_obj_locals_Objectives___iter __pyx_string_tab[750]
#define __pyx_n_u_object __pyx_string_tab[751]
#define __pyx_n_u_objname __pyx_string_tab[752]
#define __pyx_n_u_objname_c __pyx_string_tab[753]
#define __pyx_n_u_offset __pyx_string_tab[754]
#define __pyx_kp_u_offset_2 __pyx_string_tab[755]
#define __pyx_n_u_open __pyx_string_tab[756]
#define __pyx_n_u_option __pyx_string_tab[757]
#define __pyx_n_u_option_2 __pyx_string_tab[758]
#define __pyx_n_u_option_locals_Options __pyx_string_tab[759]
#define __pyx_n_u_option_locals_Options___getitem __pyx_string_tab[760]
#define __pyx_n_u_option_locals_Options___init __pyx_string_tab[761]
#define __pyx_n_u_option_locals_Options___setitem __pyx_string_tab[762]
#define __pyx_n_u_option_locals_Options___setitem_2 __pyx_string_tab[763]
#define __pyx_n_u_options __pyx_string_tab[764]
#define __pyx_n_u_options_2 __pyx_string_tab[765]
#define __pyx_n_u_options_c __pyx_string_tab[766]
#define __pyx_n_u_options_dict __pyx_string_tab[767]
#define __pyx_n_u_os __pyx_string_tab[768]
#define __pyx_n_u_output __pyx_string_tab[769]
#define __pyx_n_u_output_c __pyx_string_tab[770]
#define __pyx_n_u_output_handler __pyx_string_tab[771]
#define __pyx_n_u_p __pyx_string_tab[772]
#define __pyx_n_u_pa __pyx_string_tab[773]
#define __pyx_n_u_pa_df __pyx_string_tab[774]
#define __pyx_n_u_pandas __pyx_string_tab[775]
#define __pyx_n_u_param __pyx_string_tab[776]
#define __pyx_n_u_param_2 __pyx_string_tab[777]
#define __pyx_n_u_param_locals_Parameters __pyx_string_tab[778]
#define __pyx_n_u_param_locals_Parameters___getit __pyx_string_tab[779]
#define __pyx_n_u_param_locals_Parameters___init __pyx_string_tab[780]
#define __pyx_n_u_param_locals_Parameters___iter __pyx_string_tab[781]
#define __pyx_n_u_param_locals_Parameters___setit __pyx_string_tab[782]
#define __pyx_n_u_path __pyx_string_tab[783]
#define __pyx_n_u_pd __pyx_string_tab[784]
#define __pyx_n_u_pickle __pyx_string_tab[785]
#define __pyx_n_u_pl __pyx_string_tab[786]
#define __pyx_n_u_polars __pyx_string_tab[787]
#define __pyx_n_u_pop __pyx_string_tab[788]
#define __pyx_n_u_prepare __pyx_string_tab[789]
#define __pyx_n_u_preserve_index __pyx_string_tab[790]
#define __pyx_n_u_print __pyx_string_tab[791]
#define __pyx_n_u_problem __pyx_string_tab[792]
#define __pyx_n_u_propagate __pyx_string_tab[793]
#define __pyx_n_u_property __pyx_string_tab[794]
#define __pyx_n_u_py_list __pyx_string_tab[795]
#define __pyx_n_u_py_variant __pyx_string_tab[796]
#define __pyx_n_u_pyarrow __pyx_string_tab[797]
#define __pyx_n_u_pylist __pyx_string_tab[798]
#define __pyx_n_u_pyx_PickleError __pyx_string_tab[799]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[800]
#define __pyx_n_u_pyx_result __pyx_string_tab[801]
#define __pyx_n_u_pyx_state __pyx_string_tab[802]
#define __pyx_n_u_pyx_type __pyx_string_tab[803]
#define __pyx_n_u_pyx_unpickle_AMPLException __pyx_string_tab[804]
#define __pyx_n_u_pyx_unpickle_ErrorHandler __pyx_string_tab[805]
#define __pyx_n_u_pyx_unpickle_OutputHandler __pyx_string_tab[806]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[807]
#define __pyx_n_u_qualname __pyx_string_tab[808]
#define __pyx_n_u_range __pyx_string_tab[809]
#define __pyx_n_u_rc __pyx_string_tab[810]
#define __pyx_n_u_read __pyx_string_tab[811]
#define __pyx_n_u_readData __pyx_string_tab[812]
#define __pyx_n_u_readTable __pyx_string_tab[813]
#define __pyx_n_u_read_data __pyx_string_tab[814]
#define __pyx_n_u_read_table __pyx_string_tab[815]
#define __pyx_n_u_reduce __pyx_string_tab[816]
#define __pyx_n_u_reduce_cython __pyx_string_tab[817]
#define __pyx_n_u_reduce_ex __pyx_string_tab[818]
#define __pyx_n_u_replace __pyx_string_tab[819]
#define __pyx_n_u_reset __pyx_string_tab[820]
#define __pyx_n_u_reset_index __pyx_string_tab[821]
#define __pyx_n_u_restore __pyx_string_tab[822]
#define __pyx_n_u_result __pyx_string_tab[823]
#define __pyx_n_u_return_output __pyx_string_tab[824]
#define __pyx_n_u_rmtree __pyx_string_tab[825]
#define __pyx_n_u_row __pyx_string_tab[826]
#define __pyx_n_u_rowindex __pyx_string_tab[827]
#define __pyx_n_u_scalar_expression __pyx_string_tab[828]
#define __pyx_n_u_schema_ptr __pyx_string_tab[829]
#define __pyx_n_u_scip __pyx_string_tab[830]
#define __pyx_n_u_self __pyx_string_tab[831]
#define __pyx_kp_u_self__c_ampl_cannot_be_converted __pyx_string_tab[832]
#define __pyx_kp_u_self__c_ampl_self__index_self_be __pyx_string_tab[833]
#define __pyx_kp_u_self__df_cannot_be_converted_to __pyx_string_tab[834]
#define __pyx_kp_u_self__index_cannot_be_converted __pyx_string_tab[835]
#define __pyx_kp_u_self_begin_cannot_be_converted_t __pyx_string_tab[836]
#define __pyx_kp_u_self_begin_self_end_self_env_c_s __pyx_string_tab[837]
#define __pyx_n_u_send __pyx_string_tab[838]
#define __pyx_n_u_set __pyx_string_tab[839]
#define __pyx_n_u_setBinDir __pyx_string_tab[840]
#define __pyx_n_u_setBinName __pyx_string_tab[841]
#define __pyx_n_u_setColumn __pyx_string_tab[842]
#define __pyx_n_u_setData __pyx_string_tab[843]
#define __pyx_n_u_setDual __pyx_string_tab[844]
#define __pyx_n_u_setErrorHandler __pyx_string_tab[845]
#define __pyx_n_u_setFormatter __pyx_string_tab[846]
#define __pyx_n_u_setLevel __pyx_string_tab[847]
#define __pyx_n_u_setOption __pyx_string_tab[848]
#define __pyx_n_u_setOutputHandler __pyx_string_tab[849]
#define __pyx_n_u_setValue __pyx_string_tab[850]
#define __pyx_n_u_setValues __pyx_string_tab[851]
#define __pyx_n_u_setValues_2 __pyx_string_tab[852]
#define __pyx_n_u_set_2 __pyx_string_tab[853]
#define __pyx_n_u_set_bin_dir __pyx_string_tab[854]
#define __pyx_n_u_set_bin_name __pyx_string_tab[855]
#define __pyx_n_u_set_column __pyx_string_tab[856]
#define __pyx_n_u_set_data __pyx_string_tab[857]
#define __pyx_n_u_set_data_arrow __pyx_string_tab[858]
#define __pyx_n_u_set_dual __pyx_string_tab[859]
#define __pyx_n_u_set_error_handler __pyx_string_tab[860]
#define __pyx_n_u_set_error_handler_locals_ErrorHa __pyx_string_tab[861]
#define __pyx_n_u_set_error_handler_locals_ErrorHa_2 __pyx_string_tab[862]
#define __pyx_n_u_set_error_handler_locals_ErrorHa_3 __pyx_string_tab[863]
#define __pyx_n_u_set_error_handler_locals_ErrorHa_4 __pyx_string_tab[864]
#define __pyx_n_u_set_error_handler_locals_ErrorHa_5 __pyx_string_tab[865]
#define __pyx_n_u_set_locals_Sets __pyx_string_tab[866]
#define __pyx_n_u_set_locals_Sets___getitem __pyx_string_tab[867]
#define __pyx_n_u_set_locals_Sets___init __pyx_string_tab[868]
#define __pyx_n_u_set_locals_Sets___iter __pyx_string_tab[869]
#define __pyx_n_u_set_locals_Sets___setitem __pyx_string_tab[870]
#define __pyx_n_u_set_name __pyx_string_tab[871]
#define __pyx_n_u_set_name_2 __pyx_string_tab[872]
#define __pyx_n_u_set_option __pyx_string_tab[873]
#define __pyx_n_u_set_option_2 __pyx_string_tab[874]
#define __pyx_n_u_set_option_locals_genexpr __pyx_string_tab[875]
#define __pyx_n_u_set_output_handler __pyx_string_tab[876]
#define __pyx_n_u_set_value __pyx_string_tab[877]
#define __pyx_n_u_set_values __pyx_string_tab[878]
#define __pyx_n_u_set_values_2 __pyx_string_tab[879]
#define __pyx_n_u_set_values_locals_cast_row __pyx_string_tab[880]
#define __pyx_n_u_set_values_locals_cast_value __pyx_string_tab[881]
#define __pyx_n_u_set_values_locals_conv_to_list __pyx_string_tab[882]
#define __pyx_n_u_set_values_locals_genexpr __pyx_string_tab[883]
#define __pyx_n_u_setitem __pyx_string_tab[884]
#define __pyx_n_u_sets __pyx_string_tab[885]
#define __pyx_n_u_setstate __pyx_string_tab[886]
#define __pyx_n_u_setstate_cython __pyx_string_tab[887]
#define __pyx_n_u_shape __pyx_string_tab[888]
#define __pyx_n_u_shutil __pyx_string_tab[889]
#define __pyx_n_u_size __pyx_string_tab[890]
#define __pyx_n_u_skip_index __pyx_string_tab[891]
#define __pyx_n_u_slack __pyx_string_tab[892]
#define __pyx_n_u_snapshot __pyx_string_tab[893]
#define __pyx_kp_u_sol __pyx_string_tab[894]
#define __pyx_n_u_solfile __pyx_string_tab[895]
#define __pyx_kp_u_solution __pyx_string_tab[896]
#define __pyx_kp_u_solve __pyx_string_tab[897]
#define __pyx_n_u_solve_2 __pyx_string_tab[898]
#define __pyx_n_u_solve_result __pyx_string_tab[899]
#define __pyx_n_u_solve_result_num __pyx_string_tab[900]
#define __pyx_n_u_solver __pyx_string_tab[901]
#define __pyx_n_u_solver_list __pyx_string_tab[902]
#define __pyx_n_u_source_name __pyx_string_tab[903]
#define __pyx_n_u_spec __pyx_string_tab[904]
#define __pyx_n_u_split __pyx_string_tab[905]
#define __pyx_n_u_sstatus __pyx_string_tab[906]
#define __pyx_n_u_stack __pyx_string_tab[907]
#define __pyx_n_u_startRecording __pyx_string_tab[908]
#define __pyx_n_u_start_recording __pyx_string_tab[909]
#define __pyx_n_u_state __pyx_string_tab[910]
#define __pyx_n_u_statements __pyx_string_tab[911]
#define __pyx_n_u_statements_c __pyx_string_tab[912]
#define __pyx_n_u_status __pyx_string_tab[913]
#define __pyx_n_u_stderr __pyx_string_tab[914]
#define __pyx_n_u_stmt __pyx_string_tab[915]
#define __pyx_n_u_stopRecording __pyx_string_tab[916]
#define __pyx_n_u_stop_recording __pyx_string_tab[917]
#define __pyx_n_u_stream __pyx_string_tab[918]
#define __pyx_kp_u_stringsource __pyx_string_tab[919]
#define __pyx_n_u_suffixes __pyx_string_tab[920]
#define __pyx_n_u_suffixes_c __pyx_string_tab[921]
#define __pyx_n_u_super __pyx_string_tab[922]
#define __pyx_n_u_sys __pyx_string_tab[923]
#define __pyx_n_u_t __pyx_string_tab[924]
#define __pyx_n_u_t_c __pyx_string_tab[925]
#define __pyx_n_u_table_name __pyx_string_tab[926]
#define __pyx_n_u_test __pyx_string_tab[927]
#define __pyx_n_u_throw __pyx_string_tab[928]
#define __pyx_n_u_throw_on_warnings __pyx_string_tab[929]
#define __pyx_n_u_tmpdir __pyx_string_tab[930]
#define __pyx_n_u_toDict __pyx_string_tab[931]
#define __pyx_n_u_toList __pyx_string_tab[932]
#define __pyx_n_u_toPandas __pyx_string_tab[933]
#define __pyx_n_u_toString __pyx_string_tab[934]
#define __pyx_n_u_to_ampls __pyx_string_tab[935]
#define __pyx_n_u_to_arrow __pyx_string_tab[936]
#define __pyx_n_u_to_dict __pyx_string_tab[937]
#define __pyx_n_u_to_list __pyx_string_tab[938]
#define __pyx_n_u_to_pandas __pyx_string_tab[939]
#define __pyx_n_u_to_string __pyx_string_tab[940]
#define __pyx_n_u_to_string_c __pyx_string_tab[941]
#define __pyx_n_u_to_tuple __pyx_string_tab[942]
#define __pyx_n_u_tolist __pyx_string_tab[943]
#define __pyx_n_u_tools __pyx_string_tab[944]
#define __pyx_n_u_tuple __pyx_string_tab[945]
#define __pyx_n_u_tuple_c __pyx_string_tab[946]
#define __pyx_n_u_ub __pyx_string_tab[947]
#define __pyx_n_u_ub0 __pyx_string_tab[948]
#define __pyx_n_u_ub1 __pyx_string_tab[949]
#define __pyx_n_u_ub2 __pyx_string_tab[950]
#define __pyx_n_u_ubs __pyx_string_tab[951]
#define __pyx_n_u_udual __pyx_string_tab[952]
#define __pyx_n_u_unfix __pyx_string_tab[953]
#define __pyx_kp_u_unsupported_type __pyx_string_tab[954]
#define __pyx_n_u_update __pyx_string_tab[955]
#define __pyx_n_u_urc __pyx_string_tab[956]
#define __pyx_n_u_use_setstate __pyx_string_tab[957]
#define __pyx_n_u_uslack __pyx_string_tab[958]
#define __pyx_kp_u_utf_8 __pyx_string_tab[959]
#define __pyx_n_u_v __pyx_string_tab[960]
#define __pyx_n_u_val __pyx_string_tab[961]
#define __pyx_n_u_value __pyx_string_tab[962]
#define __pyx_n_u_value_c __pyx_string_tab[963]
#define __pyx_n_u_values __pyx_string_tab[964]
#define __pyx_n_u_var __pyx_string_tab[965]
#define __pyx_n_u_var_2 __pyx_string_tab[966]
#define __pyx_n_u_var_locals_Variables __pyx_string_tab[967]
#define __pyx_n_u_var_locals_Variables___getitem __pyx_string_tab[968]
#define __pyx_n_u_var_locals_Variables___init __pyx_string_tab[969]
#define __pyx_n_u_var_locals_Variables___iter __pyx_string_tab[970]
#define __pyx_n_u_var_locals_Variables___setitem __pyx_string_tab[971]
#define __pyx_n_u_verbose __pyx_string_tab[972]
#define __pyx_n_u_warning __pyx_string_tab[973]
#define __pyx_n_u_workdir __pyx_string_tab[974]
#define __pyx_n_u_workdir_c __pyx_string_tab[975]
#define __pyx_n_u_write __pyx_string_tab[976]
#define __pyx_n_u_writeTable __pyx_string_tab[977]
#define __pyx_n_u_write_sol __pyx_string_tab[978]
#define __pyx_n_u_write_table __pyx_string_tab[979]
#define __pyx_n_u_xpress __pyx_string_tab[980]
#define __pyx_n_u_xref __pyx_string_tab[981]
#define __pyx_n_u_zeros __pyx_string_tab[982]
#define __pyx_n_u_zip __pyx_string_tab[983]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #ifdef __Pyx_CyFunction_USED
  Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  #endif
  #ifdef __Pyx_FusedFunction_USED
  Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
  #endif
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Row);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Row);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Column);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Column);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_DataFrame);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_DataFrame);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_DataFrameArrow);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_DataFrameArrow);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Entity);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Entity);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Constraint);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Constraint);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Environment);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Environment);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_ErrorHandler);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_ErrorHandler);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_AMPLException);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_AMPLException);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_EnvIterator);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_EnvIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_EntityMap);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_EntityMap);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_InstanceIterator);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_InstanceIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_MemberRangeIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_ColIterator);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_ColIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_RowIterator);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_RowIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Objective);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Objective);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_OutputHandler);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_OutputHandler);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Parameter);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Parameter);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Set);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Set);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_Variable);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_Variable);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl_AMPL);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl_AMPL);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct____iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr);
  Py_CLEAR(clear_module_state->__pyx_k_);
  for (int i=0; i<30; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<267; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<984; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  Py_CLEAR(clear_module_state->__pyx_float_1_0);
  Py_CLEAR(clear_module_state->__pyx_int_0);
  Py_CLEAR(clear_module_state->__pyx_int_1);
  Py_CLEAR(clear_module_state->__pyx_int_222419149);
  Py_CLEAR(clear_module_state->__pyx_int_228825662);
  Py_CLEAR(clear_module_state->__pyx_int_238750788);
  Py_CLEAR(clear_module_state->__pyx_int_neg_1);
  return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  #ifdef __Pyx_CyFunction_USED
  Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  #endif
  #ifdef __Pyx_FusedFunction_USED
  Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
  #endif
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Row);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Row);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Column);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Column);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_DataFrame);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_DataFrame);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_DataFrameArrow);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_DataFrameArrow);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Entity);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Entity);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Constraint);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Constraint);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Environment);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Environment);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_ErrorHandler);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_ErrorHandler);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_AMPLException);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_AMPLException);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_EnvIterator);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_EnvIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_EntityMap);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_EntityMap);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_InstanceIterator);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_InstanceIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_MemberRangeIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_ColIterator);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_ColIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_RowIterator);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_RowIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Objective);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Objective);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_OutputHandler);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_OutputHandler);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Parameter);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Parameter);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Set);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Set);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_Variable);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_Variable);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl_AMPL);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl_AMPL);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct____iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr);
  Py_VISIT(traverse_module_state->__pyx_k_);
  for (int i=0; i<30; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<267; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<984; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_float_1_0);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_0);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_1);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_222419149);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_228825662);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_238750788);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_neg_1);
  return 0;
}
#endif
/* #### Code section: module_code ### */

/* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":23
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
 *             return self.cval.real             # <<<<<<<<<<<<<<
 * 
 *         # unavailable in limited API
*/
  __pyx_r = __pyx_v_self->cval.real;
  goto __pyx_L0;

  /* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":29
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
 *             return self.cval.imag             # <<<<<<<<<<<<<<
 * 
 *     # PyTypeObject PyComplex_Type
*/
  __pyx_r = __pyx_v_self->cval.imag;
  goto __pyx_L0;

  /* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":121
 *     or None if no such value or default was found.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":122
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)             # <<<<<<<<<<<<<<
 *     if value is NULL:
 *         # context variable does not have a default
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 122, __pyx_L1_error)

  /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
  __pyx_t_2 = (__pyx_v_value == NULL);
  if (__pyx_t_2) {

    /* "cpython/contextvars.pxd":125
 *     if value is NULL:
 *         # context variable does not have a default
 *         pyvalue = default_value             # <<<<<<<<<<<<<<
 *     else:
 *         # value or default value of context variable
*/
    __Pyx_INCREF(__pyx_v_default_value);
    __pyx_v_pyvalue = __pyx_v_default_value;

    /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
    goto __pyx_L3;
  }

  /* "cpython/contextvars.pxd":128
 *     else:
 *         # value or default value of context variable
 *         pyvalue = <object>value             # <<<<<<<<<<<<<<
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_v_value);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_pyvalue = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cpython/contextvars.pxd":129
 *         # value or default value of context variable
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
 * 
*/
    Py_XDECREF(__pyx_v_value);
  }
  __pyx_L3:;

  /* "cpython/contextvars.pxd":130
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value_no_default", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":140
 *     Ignores the default value of the context variable, if any.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":141
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)             # <<<<<<<<<<<<<<
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 141, __pyx_L1_error)

  /* "cpython/contextvars.pxd":143
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value             # <<<<<<<<<<<<<<
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_value);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pyvalue = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cpython/contextvars.pxd":144
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
*/
  Py_XDECREF(__pyx_v_value);

  /* "cpython/contextvars.pxd":145
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "amplpy/util.pxi":10
 * from libcpp cimport bool
 * 
 * cdef void PY_AMPL_CALL(campl.AMPL_ERRORINFO* errorinfo) except *:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORCODE rc
 *     cdef char* message
*/

static void __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ERRORINFO *__pyx_v_errorinfo) {
  AMPL_ERRORCODE __pyx_v_rc;
  char *__pyx_v_message;
  char *__pyx_v_source;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PY_AMPL_CALL", 0);

  /* "amplpy/util.pxi":14
 *     cdef char* message
 *     cdef char* source
 *     if errorinfo:             # <<<<<<<<<<<<<<
 *         rc = campl.AMPL_ErrorInfoGetError(errorinfo)
 *         if rc == campl.AMPL_INFEASIBILITY_EXCEPTION:
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/util.pxi":15
 *     cdef char* source
 *     if errorinfo:
 *         rc = campl.AMPL_ErrorInfoGetError(errorinfo)             # <<<<<<<<<<<<<<
 *         if rc == campl.AMPL_INFEASIBILITY_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
    __pyx_v_rc = AMPL_ErrorInfoGetError(__pyx_v_errorinfo);

    /* "amplpy/util.pxi":16
 *     if errorinfo:
 *         rc = campl.AMPL_ErrorInfoGetError(errorinfo)
 *         if rc == campl.AMPL_INFEASIBILITY_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise InfeasibilityException("InfeasibilityException: " + message.decode('utf-8'))
*/
    switch (__pyx_v_rc) {
      case AMPL_INFEASIBILITY_EXCEPTION:

      /* "amplpy/util.pxi":17
 *         rc = campl.AMPL_ErrorInfoGetError(errorinfo)
 *         if rc == campl.AMPL_INFEASIBILITY_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise InfeasibilityException("InfeasibilityException: " + message.decode('utf-8'))
 *         elif rc == campl.AMPL_PRESOLVE_EXCEPTION:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":18
 *         if rc == campl.AMPL_INFEASIBILITY_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise InfeasibilityException("InfeasibilityException: " + message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_PRESOLVE_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_InfeasibilityException); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 18, __pyx_L1_error)
      __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_InfeasibilityException_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 18, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 18, __pyx_L1_error)

      /* "amplpy/util.pxi":16
 *     if errorinfo:
 *         rc = campl.AMPL_ErrorInfoGetError(errorinfo)
 *         if rc == campl.AMPL_INFEASIBILITY_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise InfeasibilityException("InfeasibilityException: " + message.decode('utf-8'))
*/
      break;
      case AMPL_PRESOLVE_EXCEPTION:

      /* "amplpy/util.pxi":20
 *             raise InfeasibilityException("InfeasibilityException: " + message.decode('utf-8'))
 *         elif rc == campl.AMPL_PRESOLVE_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise PresolveException("PresolveException: " + message.decode('utf-8'))
 *         elif rc == campl.AMPL_LICENSE_EXCEPTION:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":21
 *         elif rc == campl.AMPL_PRESOLVE_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise PresolveException("PresolveException: " + message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_LICENSE_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_PresolveException); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 21, __pyx_L1_error)
      __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_PresolveException_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 21, __pyx_L1_error)

      /* "amplpy/util.pxi":19
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise InfeasibilityException("InfeasibilityException: " + message.decode('utf-8'))
 *         elif rc == campl.AMPL_PRESOLVE_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise PresolveException("PresolveException: " + message.decode('utf-8'))
*/
      break;
      case AMPL_LICENSE_EXCEPTION:

      /* "amplpy/util.pxi":23
 *             raise PresolveException("PresolveException: " + message.decode('utf-8'))
 *         elif rc == campl.AMPL_LICENSE_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise SystemError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_FILE_IO_EXCEPTION:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":24
 *         elif rc == campl.AMPL_LICENSE_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise SystemError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_FILE_IO_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_SystemError);
      __pyx_t_6 = __pyx_builtin_SystemError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 24, __pyx_L1_error)
      __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 24, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 24, __pyx_L1_error)

      /* "amplpy/util.pxi":22
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise PresolveException("PresolveException: " + message.decode('utf-8'))
 *         elif rc == campl.AMPL_LICENSE_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise SystemError(message.decode('utf-8'))
*/
      break;
      case AMPL_FILE_IO_EXCEPTION:

      /* "amplpy/util.pxi":26
 *             raise SystemError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_FILE_IO_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise IOError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_UNSUPPORTED_OPERATION_EXCEPTION:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":27
 *         elif rc == campl.AMPL_FILE_IO_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise IOError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_UNSUPPORTED_OPERATION_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_4 = __pyx_builtin_IOError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 27, __pyx_L1_error)
      __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 27, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 27, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 27, __pyx_L1_error)

      /* "amplpy/util.pxi":25
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise SystemError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_FILE_IO_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise IOError(message.decode('utf-8'))
*/
      break;
      case AMPL_UNSUPPORTED_OPERATION_EXCEPTION:

      /* "amplpy/util.pxi":29
 *             raise IOError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_UNSUPPORTED_OPERATION_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise TypeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_INVALID_SUBSCRIPT_EXCEPTION:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":30
 *         elif rc == campl.AMPL_UNSUPPORTED_OPERATION_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise TypeError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_INVALID_SUBSCRIPT_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_7 = __pyx_builtin_TypeError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 30, __pyx_L1_error)
      __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 30, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 30, __pyx_L1_error)

      /* "amplpy/util.pxi":28
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise IOError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_UNSUPPORTED_OPERATION_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise TypeError(message.decode('utf-8'))
*/
      break;
      case AMPL_INVALID_SUBSCRIPT_EXCEPTION:

      /* "amplpy/util.pxi":32
 *             raise TypeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_INVALID_SUBSCRIPT_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":33
 *         elif rc == campl.AMPL_INVALID_SUBSCRIPT_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)             # <<<<<<<<<<<<<<
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
 *                                           message.decode('utf-8'))
*/
      __pyx_v_source = AMPL_ErrorInfoGetSource(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":34
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),             # <<<<<<<<<<<<<<
 *                                           message.decode('utf-8'))
 *         elif rc == campl.AMPL_SYNTAX_ERROR_EXCEPTION:
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException);
      __pyx_t_6 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException); 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_source); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 34, __pyx_L1_error)
      __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_source, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 34, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyLong_From_int(AMPL_ErrorInfoGetLine(__pyx_v_errorinfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 34, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_PyLong_From_int(AMPL_ErrorInfoGetOffset(__pyx_v_errorinfo)); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 34, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "amplpy/util.pxi":35
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
 *                                           message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_SYNTAX_ERROR_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 35, __pyx_L1_error)
      __pyx_t_10 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 35, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[5] = {__pyx_t_7, __pyx_t_4, __pyx_t_3, __pyx_t_9, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_8, (5-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 34, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
      __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 34, __pyx_L1_error)

      /* "amplpy/util.pxi":31
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise TypeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_INVALID_SUBSCRIPT_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
*/
      break;
      case AMPL_SYNTAX_ERROR_EXCEPTION:

      /* "amplpy/util.pxi":37
 *                                           message.decode('utf-8'))
 *         elif rc == campl.AMPL_SYNTAX_ERROR_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":38
 *         elif rc == campl.AMPL_SYNTAX_ERROR_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)             # <<<<<<<<<<<<<<
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
 *                                      message.decode('utf-8'))
*/
      __pyx_v_source = AMPL_ErrorInfoGetSource(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":39
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),             # <<<<<<<<<<<<<<
 *                                      message.decode('utf-8'))
 *         elif rc == campl.AMPL_NO_DATA_EXCEPTION:
*/
      __pyx_t_6 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException);
      __pyx_t_10 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException); 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_source); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 39, __pyx_L1_error)
      __pyx_t_9 = __Pyx_decode_c_string(__pyx_v_source, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 39, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = __Pyx_PyLong_From_int(AMPL_ErrorInfoGetLine(__pyx_v_errorinfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 39, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyLong_From_int(AMPL_ErrorInfoGetOffset(__pyx_v_errorinfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 39, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "amplpy/util.pxi":40
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
 *                                      message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_NO_DATA_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 40, __pyx_L1_error)
      __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 40, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[5] = {__pyx_t_6, __pyx_t_9, __pyx_t_3, __pyx_t_4, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_8, (5-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 39, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0);
      __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 39, __pyx_L1_error)

      /* "amplpy/util.pxi":36
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
 *                                           message.decode('utf-8'))
 *         elif rc == campl.AMPL_SYNTAX_ERROR_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             source = campl.AMPL_ErrorInfoGetSource(errorinfo)
*/
      break;
      case AMPL_NO_DATA_EXCEPTION:

      /* "amplpy/util.pxi":42
 *                                      message.decode('utf-8'))
 *         elif rc == campl.AMPL_NO_DATA_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_EXCEPTION:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":43
 *         elif rc == campl.AMPL_NO_DATA_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_builtin_RuntimeError);
      __pyx_t_7 = __pyx_builtin_RuntimeError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 43, __pyx_L1_error)
      __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 43, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 43, __pyx_L1_error)

      /* "amplpy/util.pxi":41
 *             raise AMPLException(source.decode('utf-8'), campl.AMPL_ErrorInfoGetLine(errorinfo), campl.AMPL_ErrorInfoGetOffset(errorinfo),
 *                                      message.decode('utf-8'))
 *         elif rc == campl.AMPL_NO_DATA_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))
*/
      break;
      case AMPL_EXCEPTION:

      /* "amplpy/util.pxi":45
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_RUNTIME_ERROR:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":46
 *         elif rc == campl.AMPL_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_RUNTIME_ERROR:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_RuntimeError);
      __pyx_t_4 = __pyx_builtin_RuntimeError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 46, __pyx_L1_error)
      __pyx_t_10 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 46, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 46, __pyx_L1_error)

      /* "amplpy/util.pxi":44
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))
*/
      break;
      case AMPL_RUNTIME_ERROR:

      /* "amplpy/util.pxi":48
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_RUNTIME_ERROR:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_LOGIC_ERROR:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":49
 *         elif rc == campl.AMPL_RUNTIME_ERROR:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_LOGIC_ERROR:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_RuntimeError);
      __pyx_t_10 = __pyx_builtin_RuntimeError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 49, __pyx_L1_error)
      __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 49, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 49, __pyx_L1_error)

      /* "amplpy/util.pxi":47
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_RUNTIME_ERROR:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))
*/
      break;
      case AMPL_LOGIC_ERROR:

      /* "amplpy/util.pxi":51
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_LOGIC_ERROR:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise TypeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_OUT_OF_RANGE:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":52
 *         elif rc == campl.AMPL_LOGIC_ERROR:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise TypeError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_OUT_OF_RANGE:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_7 = __pyx_builtin_TypeError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 52, __pyx_L1_error)
      __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 52, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 52, __pyx_L1_error)

      /* "amplpy/util.pxi":50
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_LOGIC_ERROR:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise TypeError(message.decode('utf-8'))
*/
      break;
      case AMPL_OUT_OF_RANGE:

      /* "amplpy/util.pxi":54
 *             raise TypeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_OUT_OF_RANGE:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise KeyError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_INVALID_ARGUMENT:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":55
 *         elif rc == campl.AMPL_OUT_OF_RANGE:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise KeyError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_INVALID_ARGUMENT:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_4 = __pyx_builtin_KeyError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 55, __pyx_L1_error)
      __pyx_t_10 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 55, __pyx_L1_error)

      /* "amplpy/util.pxi":53
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise TypeError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_OUT_OF_RANGE:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise KeyError(message.decode('utf-8'))
*/
      break;
      case AMPL_INVALID_ARGUMENT:

      /* "amplpy/util.pxi":57
 *             raise KeyError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_INVALID_ARGUMENT:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise ValueError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_STD_EXCEPTION:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":58
 *         elif rc == campl.AMPL_INVALID_ARGUMENT:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise ValueError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         elif rc == campl.AMPL_STD_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_10 = __pyx_builtin_ValueError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 58, __pyx_L1_error)
      __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 58, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 58, __pyx_L1_error)

      /* "amplpy/util.pxi":56
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise KeyError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_INVALID_ARGUMENT:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise ValueError(message.decode('utf-8'))
*/
      break;
      case AMPL_STD_EXCEPTION:

      /* "amplpy/util.pxi":60
 *             raise ValueError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_STD_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)             # <<<<<<<<<<<<<<
 *             raise RuntimeError(message.decode('utf-8'))
 *         else:
*/
      __pyx_v_message = AMPL_ErrorInfoGetMessage(__pyx_v_errorinfo);

      /* "amplpy/util.pxi":61
 *         elif rc == campl.AMPL_STD_EXCEPTION:
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         else:
 *             raise RuntimeError("Unknown exception")
*/
      __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_builtin_RuntimeError);
      __pyx_t_7 = __pyx_builtin_RuntimeError; 
      __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 61, __pyx_L1_error)
      __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 61, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 61, __pyx_L1_error)

      /* "amplpy/util.pxi":59
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise ValueError(message.decode('utf-8'))
 *         elif rc == campl.AMPL_STD_EXCEPTION:             # <<<<<<<<<<<<<<
 *             message = campl.AMPL_ErrorInfoGetMessage(errorinfo)
 *             raise RuntimeError(message.decode('utf-8'))
*/
      break;
      default:

      /* "amplpy/util.pxi":63
 *             raise RuntimeError(message.decode('utf-8'))
 *         else:
 *             raise RuntimeError("Unknown exception")             # <<<<<<<<<<<<<<
 * 
 * cdef campl.AMPL_ERRORINFO* setValues(campl.AMPL* ampl, char* name, campl.AMPL_TUPLE* index, values, size_t size):
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_RuntimeError);
      __pyx_t_4 = __pyx_builtin_RuntimeError; 
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Unknown_exception};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 63, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 63, __pyx_L1_error)
      break;
    }

    /* "amplpy/util.pxi":14
 *     cdef char* message
 *     cdef char* source
 *     if errorinfo:             # <<<<<<<<<<<<<<
 *         rc = campl.AMPL_ErrorInfoGetError(errorinfo)
 *         if rc == campl.AMPL_INFEASIBILITY_EXCEPTION:
*/
  }

  /* "amplpy/util.pxi":10
 * from libcpp cimport bool
 * 
 * cdef void PY_AMPL_CALL(campl.AMPL_ERRORINFO* errorinfo) except *:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORCODE rc
 *     cdef char* message
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("amplpy.ampl.PY_AMPL_CALL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "amplpy/util.pxi":65
 *             raise RuntimeError("Unknown exception")
 * 
 * cdef campl.AMPL_ERRORINFO* setValues(campl.AMPL* ampl, char* name, campl.AMPL_TUPLE* index, values, size_t size):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef campl.AMPL_TUPLE** values_c
*/

static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValues(AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_values, size_t __pyx_v_size) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_TUPLE **__pyx_v_values_c;
  size_t __pyx_v_i;
  AMPL_ERRORINFO *__pyx_r;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  AMPL_TUPLE *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setValues", 0);

  /* "amplpy/util.pxi":69
 *     cdef campl.AMPL_TUPLE** values_c
 *     cdef size_t i
 *     values_c = <campl.AMPL_TUPLE**>malloc(size * sizeof(campl.AMPL_TUPLE*))             # <<<<<<<<<<<<<<
 * 
 *     for i in range(size):
*/
  __pyx_v_values_c = ((AMPL_TUPLE **)malloc((__pyx_v_size * (sizeof(AMPL_TUPLE *)))));

  /* "amplpy/util.pxi":71
 *     values_c = <campl.AMPL_TUPLE**>malloc(size * sizeof(campl.AMPL_TUPLE*))
 * 
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         values_c[i] = to_c_tuple(values[i])
 * 
*/
  __pyx_t_1 = __pyx_v_size;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "amplpy/util.pxi":72
 * 
 *     for i in range(size):
 *         values_c[i] = to_c_tuple(values[i])             # <<<<<<<<<<<<<<
 * 
 *     errorinfo = campl.AMPL_SetInstanceSetValuesTuples(ampl, name, index, values_c, size)
*/
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_t_4); if (unlikely(__pyx_t_5 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(4, 72, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_values_c[__pyx_v_i]) = __pyx_t_5;
  }

  /* "amplpy/util.pxi":74
 *         values_c[i] = to_c_tuple(values[i])
 * 
 *     errorinfo = campl.AMPL_SetInstanceSetValuesTuples(ampl, name, index, values_c, size)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(size):
*/
  __pyx_v_errorinfo = AMPL_SetInstanceSetValuesTuples(__pyx_v_ampl, __pyx_v_name, __pyx_v_index, __pyx_v_values_c, __pyx_v_size);

  /* "amplpy/util.pxi":76
 *     errorinfo = campl.AMPL_SetInstanceSetValuesTuples(ampl, name, index, values_c, size)
 * 
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         campl.AMPL_TupleFree(&values_c[i])
 *     free(values_c)
*/
  __pyx_t_1 = __pyx_v_size;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "amplpy/util.pxi":77
 * 
 *     for i in range(size):
 *         campl.AMPL_TupleFree(&values_c[i])             # <<<<<<<<<<<<<<
 *     free(values_c)
 * 
*/
    (void)(AMPL_TupleFree((&(__pyx_v_values_c[__pyx_v_i]))));
  }

  /* "amplpy/util.pxi":78
 *     for i in range(size):
 *         campl.AMPL_TupleFree(&values_c[i])
 *     free(values_c)             # <<<<<<<<<<<<<<
 * 
 *     return errorinfo
*/
  free(__pyx_v_values_c);

  /* "amplpy/util.pxi":80
 *     free(values_c)
 * 
 *     return errorinfo             # <<<<<<<<<<<<<<
 * 
 * cdef to_py_variant(campl.AMPL_VARIANT* variant):
*/
  __pyx_r = __pyx_v_errorinfo;
  goto __pyx_L0;

  /* "amplpy/util.pxi":65
 *             raise RuntimeError("Unknown exception")
 * 
 * cdef campl.AMPL_ERRORINFO* setValues(campl.AMPL* ampl, char* name, campl.AMPL_TUPLE* index, values, size_t size):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef campl.AMPL_TUPLE** values_c
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.setValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":82
 *     return errorinfo
 * 
 * cdef to_py_variant(campl.AMPL_VARIANT* variant):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_TYPE type
 *     cdef char* value_c
*/

static PyObject *__pyx_f_6amplpy_4ampl_to_py_variant(AMPL_VARIANT *__pyx_v_variant) {
  AMPL_TYPE __pyx_v_type;
  char *__pyx_v_value_c;
  double __pyx_v_real_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_py_variant", 0);

  /* "amplpy/util.pxi":86
 *     cdef char* value_c
 *     cdef double real_c
 *     campl.AMPL_VariantGetType(variant, &type)             # <<<<<<<<<<<<<<
 *     if type == campl.AMPL_STRING:
 *         campl.AMPL_VariantGetStringValue(variant, &value_c)
*/
  (void)(AMPL_VariantGetType(__pyx_v_variant, (&__pyx_v_type)));

  /* "amplpy/util.pxi":87
 *     cdef double real_c
 *     campl.AMPL_VariantGetType(variant, &type)
 *     if type == campl.AMPL_STRING:             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantGetStringValue(variant, &value_c)
 *         return value_c.decode('utf-8')
*/
  switch (__pyx_v_type) {
    case AMPL_STRING:

    /* "amplpy/util.pxi":88
 *     campl.AMPL_VariantGetType(variant, &type)
 *     if type == campl.AMPL_STRING:
 *         campl.AMPL_VariantGetStringValue(variant, &value_c)             # <<<<<<<<<<<<<<
 *         return value_c.decode('utf-8')
 *     elif type == campl.AMPL_NUMERIC:
*/
    (void)(AMPL_VariantGetStringValue(__pyx_v_variant, (&__pyx_v_value_c)));

    /* "amplpy/util.pxi":89
 *     if type == campl.AMPL_STRING:
 *         campl.AMPL_VariantGetStringValue(variant, &value_c)
 *         return value_c.decode('utf-8')             # <<<<<<<<<<<<<<
 *     elif type == campl.AMPL_NUMERIC:
 *         campl.AMPL_VariantGetNumericValue(variant, &real_c)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 89, __pyx_L1_error)
    __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_1, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "amplpy/util.pxi":87
 *     cdef double real_c
 *     campl.AMPL_VariantGetType(variant, &type)
 *     if type == campl.AMPL_STRING:             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantGetStringValue(variant, &value_c)
 *         return value_c.decode('utf-8')
*/
    break;
    case AMPL_NUMERIC:

    /* "amplpy/util.pxi":91
 *         return value_c.decode('utf-8')
 *     elif type == campl.AMPL_NUMERIC:
 *         campl.AMPL_VariantGetNumericValue(variant, &real_c)             # <<<<<<<<<<<<<<
 *         if real_c % 1 == 0:
 *             return int(real_c)
*/
    (void)(AMPL_VariantGetNumericValue(__pyx_v_variant, (&__pyx_v_real_c)));

    /* "amplpy/util.pxi":92
 *     elif type == campl.AMPL_NUMERIC:
 *         campl.AMPL_VariantGetNumericValue(variant, &real_c)
 *         if real_c % 1 == 0:             # <<<<<<<<<<<<<<
 *             return int(real_c)
 *         else:
*/
    __pyx_t_3 = (__Pyx_mod_double(__pyx_v_real_c, 1.0, 1) == 0.0);
    if (__pyx_t_3) {

      /* "amplpy/util.pxi":93
 *         campl.AMPL_VariantGetNumericValue(variant, &real_c)
 *         if real_c % 1 == 0:
 *             return int(real_c)             # <<<<<<<<<<<<<<
 *         else:
 *             return real_c
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyLong_FromDouble(__pyx_v_real_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 93, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "amplpy/util.pxi":92
 *     elif type == campl.AMPL_NUMERIC:
 *         campl.AMPL_VariantGetNumericValue(variant, &real_c)
 *         if real_c % 1 == 0:             # <<<<<<<<<<<<<<
 *             return int(real_c)
 *         else:
*/
    }

    /* "amplpy/util.pxi":95
 *             return int(real_c)
 *         else:
 *             return real_c             # <<<<<<<<<<<<<<
 *     else:
 *         return None
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_real_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 95, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "amplpy/util.pxi":90
 *         campl.AMPL_VariantGetStringValue(variant, &value_c)
 *         return value_c.decode('utf-8')
 *     elif type == campl.AMPL_NUMERIC:             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantGetNumericValue(variant, &real_c)
 *         if real_c % 1 == 0:
*/
    break;
    default:

    /* "amplpy/util.pxi":97
 *             return real_c
 *     else:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef to_py_tuple(campl.AMPL_TUPLE* tuple_c):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    break;
  }

  /* "amplpy/util.pxi":82
 *     return errorinfo
 * 
 * cdef to_py_variant(campl.AMPL_VARIANT* variant):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_TYPE type
 *     cdef char* value_c
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.to_py_variant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":99
 *         return None
 * 
 * cdef to_py_tuple(campl.AMPL_TUPLE* tuple_c):             # <<<<<<<<<<<<<<
 *     cdef size_t size
 *     cdef campl.AMPL_VARIANT** variants
*/

static PyObject *__pyx_f_6amplpy_4ampl_to_py_tuple(AMPL_TUPLE *__pyx_v_tuple_c) {
  size_t __pyx_v_size;
  AMPL_VARIANT **__pyx_v_variants;
  PyObject *__pyx_v_pylist = 0;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_py_tuple", 0);

  /* "amplpy/util.pxi":102
 *     cdef size_t size
 *     cdef campl.AMPL_VARIANT** variants
 *     cdef list pylist = []             # <<<<<<<<<<<<<<
 *     campl.AMPL_TupleGetSize(tuple_c, &size)
 *     campl.AMPL_TupleGetVariantPtr(tuple_c, &variants)
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylist = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/util.pxi":103
 *     cdef campl.AMPL_VARIANT** variants
 *     cdef list pylist = []
 *     campl.AMPL_TupleGetSize(tuple_c, &size)             # <<<<<<<<<<<<<<
 *     campl.AMPL_TupleGetVariantPtr(tuple_c, &variants)
 *     for i in range(size):
*/
  (void)(AMPL_TupleGetSize(__pyx_v_tuple_c, (&__pyx_v_size)));

  /* "amplpy/util.pxi":104
 *     cdef list pylist = []
 *     campl.AMPL_TupleGetSize(tuple_c, &size)
 *     campl.AMPL_TupleGetVariantPtr(tuple_c, &variants)             # <<<<<<<<<<<<<<
 *     for i in range(size):
 *         pylist.append(to_py_variant(variants[i]))
*/
  (void)(AMPL_TupleGetVariantPtr(__pyx_v_tuple_c, (&__pyx_v_variants)));

  /* "amplpy/util.pxi":105
 *     campl.AMPL_TupleGetSize(tuple_c, &size)
 *     campl.AMPL_TupleGetVariantPtr(tuple_c, &variants)
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         pylist.append(to_py_variant(variants[i]))
 *     return tuple(pylist)
*/
  __pyx_t_2 = __pyx_v_size;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "amplpy/util.pxi":106
 *     campl.AMPL_TupleGetVariantPtr(tuple_c, &variants)
 *     for i in range(size):
 *         pylist.append(to_py_variant(variants[i]))             # <<<<<<<<<<<<<<
 *     return tuple(pylist)
 * 
*/
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_to_py_variant((__pyx_v_variants[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_pylist, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 106, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "amplpy/util.pxi":107
 *     for i in range(size):
 *         pylist.append(to_py_variant(variants[i]))
 *     return tuple(pylist)             # <<<<<<<<<<<<<<
 * 
 * cdef campl.AMPL_TUPLE* to_c_tuple(py_tuple):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_AsTuple(__pyx_v_pylist); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/util.pxi":99
 *         return None
 * 
 * cdef to_py_tuple(campl.AMPL_TUPLE* tuple_c):             # <<<<<<<<<<<<<<
 *     cdef size_t size
 *     cdef campl.AMPL_VARIANT** variants
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.to_py_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":109
 *     return tuple(pylist)
 * 
 * cdef campl.AMPL_TUPLE* to_c_tuple(py_tuple):             # <<<<<<<<<<<<<<
 *     cdef size_t i
 *     cdef campl.AMPL_TUPLE* tuple_c
*/

static AMPL_TUPLE *__pyx_f_6amplpy_4ampl_to_c_tuple(PyObject *__pyx_v_py_tuple) {
  size_t __pyx_v_i;
  AMPL_TUPLE *__pyx_v_tuple_c;
  size_t __pyx_v_size;
  AMPL_VARIANT **__pyx_v_variants;
  AMPL_TUPLE *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  AMPL_VARIANT *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_c_tuple", 0);
  __Pyx_INCREF(__pyx_v_py_tuple);

  /* "amplpy/util.pxi":113
 *     cdef campl.AMPL_TUPLE* tuple_c
 * 
 *     if not isinstance(py_tuple, (tuple, list)):             # <<<<<<<<<<<<<<
 *         py_tuple = [py_tuple]
 * 
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_py_tuple); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyList_Check(__pyx_v_py_tuple); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "amplpy/util.pxi":114
 * 
 *     if not isinstance(py_tuple, (tuple, list)):
 *         py_tuple = [py_tuple]             # <<<<<<<<<<<<<<
 * 
 *     cdef size_t size = len(py_tuple)
*/
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_py_tuple);
    __Pyx_GIVEREF(__pyx_v_py_tuple);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_py_tuple) != (0)) __PYX_ERR(4, 114, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_py_tuple, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "amplpy/util.pxi":113
 *     cdef campl.AMPL_TUPLE* tuple_c
 * 
 *     if not isinstance(py_tuple, (tuple, list)):             # <<<<<<<<<<<<<<
 *         py_tuple = [py_tuple]
 * 
*/
  }

  /* "amplpy/util.pxi":116
 *         py_tuple = [py_tuple]
 * 
 *     cdef size_t size = len(py_tuple)             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_VARIANT** variants = <campl.AMPL_VARIANT**> malloc(size * sizeof(campl.AMPL_VARIANT*))
 * 
*/
  __pyx_t_4 = PyObject_Length(__pyx_v_py_tuple); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 116, __pyx_L1_error)
  __pyx_v_size = __pyx_t_4;

  /* "amplpy/util.pxi":117
 * 
 *     cdef size_t size = len(py_tuple)
 *     cdef campl.AMPL_VARIANT** variants = <campl.AMPL_VARIANT**> malloc(size * sizeof(campl.AMPL_VARIANT*))             # <<<<<<<<<<<<<<
 * 
 *     for i in range(size):
*/
  __pyx_v_variants = ((AMPL_VARIANT **)malloc((__pyx_v_size * (sizeof(AMPL_VARIANT *)))));

  /* "amplpy/util.pxi":119
 *     cdef campl.AMPL_VARIANT** variants = <campl.AMPL_VARIANT**> malloc(size * sizeof(campl.AMPL_VARIANT*))
 * 
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         variants[i] = to_c_variant(py_tuple[i])
 * 
*/
  __pyx_t_5 = __pyx_v_size;
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "amplpy/util.pxi":120
 * 
 *     for i in range(size):
 *         variants[i] = to_c_variant(py_tuple[i])             # <<<<<<<<<<<<<<
 * 
 *     campl.AMPL_TupleCreate(&tuple_c, size, variants)
*/
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_py_tuple, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_f_6amplpy_4ampl_to_c_variant(__pyx_t_3); if (unlikely(__pyx_t_8 == ((AMPL_VARIANT *)0) && PyErr_Occurred())) __PYX_ERR(4, 120, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_variants[__pyx_v_i]) = __pyx_t_8;
  }

  /* "amplpy/util.pxi":122
 *         variants[i] = to_c_variant(py_tuple[i])
 * 
 *     campl.AMPL_TupleCreate(&tuple_c, size, variants)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(size):
*/
  (void)(AMPL_TupleCreate((&__pyx_v_tuple_c), __pyx_v_size, __pyx_v_variants));

  /* "amplpy/util.pxi":124
 *     campl.AMPL_TupleCreate(&tuple_c, size, variants)
 * 
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantFree(&variants[i])
 * 
*/
  __pyx_t_5 = __pyx_v_size;
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "amplpy/util.pxi":125
 * 
 *     for i in range(size):
 *         campl.AMPL_VariantFree(&variants[i])             # <<<<<<<<<<<<<<
 * 
 *     free(variants)
*/
    (void)(AMPL_VariantFree((&(__pyx_v_variants[__pyx_v_i]))));
  }

  /* "amplpy/util.pxi":127
 *         campl.AMPL_VariantFree(&variants[i])
 * 
 *     free(variants)             # <<<<<<<<<<<<<<
 *     return tuple_c
 * 
*/
  free(__pyx_v_variants);

  /* "amplpy/util.pxi":128
 * 
 *     free(variants)
 *     return tuple_c             # <<<<<<<<<<<<<<
 * 
 * cdef campl.AMPL_VARIANT* to_c_variant(value)  except *:
*/
  __pyx_r = __pyx_v_tuple_c;
  goto __pyx_L0;

  /* "amplpy/util.pxi":109
 *     return tuple(pylist)
 * 
 * cdef campl.AMPL_TUPLE* to_c_tuple(py_tuple):             # <<<<<<<<<<<<<<
 *     cdef size_t i
 *     cdef campl.AMPL_TUPLE* tuple_c
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.to_c_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_tuple);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":130
 *     return tuple_c
 * 
 * cdef campl.AMPL_VARIANT* to_c_variant(value)  except *:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_VARIANT* variant
 *     if isinstance(value, str):
*/

static AMPL_VARIANT *__pyx_f_6amplpy_4ampl_to_c_variant(PyObject *__pyx_v_value) {
  AMPL_VARIANT *__pyx_v_variant;
  AMPL_VARIANT *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  char const *__pyx_t_5;
  double __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_c_variant", 0);

  /* "amplpy/util.pxi":132
 * cdef campl.AMPL_VARIANT* to_c_variant(value)  except *:
 *     cdef campl.AMPL_VARIANT* variant
 *     if isinstance(value, str):             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantCreateString(&variant, value.encode('utf-8'))
 *     elif isinstance(value, Real):
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "amplpy/util.pxi":133
 *     cdef campl.AMPL_VARIANT* variant
 *     if isinstance(value, str):
 *         campl.AMPL_VariantCreateString(&variant, value.encode('utf-8'))             # <<<<<<<<<<<<<<
 *     elif isinstance(value, Real):
 *         campl.AMPL_VariantCreateNumeric(&variant, value)
*/
    __pyx_t_3 = __pyx_v_value;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(4, 133, __pyx_L1_error)
    (void)(AMPL_VariantCreateString((&__pyx_v_variant), __pyx_t_5));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/util.pxi":132
 * cdef campl.AMPL_VARIANT* to_c_variant(value)  except *:
 *     cdef campl.AMPL_VARIANT* variant
 *     if isinstance(value, str):             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantCreateString(&variant, value.encode('utf-8'))
 *     elif isinstance(value, Real):
*/
    goto __pyx_L3;
  }

  /* "amplpy/util.pxi":134
 *     if isinstance(value, str):
 *         campl.AMPL_VariantCreateString(&variant, value.encode('utf-8'))
 *     elif isinstance(value, Real):             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantCreateNumeric(&variant, value)
 *     elif value is None:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_value, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "amplpy/util.pxi":135
 *         campl.AMPL_VariantCreateString(&variant, value.encode('utf-8'))
 *     elif isinstance(value, Real):
 *         campl.AMPL_VariantCreateNumeric(&variant, value)             # <<<<<<<<<<<<<<
 *     elif value is None:
 *         campl.AMPL_VariantCreateEmpty(&variant)
*/
    __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(4, 135, __pyx_L1_error)
    (void)(AMPL_VariantCreateNumeric((&__pyx_v_variant), __pyx_t_6));

    /* "amplpy/util.pxi":134
 *     if isinstance(value, str):
 *         campl.AMPL_VariantCreateString(&variant, value.encode('utf-8'))
 *     elif isinstance(value, Real):             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantCreateNumeric(&variant, value)
 *     elif value is None:
*/
    goto __pyx_L3;
  }

  /* "amplpy/util.pxi":136
 *     elif isinstance(value, Real):
 *         campl.AMPL_VariantCreateNumeric(&variant, value)
 *     elif value is None:             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantCreateEmpty(&variant)
 *     else:
*/
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (likely(__pyx_t_1)) {

    /* "amplpy/util.pxi":137
 *         campl.AMPL_VariantCreateNumeric(&variant, value)
 *     elif value is None:
 *         campl.AMPL_VariantCreateEmpty(&variant)             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError(f"unsupported type {type(value)}")
*/
    (void)(AMPL_VariantCreateEmpty((&__pyx_v_variant)));

    /* "amplpy/util.pxi":136
 *     elif isinstance(value, Real):
 *         campl.AMPL_VariantCreateNumeric(&variant, value)
 *     elif value is None:             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantCreateEmpty(&variant)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/util.pxi":139
 *         campl.AMPL_VariantCreateEmpty(&variant)
 *     else:
 *         raise ValueError(f"unsupported type {type(value)}")             # <<<<<<<<<<<<<<
 *     return variant
 * 
*/
  /*else*/ {
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_7 = __pyx_builtin_ValueError; 
    __pyx_t_8 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_unsupported_type, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_9};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 139, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "amplpy/util.pxi":140
 *     else:
 *         raise ValueError(f"unsupported type {type(value)}")
 *     return variant             # <<<<<<<<<<<<<<
 * 
 * cdef create_entity(campl.AMPL_ENTITYTYPE entity_class, AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
*/
  __pyx_r = __pyx_v_variant;
  goto __pyx_L0;

  /* "amplpy/util.pxi":130
 *     return tuple_c
 * 
 * cdef campl.AMPL_VARIANT* to_c_variant(value)  except *:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_VARIANT* variant
 *     if isinstance(value, str):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("amplpy.ampl.to_c_variant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":142
 *     return variant
 * 
 * cdef create_entity(campl.AMPL_ENTITYTYPE entity_class, AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):             # <<<<<<<<<<<<<<
 *     if entity_class == campl.AMPL_VARIABLE:
 *         return Variable.create(ampl, name, index, parent)
*/

static PyObject *__pyx_f_6amplpy_4ampl_create_entity(AMPL_ENTITYTYPE __pyx_v_entity_class, struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_entity", 0);

  /* "amplpy/util.pxi":143
 * 
 * cdef create_entity(campl.AMPL_ENTITYTYPE entity_class, AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *     if entity_class == campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *         return Variable.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_CONSTRAINT:
*/
  switch (__pyx_v_entity_class) {
    case AMPL_VARIABLE:

    /* "amplpy/util.pxi":144
 * cdef create_entity(campl.AMPL_ENTITYTYPE entity_class, AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *     if entity_class == campl.AMPL_VARIABLE:
 *         return Variable.create(ampl, name, index, parent)             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_CONSTRAINT:
 *         return Constraint.create(ampl, name, index, parent)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_8Variable_create(__pyx_v_ampl, __pyx_v_name, __pyx_v_index, __pyx_v_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/util.pxi":143
 * 
 * cdef create_entity(campl.AMPL_ENTITYTYPE entity_class, AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *     if entity_class == campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *         return Variable.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_CONSTRAINT:
*/
    break;
    case AMPL_CONSTRAINT:

    /* "amplpy/util.pxi":146
 *         return Variable.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_CONSTRAINT:
 *         return Constraint.create(ampl, name, index, parent)             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_OBJECTIVE:
 *         return Objective.create(ampl, name, index, parent)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_10Constraint_create(__pyx_v_ampl, __pyx_v_name, __pyx_v_index, __pyx_v_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/util.pxi":145
 *     if entity_class == campl.AMPL_VARIABLE:
 *         return Variable.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_CONSTRAINT:             # <<<<<<<<<<<<<<
 *         return Constraint.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_OBJECTIVE:
*/
    break;
    case AMPL_OBJECTIVE:

    /* "amplpy/util.pxi":148
 *         return Constraint.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_OBJECTIVE:
 *         return Objective.create(ampl, name, index, parent)             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_SET:
 *         return Set.create(ampl, name, index, parent)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_9Objective_create(__pyx_v_ampl, __pyx_v_name, __pyx_v_index, __pyx_v_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/util.pxi":147
 *     elif entity_class == campl.AMPL_CONSTRAINT:
 *         return Constraint.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_OBJECTIVE:             # <<<<<<<<<<<<<<
 *         return Objective.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_SET:
*/
    break;
    case AMPL_SET:

    /* "amplpy/util.pxi":150
 *         return Objective.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_SET:
 *         return Set.create(ampl, name, index, parent)             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_PARAMETER:
 *         return Parameter.create(ampl, name, index, parent)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_3Set_create(__pyx_v_ampl, __pyx_v_name, __pyx_v_index, __pyx_v_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/util.pxi":149
 *     elif entity_class == campl.AMPL_OBJECTIVE:
 *         return Objective.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_SET:             # <<<<<<<<<<<<<<
 *         return Set.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_PARAMETER:
*/
    break;
    case AMPL_PARAMETER:

    /* "amplpy/util.pxi":152
 *         return Set.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_PARAMETER:
 *         return Parameter.create(ampl, name, index, parent)             # <<<<<<<<<<<<<<
 *     else:
 *         return Entity.create(ampl, name, index, parent)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_9Parameter_create(__pyx_v_ampl, __pyx_v_name, __pyx_v_index, __pyx_v_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/util.pxi":151
 *     elif entity_class == campl.AMPL_SET:
 *         return Set.create(ampl, name, index, parent)
 *     elif entity_class == campl.AMPL_PARAMETER:             # <<<<<<<<<<<<<<
 *         return Parameter.create(ampl, name, index, parent)
 *     else:
*/
    break;
    default:

    /* "amplpy/util.pxi":154
 *         return Parameter.create(ampl, name, index, parent)
 *     else:
 *         return Entity.create(ampl, name, index, parent)             # <<<<<<<<<<<<<<
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesParamNum(campl.AMPL* ampl, char* name, values):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_6Entity_create(__pyx_v_ampl, __pyx_v_name, __pyx_v_index, __pyx_v_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
  }

  /* "amplpy/util.pxi":142
 *     return variant
 * 
 * cdef create_entity(campl.AMPL_ENTITYTYPE entity_class, AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):             # <<<<<<<<<<<<<<
 *     if entity_class == campl.AMPL_VARIABLE:
 *         return Variable.create(ampl, name, index, parent)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.create_entity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":156
 *         return Entity.create(ampl, name, index, parent)
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesParamNum(campl.AMPL* ampl, char* name, values):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)
*/

static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValuesParamNum(AMPL *__pyx_v_ampl, char *__pyx_v_name, PyObject *__pyx_v_values) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  size_t __pyx_v_size;
  double *__pyx_v_values_c;
  size_t __pyx_v_i;
  AMPL_ERRORINFO *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setValuesParamNum", 0);

  /* "amplpy/util.pxi":158
 * cdef campl.AMPL_ERRORINFO* setValuesParamNum(campl.AMPL* ampl, char* name, values):
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)             # <<<<<<<<<<<<<<
 *     cdef double* values_c = <double*> malloc(size * sizeof(double))
 *     for i in range(size):
*/
  __pyx_t_1 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 158, __pyx_L1_error)
  __pyx_v_size = __pyx_t_1;

  /* "amplpy/util.pxi":159
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)
 *     cdef double* values_c = <double*> malloc(size * sizeof(double))             # <<<<<<<<<<<<<<
 *     for i in range(size):
 *         values_c[i] = values[i]
*/
  __pyx_v_values_c = ((double *)malloc((__pyx_v_size * (sizeof(double)))));

  /* "amplpy/util.pxi":160
 *     cdef size_t size = len(values)
 *     cdef double* values_c = <double*> malloc(size * sizeof(double))
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         values_c[i] = values[i]
 *     errorinfo = campl.AMPL_ParameterSetArgsDoubleValues(ampl, name, size, values_c)
*/
  __pyx_t_2 = __pyx_v_size;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "amplpy/util.pxi":161
 *     cdef double* values_c = <double*> malloc(size * sizeof(double))
 *     for i in range(size):
 *         values_c[i] = values[i]             # <<<<<<<<<<<<<<
 *     errorinfo = campl.AMPL_ParameterSetArgsDoubleValues(ampl, name, size, values_c)
 *     free(values_c)
*/
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(4, 161, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    (__pyx_v_values_c[__pyx_v_i]) = __pyx_t_6;
  }

  /* "amplpy/util.pxi":162
 *     for i in range(size):
 *         values_c[i] = values[i]
 *     errorinfo = campl.AMPL_ParameterSetArgsDoubleValues(ampl, name, size, values_c)             # <<<<<<<<<<<<<<
 *     free(values_c)
 * 
*/
  __pyx_v_errorinfo = AMPL_ParameterSetArgsDoubleValues(__pyx_v_ampl, __pyx_v_name, __pyx_v_size, __pyx_v_values_c);

  /* "amplpy/util.pxi":163
 *         values_c[i] = values[i]
 *     errorinfo = campl.AMPL_ParameterSetArgsDoubleValues(ampl, name, size, values_c)
 *     free(values_c)             # <<<<<<<<<<<<<<
 * 
 *     return errorinfo
*/
  free(__pyx_v_values_c);

  /* "amplpy/util.pxi":165
 *     free(values_c)
 * 
 *     return errorinfo             # <<<<<<<<<<<<<<
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesParamStr(campl.AMPL* ampl, char* name, values):
*/
  __pyx_r = __pyx_v_errorinfo;
  goto __pyx_L0;

  /* "amplpy/util.pxi":156
 *         return Entity.create(ampl, name, index, parent)
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesParamNum(campl.AMPL* ampl, char* name, values):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.setValuesParamNum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":167
 *     return errorinfo
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesParamStr(campl.AMPL* ampl, char* name, values):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)
*/

static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValuesParamStr(AMPL *__pyx_v_ampl, char *__pyx_v_name, PyObject *__pyx_v_values) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  size_t __pyx_v_size;
  char **__pyx_v_values_c;
  size_t __pyx_v_i;
  AMPL_ERRORINFO *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setValuesParamStr", 0);

  /* "amplpy/util.pxi":169
 * cdef campl.AMPL_ERRORINFO* setValuesParamStr(campl.AMPL* ampl, char* name, values):
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)             # <<<<<<<<<<<<<<
 *     cdef char** values_c = <char**> malloc(size * sizeof(char*))
 *     for i in range(size):
*/
  __pyx_t_1 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 169, __pyx_L1_error)
  __pyx_v_size = __pyx_t_1;

  /* "amplpy/util.pxi":170
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)
 *     cdef char** values_c = <char**> malloc(size * sizeof(char*))             # <<<<<<<<<<<<<<
 *     for i in range(size):
 *         values_c[i] = strdup(values[i].encode('utf-8'))
*/
  __pyx_v_values_c = ((char **)malloc((__pyx_v_size * (sizeof(char *)))));

  /* "amplpy/util.pxi":171
 *     cdef size_t size = len(values)
 *     cdef char** values_c = <char**> malloc(size * sizeof(char*))
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         values_c[i] = strdup(values[i].encode('utf-8'))
 * 
*/
  __pyx_t_2 = __pyx_v_size;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "amplpy/util.pxi":172
 *     cdef char** values_c = <char**> malloc(size * sizeof(char*))
 *     for i in range(size):
 *         values_c[i] = strdup(values[i].encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 *     errorinfo = campl.AMPL_ParameterSetArgsStringValues(ampl, name, size, values_c)
*/
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_5); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(4, 172, __pyx_L1_error)
    (__pyx_v_values_c[__pyx_v_i]) = strdup(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "amplpy/util.pxi":174
 *         values_c[i] = strdup(values[i].encode('utf-8'))
 * 
 *     errorinfo = campl.AMPL_ParameterSetArgsStringValues(ampl, name, size, values_c)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(size):
*/
  __pyx_v_errorinfo = AMPL_ParameterSetArgsStringValues(__pyx_v_ampl, __pyx_v_name, __pyx_v_size, __pyx_v_values_c);

  /* "amplpy/util.pxi":176
 *     errorinfo = campl.AMPL_ParameterSetArgsStringValues(ampl, name, size, values_c)
 * 
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         free(values_c[i])
 *     free(values_c)
*/
  __pyx_t_2 = __pyx_v_size;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "amplpy/util.pxi":177
 * 
 *     for i in range(size):
 *         free(values_c[i])             # <<<<<<<<<<<<<<
 *     free(values_c)
 * 
*/
    free((__pyx_v_values_c[__pyx_v_i]));
  }

  /* "amplpy/util.pxi":178
 *     for i in range(size):
 *         free(values_c[i])
 *     free(values_c)             # <<<<<<<<<<<<<<
 * 
 *     return errorinfo
*/
  free(__pyx_v_values_c);

  /* "amplpy/util.pxi":180
 *     free(values_c)
 * 
 *     return errorinfo             # <<<<<<<<<<<<<<
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesPyDict(campl.AMPL* ampl, char* name, dict dicts) except *:
*/
  __pyx_r = __pyx_v_errorinfo;
  goto __pyx_L0;

  /* "amplpy/util.pxi":167
 *     return errorinfo
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesParamStr(campl.AMPL* ampl, char* name, values):             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t size = len(values)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("amplpy.ampl.setValuesParamStr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":182
 *     return errorinfo
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesPyDict(campl.AMPL* ampl, char* name, dict dicts) except *:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t i
*/

static AMPL_ERRORINFO *__pyx_f_6amplpy_4ampl_setValuesPyDict(AMPL *__pyx_v_ampl, char *__pyx_v_name, PyObject *__pyx_v_dicts) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  size_t __pyx_v_i;
  AMPL_TUPLE **__pyx_v_indices_c;
  char **__pyx_v_values_str_c;
  double *__pyx_v_values_num_c;
  PyObject *__pyx_v_item;
  PyObject *__pyx_v_d_keys = 0;
  PyObject *__pyx_v_d_values = 0;
  size_t __pyx_v_size;
  bool __pyx_v_has_numbers;
  bool __pyx_v_has_strings;
  AMPL_ERRORINFO *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  size_t __pyx_t_7;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9;
  size_t __pyx_t_10;
  int __pyx_t_11;
  AMPL_TUPLE *__pyx_t_12;
  char const *__pyx_t_13;
  long __pyx_t_14;
  double __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setValuesPyDict", 0);

  /* "amplpy/util.pxi":190
 *     cdef PyObject* item
 * 
 *     if not PyDict_Check(dicts):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expected a dictionary")
 * 
*/
  __pyx_t_1 = (!PyDict_Check(__pyx_v_dicts));
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/util.pxi":191
 * 
 *     if not PyDict_Check(dicts):
 *         raise ValueError("Expected a dictionary")             # <<<<<<<<<<<<<<
 * 
 *     cdef object d_keys = PyDict_Keys(dicts)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Expected_a_dictionary};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 191, __pyx_L1_error)

    /* "amplpy/util.pxi":190
 *     cdef PyObject* item
 * 
 *     if not PyDict_Check(dicts):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expected a dictionary")
 * 
*/
  }

  /* "amplpy/util.pxi":193
 *         raise ValueError("Expected a dictionary")
 * 
 *     cdef object d_keys = PyDict_Keys(dicts)             # <<<<<<<<<<<<<<
 *     cdef object d_values = PyDict_Values(dicts)
 *     cdef size_t size = len(dicts)
*/
  __pyx_t_2 = PyDict_Keys(__pyx_v_dicts); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_d_keys = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/util.pxi":194
 * 
 *     cdef object d_keys = PyDict_Keys(dicts)
 *     cdef object d_values = PyDict_Values(dicts)             # <<<<<<<<<<<<<<
 *     cdef size_t size = len(dicts)
 * 
*/
  __pyx_t_2 = PyDict_Values(__pyx_v_dicts); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_d_values = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/util.pxi":195
 *     cdef object d_keys = PyDict_Keys(dicts)
 *     cdef object d_values = PyDict_Values(dicts)
 *     cdef size_t size = len(dicts)             # <<<<<<<<<<<<<<
 * 
 *     cdef bool has_numbers = False
*/
  if (unlikely(__pyx_v_dicts == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 195, __pyx_L1_error)
  }
  __pyx_t_6 = PyDict_Size(__pyx_v_dicts); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(4, 195, __pyx_L1_error)
  __pyx_v_size = __pyx_t_6;

  /* "amplpy/util.pxi":197
 *     cdef size_t size = len(dicts)
 * 
 *     cdef bool has_numbers = False             # <<<<<<<<<<<<<<
 *     cdef bool has_strings = False
 * 
*/
  __pyx_v_has_numbers = 0;

  /* "amplpy/util.pxi":198
 * 
 *     cdef bool has_numbers = False
 *     cdef bool has_strings = False             # <<<<<<<<<<<<<<
 * 
 *     for i in range(size):
*/
  __pyx_v_has_strings = 0;

  /* "amplpy/util.pxi":200
 *     cdef bool has_strings = False
 * 
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         item = PyList_GetItem(d_values, i)
 *         if item == NULL:
*/
  __pyx_t_5 = __pyx_v_size;
  __pyx_t_7 = __pyx_t_5;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "amplpy/util.pxi":201
 * 
 *     for i in range(size):
 *         item = PyList_GetItem(d_values, i)             # <<<<<<<<<<<<<<
 *         if item == NULL:
 *             raise ValueError("Failed to access value")
*/
    __pyx_t_9 = PyList_GetItem(__pyx_v_d_values, __pyx_v_i); if (unlikely(__pyx_t_9 == ((PyObject *)0))) __PYX_ERR(4, 201, __pyx_L1_error)
    __pyx_v_item = __pyx_t_9;

    /* "amplpy/util.pxi":202
 *     for i in range(size):
 *         item = PyList_GetItem(d_values, i)
 *         if item == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("Failed to access value")
 * 
*/
    __pyx_t_1 = (__pyx_v_item == NULL);
    if (unlikely(__pyx_t_1)) {

      /* "amplpy/util.pxi":203
 *         item = PyList_GetItem(d_values, i)
 *         if item == NULL:
 *             raise ValueError("Failed to access value")             # <<<<<<<<<<<<<<
 * 
 *         if PyUnicode_Check(<object>item):
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_3 = __pyx_builtin_ValueError; 
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Failed_to_access_value};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 203, __pyx_L1_error)

      /* "amplpy/util.pxi":202
 *     for i in range(size):
 *         item = PyList_GetItem(d_values, i)
 *         if item == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError("Failed to access value")
 * 
*/
    }

    /* "amplpy/util.pxi":205
 *             raise ValueError("Failed to access value")
 * 
 *         if PyUnicode_Check(<object>item):             # <<<<<<<<<<<<<<
 *             has_strings = True
 *         else:
*/
    __pyx_t_1 = PyUnicode_Check(((PyObject *)__pyx_v_item));
    if (__pyx_t_1) {

      /* "amplpy/util.pxi":206
 * 
 *         if PyUnicode_Check(<object>item):
 *             has_strings = True             # <<<<<<<<<<<<<<
 *         else:
 *             has_numbers = True
*/
      __pyx_v_has_strings = 1;

      /* "amplpy/util.pxi":205
 *             raise ValueError("Failed to access value")
 * 
 *         if PyUnicode_Check(<object>item):             # <<<<<<<<<<<<<<
 *             has_strings = True
 *         else:
*/
      goto __pyx_L7;
    }

    /* "amplpy/util.pxi":208
 *             has_strings = True
 *         else:
 *             has_numbers = True             # <<<<<<<<<<<<<<
 * 
 *         if has_numbers and has_strings:
*/
    /*else*/ {
      __pyx_v_has_numbers = 1;
    }
    __pyx_L7:;

    /* "amplpy/util.pxi":210
 *             has_numbers = True
 * 
 *         if has_numbers and has_strings:             # <<<<<<<<<<<<<<
 *             raise ValueError("All values must be either numbers or strings")
 * 
*/
    __pyx_t_11 = (__pyx_v_has_numbers != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_has_strings != 0);
    __pyx_t_1 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "amplpy/util.pxi":211
 * 
 *         if has_numbers and has_strings:
 *             raise ValueError("All values must be either numbers or strings")             # <<<<<<<<<<<<<<
 * 
 *     if has_strings and not has_numbers:
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_4 = __pyx_builtin_ValueError; 
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_All_values_must_be_either_number};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 211, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(4, 211, __pyx_L1_error)

      /* "amplpy/util.pxi":210
 *             has_numbers = True
 * 
 *         if has_numbers and has_strings:             # <<<<<<<<<<<<<<
 *             raise ValueError("All values must be either numbers or strings")
 * 
*/
    }
  }

  /* "amplpy/util.pxi":213
 *             raise ValueError("All values must be either numbers or strings")
 * 
 *     if has_strings and not has_numbers:             # <<<<<<<<<<<<<<
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_str_c = <char **> malloc(size * sizeof(char*))
*/
  __pyx_t_11 = (__pyx_v_has_strings != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_1 = __pyx_t_11;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_11 = (!(__pyx_v_has_numbers != 0));
  __pyx_t_1 = __pyx_t_11;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_1) {

    /* "amplpy/util.pxi":214
 * 
 *     if has_strings and not has_numbers:
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))             # <<<<<<<<<<<<<<
 *         values_str_c = <char **> malloc(size * sizeof(char*))
 *         for i in range(size):
*/
    __pyx_v_indices_c = ((AMPL_TUPLE **)malloc((__pyx_v_size * (sizeof(AMPL_TUPLE *)))));

    /* "amplpy/util.pxi":215
 *     if has_strings and not has_numbers:
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_str_c = <char **> malloc(size * sizeof(char*))             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
*/
    __pyx_v_values_str_c = ((char **)malloc((__pyx_v_size * (sizeof(char *)))));

    /* "amplpy/util.pxi":216
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_str_c = <char **> malloc(size * sizeof(char*))
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
 *             values_str_c[i] = PyUnicode_AsUTF8(<object>PyList_GetItem(d_values, i))
*/
    __pyx_t_5 = __pyx_v_size;
    __pyx_t_7 = __pyx_t_5;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "amplpy/util.pxi":217
 *         values_str_c = <char **> malloc(size * sizeof(char*))
 *         for i in range(size):
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))             # <<<<<<<<<<<<<<
 *             values_str_c[i] = PyUnicode_AsUTF8(<object>PyList_GetItem(d_values, i))
 *         errorinfo = campl.AMPL_ParameterSetSomeStringValues(ampl, name, size, indices_c, values_str_c)
*/
      __pyx_t_9 = PyList_GetItem(__pyx_v_d_keys, __pyx_v_i); if (unlikely(__pyx_t_9 == ((PyObject *)0))) __PYX_ERR(4, 217, __pyx_L1_error)
      __pyx_t_12 = __pyx_f_6amplpy_4ampl_to_c_tuple(((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_12 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(4, 217, __pyx_L1_error)
      (__pyx_v_indices_c[__pyx_v_i]) = __pyx_t_12;

      /* "amplpy/util.pxi":218
 *         for i in range(size):
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
 *             values_str_c[i] = PyUnicode_AsUTF8(<object>PyList_GetItem(d_values, i))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_ParameterSetSomeStringValues(ampl, name, size, indices_c, values_str_c)
 *         for i in range(size):
*/
      __pyx_t_9 = PyList_GetItem(__pyx_v_d_values, __pyx_v_i); if (unlikely(__pyx_t_9 == ((PyObject *)0))) __PYX_ERR(4, 218, __pyx_L1_error)
      __pyx_t_13 = PyUnicode_AsUTF8(((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_13 == ((char const *)0))) __PYX_ERR(4, 218, __pyx_L1_error)
      (__pyx_v_values_str_c[__pyx_v_i]) = __pyx_t_13;
    }

    /* "amplpy/util.pxi":219
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
 *             values_str_c[i] = PyUnicode_AsUTF8(<object>PyList_GetItem(d_values, i))
 *         errorinfo = campl.AMPL_ParameterSetSomeStringValues(ampl, name, size, indices_c, values_str_c)             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])
*/
    __pyx_v_errorinfo = AMPL_ParameterSetSomeStringValues(__pyx_v_ampl, __pyx_v_name, __pyx_v_size, __pyx_v_indices_c, __pyx_v_values_str_c);

    /* "amplpy/util.pxi":220
 *             values_str_c[i] = PyUnicode_AsUTF8(<object>PyList_GetItem(d_values, i))
 *         errorinfo = campl.AMPL_ParameterSetSomeStringValues(ampl, name, size, indices_c, values_str_c)
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)
*/
    __pyx_t_5 = __pyx_v_size;
    __pyx_t_7 = __pyx_t_5;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "amplpy/util.pxi":221
 *         errorinfo = campl.AMPL_ParameterSetSomeStringValues(ampl, name, size, indices_c, values_str_c)
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])             # <<<<<<<<<<<<<<
 *         free(indices_c)
 *         free(values_str_c)
*/
      (void)(AMPL_TupleFree((&(__pyx_v_indices_c[__pyx_v_i]))));
    }

    /* "amplpy/util.pxi":222
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)             # <<<<<<<<<<<<<<
 *         free(values_str_c)
 *     elif has_numbers and not has_strings:
*/
    free(__pyx_v_indices_c);

    /* "amplpy/util.pxi":223
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)
 *         free(values_str_c)             # <<<<<<<<<<<<<<
 *     elif has_numbers and not has_strings:
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
*/
    free(__pyx_v_values_str_c);

    /* "amplpy/util.pxi":213
 *             raise ValueError("All values must be either numbers or strings")
 * 
 *     if has_strings and not has_numbers:             # <<<<<<<<<<<<<<
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_str_c = <char **> malloc(size * sizeof(char*))
*/
    goto __pyx_L11;
  }

  /* "amplpy/util.pxi":224
 *         free(indices_c)
 *         free(values_str_c)
 *     elif has_numbers and not has_strings:             # <<<<<<<<<<<<<<
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_num_c = <double *> malloc(size * sizeof(double))
*/
  __pyx_t_11 = (__pyx_v_has_numbers != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_1 = __pyx_t_11;
    goto __pyx_L18_bool_binop_done;
  }
  __pyx_t_11 = (!(__pyx_v_has_strings != 0));
  __pyx_t_1 = __pyx_t_11;
  __pyx_L18_bool_binop_done:;
  if (likely(__pyx_t_1)) {

    /* "amplpy/util.pxi":225
 *         free(values_str_c)
 *     elif has_numbers and not has_strings:
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))             # <<<<<<<<<<<<<<
 *         values_num_c = <double *> malloc(size * sizeof(double))
 *         for i in range(size):
*/
    __pyx_v_indices_c = ((AMPL_TUPLE **)malloc((__pyx_v_size * (sizeof(AMPL_TUPLE *)))));

    /* "amplpy/util.pxi":226
 *     elif has_numbers and not has_strings:
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_num_c = <double *> malloc(size * sizeof(double))             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
*/
    __pyx_v_values_num_c = ((double *)malloc((__pyx_v_size * (sizeof(double)))));

    /* "amplpy/util.pxi":227
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_num_c = <double *> malloc(size * sizeof(double))
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
 *             item = PyList_GetItem(d_values, i)
*/
    __pyx_t_5 = __pyx_v_size;
    __pyx_t_7 = __pyx_t_5;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "amplpy/util.pxi":228
 *         values_num_c = <double *> malloc(size * sizeof(double))
 *         for i in range(size):
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))             # <<<<<<<<<<<<<<
 *             item = PyList_GetItem(d_values, i)
 *             if PyLong_Check(<object>item):
*/
      __pyx_t_9 = PyList_GetItem(__pyx_v_d_keys, __pyx_v_i); if (unlikely(__pyx_t_9 == ((PyObject *)0))) __PYX_ERR(4, 228, __pyx_L1_error)
      __pyx_t_12 = __pyx_f_6amplpy_4ampl_to_c_tuple(((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_12 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(4, 228, __pyx_L1_error)
      (__pyx_v_indices_c[__pyx_v_i]) = __pyx_t_12;

      /* "amplpy/util.pxi":229
 *         for i in range(size):
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
 *             item = PyList_GetItem(d_values, i)             # <<<<<<<<<<<<<<
 *             if PyLong_Check(<object>item):
 *                 values_num_c[i] = PyLong_AsLong(<object>item)
*/
      __pyx_t_9 = PyList_GetItem(__pyx_v_d_values, __pyx_v_i); if (unlikely(__pyx_t_9 == ((PyObject *)0))) __PYX_ERR(4, 229, __pyx_L1_error)
      __pyx_v_item = __pyx_t_9;

      /* "amplpy/util.pxi":230
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
 *             item = PyList_GetItem(d_values, i)
 *             if PyLong_Check(<object>item):             # <<<<<<<<<<<<<<
 *                 values_num_c[i] = PyLong_AsLong(<object>item)
 *             else:
*/
      __pyx_t_1 = PyLong_Check(((PyObject *)__pyx_v_item));
      if (__pyx_t_1) {

        /* "amplpy/util.pxi":231
 *             item = PyList_GetItem(d_values, i)
 *             if PyLong_Check(<object>item):
 *                 values_num_c[i] = PyLong_AsLong(<object>item)             # <<<<<<<<<<<<<<
 *             else:
 *                 values_num_c[i] = PyFloat_AsDouble(<object>item)
*/
        __pyx_t_14 = PyLong_AsLong(((PyObject *)__pyx_v_item)); if (unlikely(__pyx_t_14 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(4, 231, __pyx_L1_error)
        (__pyx_v_values_num_c[__pyx_v_i]) = __pyx_t_14;

        /* "amplpy/util.pxi":230
 *             indices_c[i] = to_c_tuple(<object>PyList_GetItem(d_keys, i))
 *             item = PyList_GetItem(d_values, i)
 *             if PyLong_Check(<object>item):             # <<<<<<<<<<<<<<
 *                 values_num_c[i] = PyLong_AsLong(<object>item)
 *             else:
*/
        goto __pyx_L22;
      }

      /* "amplpy/util.pxi":233
 *                 values_num_c[i] = PyLong_AsLong(<object>item)
 *             else:
 *                 values_num_c[i] = PyFloat_AsDouble(<object>item)             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_ParameterSetSomeDoubleValues(ampl, name, size, indices_c, values_num_c)
 *         for i in range(size):
*/
      /*else*/ {
        __pyx_t_15 = PyFloat_AsDouble(((PyObject *)__pyx_v_item)); if (unlikely(__pyx_t_15 == ((double)-1.0) && PyErr_Occurred())) __PYX_ERR(4, 233, __pyx_L1_error)
        (__pyx_v_values_num_c[__pyx_v_i]) = __pyx_t_15;
      }
      __pyx_L22:;
    }

    /* "amplpy/util.pxi":234
 *             else:
 *                 values_num_c[i] = PyFloat_AsDouble(<object>item)
 *         errorinfo = campl.AMPL_ParameterSetSomeDoubleValues(ampl, name, size, indices_c, values_num_c)             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])
*/
    __pyx_v_errorinfo = AMPL_ParameterSetSomeDoubleValues(__pyx_v_ampl, __pyx_v_name, __pyx_v_size, __pyx_v_indices_c, __pyx_v_values_num_c);

    /* "amplpy/util.pxi":235
 *                 values_num_c[i] = PyFloat_AsDouble(<object>item)
 *         errorinfo = campl.AMPL_ParameterSetSomeDoubleValues(ampl, name, size, indices_c, values_num_c)
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)
*/
    __pyx_t_5 = __pyx_v_size;
    __pyx_t_7 = __pyx_t_5;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "amplpy/util.pxi":236
 *         errorinfo = campl.AMPL_ParameterSetSomeDoubleValues(ampl, name, size, indices_c, values_num_c)
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])             # <<<<<<<<<<<<<<
 *         free(indices_c)
 *         free(values_num_c)
*/
      (void)(AMPL_TupleFree((&(__pyx_v_indices_c[__pyx_v_i]))));
    }

    /* "amplpy/util.pxi":237
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)             # <<<<<<<<<<<<<<
 *         free(values_num_c)
 *     else:
*/
    free(__pyx_v_indices_c);

    /* "amplpy/util.pxi":238
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)
 *         free(values_num_c)             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError("Dictionary must contain either all strings or all numbers")
*/
    free(__pyx_v_values_num_c);

    /* "amplpy/util.pxi":224
 *         free(indices_c)
 *         free(values_str_c)
 *     elif has_numbers and not has_strings:             # <<<<<<<<<<<<<<
 *         indices_c = <campl.AMPL_TUPLE**> malloc(size * sizeof(campl.AMPL_TUPLE*))
 *         values_num_c = <double *> malloc(size * sizeof(double))
*/
    goto __pyx_L11;
  }

  /* "amplpy/util.pxi":240
 *         free(values_num_c)
 *     else:
 *         raise ValueError("Dictionary must contain either all strings or all numbers")             # <<<<<<<<<<<<<<
 *     return errorinfo
 * 
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Dictionary_must_contain_either_a};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 240, __pyx_L1_error)
  }
  __pyx_L11:;

  /* "amplpy/util.pxi":241
 *     else:
 *         raise ValueError("Dictionary must contain either all strings or all numbers")
 *     return errorinfo             # <<<<<<<<<<<<<<
 * 
 * cdef void raiseKeyError(campl.AMPL_ENTITYTYPE entity_class, str name) except *:
*/
  __pyx_r = __pyx_v_errorinfo;
  goto __pyx_L0;

  /* "amplpy/util.pxi":182
 *     return errorinfo
 * 
 * cdef campl.AMPL_ERRORINFO* setValuesPyDict(campl.AMPL* ampl, char* name, dict dicts) except *:             # <<<<<<<<<<<<<<
 *     cdef campl.AMPL_ERRORINFO* errorinfo
 *     cdef size_t i
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.setValuesPyDict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d_keys);
  __Pyx_XDECREF(__pyx_v_d_values);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/util.pxi":243
 *     return errorinfo
 * 
 * cdef void raiseKeyError(campl.AMPL_ENTITYTYPE entity_class, str name) except *:             # <<<<<<<<<<<<<<
 *     if entity_class == campl.AMPL_VARIABLE:
 *         raise KeyError(f"A variable called {name} cannot be found.")
*/

static void __pyx_f_6amplpy_4ampl_raiseKeyError(AMPL_ENTITYTYPE __pyx_v_entity_class, PyObject *__pyx_v_name) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5[3];
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("raiseKeyError", 0);

  /* "amplpy/util.pxi":244
 * 
 * cdef void raiseKeyError(campl.AMPL_ENTITYTYPE entity_class, str name) except *:
 *     if entity_class == campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *         raise KeyError(f"A variable called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_CONSTRAINT:
*/
  switch (__pyx_v_entity_class) {
    case AMPL_VARIABLE:

    /* "amplpy/util.pxi":245
 * cdef void raiseKeyError(campl.AMPL_ENTITYTYPE entity_class, str name) except *:
 *     if entity_class == campl.AMPL_VARIABLE:
 *         raise KeyError(f"A variable called {name} cannot be found.")             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_CONSTRAINT:
 *         raise KeyError(f"A constraint called {name} cannot be found.")
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_3 = __pyx_builtin_KeyError; 
    __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_A_variable_called;
    __pyx_t_5[1] = __pyx_t_4;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_cannot_be_found;
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 17, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 245, __pyx_L1_error)

    /* "amplpy/util.pxi":244
 * 
 * cdef void raiseKeyError(campl.AMPL_ENTITYTYPE entity_class, str name) except *:
 *     if entity_class == campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *         raise KeyError(f"A variable called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_CONSTRAINT:
*/
    break;
    case AMPL_CONSTRAINT:

    /* "amplpy/util.pxi":247
 *         raise KeyError(f"A variable called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_CONSTRAINT:
 *         raise KeyError(f"A constraint called {name} cannot be found.")             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_OBJECTIVE:
 *         raise KeyError(f"An objective called {name} cannot be found.")
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_6 = __pyx_builtin_KeyError; 
    __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_A_constraint_called;
    __pyx_t_5[1] = __pyx_t_2;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_cannot_be_found;
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 17, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
    if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 247, __pyx_L1_error)

    /* "amplpy/util.pxi":246
 *     if entity_class == campl.AMPL_VARIABLE:
 *         raise KeyError(f"A variable called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_CONSTRAINT:             # <<<<<<<<<<<<<<
 *         raise KeyError(f"A constraint called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_OBJECTIVE:
*/
    break;
    case AMPL_OBJECTIVE:

    /* "amplpy/util.pxi":249
 *         raise KeyError(f"A constraint called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_OBJECTIVE:
 *         raise KeyError(f"An objective called {name} cannot be found.")             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_SET:
 *         raise KeyError(f"A set called {name} cannot be found.")
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_4 = __pyx_builtin_KeyError; 
    __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_An_objective_called;
    __pyx_t_5[1] = __pyx_t_3;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_cannot_be_found;
    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 17, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
    if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 249, __pyx_L1_error)

    /* "amplpy/util.pxi":248
 *     elif entity_class == campl.AMPL_CONSTRAINT:
 *         raise KeyError(f"A constraint called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_OBJECTIVE:             # <<<<<<<<<<<<<<
 *         raise KeyError(f"An objective called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_SET:
*/
    break;
    case AMPL_SET:

    /* "amplpy/util.pxi":251
 *         raise KeyError(f"An objective called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_SET:
 *         raise KeyError(f"A set called {name} cannot be found.")             # <<<<<<<<<<<<<<
 *     elif entity_class == campl.AMPL_PARAMETER:
 *         raise KeyError(f"A parameter called {name} cannot be found.")
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_2 = __pyx_builtin_KeyError; 
    __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_A_set_called;
    __pyx_t_5[1] = __pyx_t_6;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_cannot_be_found;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 17, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
    if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 251, __pyx_L1_error)

    /* "amplpy/util.pxi":250
 *     elif entity_class == campl.AMPL_OBJECTIVE:
 *         raise KeyError(f"An objective called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_SET:             # <<<<<<<<<<<<<<
 *         raise KeyError(f"A set called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_PARAMETER:
*/
    break;
    case AMPL_PARAMETER:

    /* "amplpy/util.pxi":253
 *         raise KeyError(f"A set called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_PARAMETER:
 *         raise KeyError(f"A parameter called {name} cannot be found.")             # <<<<<<<<<<<<<<
 *     else:
 *         pass
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_3 = __pyx_builtin_KeyError; 
    __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_A_parameter_called;
    __pyx_t_5[1] = __pyx_t_4;
    __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_cannot_be_found;
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 19 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 17, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
    if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 253, __pyx_L1_error)

    /* "amplpy/util.pxi":252
 *     elif entity_class == campl.AMPL_SET:
 *         raise KeyError(f"A set called {name} cannot be found.")
 *     elif entity_class == campl.AMPL_PARAMETER:             # <<<<<<<<<<<<<<
 *         raise KeyError(f"A parameter called {name} cannot be found.")
 *     else:
*/
    break;
    default:
    break;
  }

  /* "amplpy/util.pxi":243
 *     return errorinfo
 * 
 * cdef void raiseKeyError(campl.AMPL_ENTITYTYPE entity_class, str name) except *:             # <<<<<<<<<<<<<<
 *     if entity_class == campl.AMPL_VARIABLE:
 *         raise KeyError(f"A variable called {name} cannot be found.")
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("amplpy.ampl.raiseKeyError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "amplpy/constraint.pxi":32
 *     and the :class:`~amplpy.DataFrame` class.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Constraint()
*/

static PyObject *__pyx_f_6amplpy_4ampl_10Constraint_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_entity = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/constraint.pxi":34
 *     @staticmethod
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Constraint()             # <<<<<<<<<<<<<<
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 34, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_entity = ((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/constraint.pxi":35
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Constraint()
 *         entity._ampl = ampl             # <<<<<<<<<<<<<<
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __pyx_v_entity->__pyx_base._ampl = __pyx_v_ampl;

  /* "amplpy/constraint.pxi":36
 *         entity = Constraint()
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)             # <<<<<<<<<<<<<<
 *         entity._name = name
 *         entity._index = index
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_INCREF(__pyx_t_1);
  Py_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/constraint.pxi":37
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
 *         entity._name = name             # <<<<<<<<<<<<<<
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_CONSTRAINT
*/
  __pyx_v_entity->__pyx_base._name = __pyx_v_name;

  /* "amplpy/constraint.pxi":38
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
 *         entity._index = index             # <<<<<<<<<<<<<<
 *         entity.wrap_function = campl.AMPL_CONSTRAINT
 *         entity._entity = parent
*/
  __pyx_v_entity->__pyx_base._index = __pyx_v_index;

  /* "amplpy/constraint.pxi":39
 *         entity._name = name
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_CONSTRAINT             # <<<<<<<<<<<<<<
 *         entity._entity = parent
 *         if entity._entity is not None:
*/
  __pyx_v_entity->__pyx_base.wrap_function = AMPL_CONSTRAINT;

  /* "amplpy/constraint.pxi":40
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_CONSTRAINT
 *         entity._entity = parent             # <<<<<<<<<<<<<<
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_entity->__pyx_base._entity);
  __Pyx_DECREF(__pyx_v_entity->__pyx_base._entity);
  __pyx_v_entity->__pyx_base._entity = __pyx_v_parent;

  /* "amplpy/constraint.pxi":41
 *         entity.wrap_function = campl.AMPL_CONSTRAINT
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  __pyx_t_5 = (__pyx_v_entity->__pyx_base._entity != Py_None);
  if (__pyx_t_5) {

    /* "amplpy/constraint.pxi":42
 *         entity._entity = parent
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)             # <<<<<<<<<<<<<<
 *         return entity
 * 
*/
    __pyx_t_1 = __pyx_v_entity->__pyx_base._entity;
    __Pyx_INCREF(__pyx_t_1);
    Py_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/constraint.pxi":41
 *         entity.wrap_function = campl.AMPL_CONSTRAINT
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  }

  /* "amplpy/constraint.pxi":43
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_entity);
  __pyx_r = ((PyObject *)__pyx_v_entity);
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":32
 *     and the :class:`~amplpy.DataFrame` class.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Constraint()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entity);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":45
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.__getitem__(index).set_dual(value)
 * 
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_10Constraint_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6amplpy_4ampl_10Constraint_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint___setitem__(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_10Constraint___setitem__(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/constraint.pxi":46
 * 
 *     def __setitem__(self, index, value):
 *         self.__getitem__(index).set_dual(value)             # <<<<<<<<<<<<<<
 * 
 *     def is_logical(self):
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_index};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_getitem, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_value};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_dual, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/constraint.pxi":45
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.__getitem__(index).set_dual(value)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":48
 *         self.__getitem__(index).set_dual(value)
 * 
 *     def is_logical(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check if the constraint is a logical constraint. Returns True if
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_3is_logical(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_2is_logical, "Constraint.is_logical(self)\nCheck if the constraint is a logical constraint. Returns True if\nlogical. The available suffixes differ between logical and non logical\nconstraints. See http://www.ampl.com/NEW/suffbuiltin.html for a list of\nthe available suffixes for algebraic constraints. The suffixes\navailable for logical constraints are marked on the method description\nby \"Valid only for logical constraints\".");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_3is_logical = {"is_logical", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_3is_logical, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_2is_logical};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_3is_logical(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_logical (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_logical", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_logical", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_2is_logical(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_2is_logical(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  bool __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_logical", 0);

  /* "amplpy/constraint.pxi":58
 *         """
 *         cdef bool_c value
 *         try:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_ConstraintIsLogical(self._ampl._c_ampl, self._name, &value))
 *             return value
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "amplpy/constraint.pxi":59
 *         cdef bool_c value
 *         try:
 *             PY_AMPL_CALL(campl.AMPL_ConstraintIsLogical(self._ampl._c_ampl, self._name, &value))             # <<<<<<<<<<<<<<
 *             return value
 *         except AttributeError:
*/
      __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ConstraintIsLogical(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 59, __pyx_L3_error)

      /* "amplpy/constraint.pxi":60
 *         try:
 *             PY_AMPL_CALL(campl.AMPL_ConstraintIsLogical(self._ampl._c_ampl, self._name, &value))
 *             return value             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             return False
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 60, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "amplpy/constraint.pxi":58
 *         """
 *         cdef bool_c value
 *         try:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_ConstraintIsLogical(self._ampl._c_ampl, self._name, &value))
 *             return value
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "amplpy/constraint.pxi":61
 *             PY_AMPL_CALL(campl.AMPL_ConstraintIsLogical(self._ampl._c_ampl, self._name, &value))
 *             return value
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             return False
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_5) {
      __Pyx_ErrRestore(0,0,0);

      /* "amplpy/constraint.pxi":62
 *             return value
 *         except AttributeError:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def drop(self):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "amplpy/constraint.pxi":58
 *         """
 *         cdef bool_c value
 *         try:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_ConstraintIsLogical(self._ampl._c_ampl, self._name, &value))
 *             return value
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "amplpy/constraint.pxi":48
 *         self.__getitem__(index).set_dual(value)
 * 
 *     def is_logical(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check if the constraint is a logical constraint. Returns True if
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.is_logical", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":64
 *             return False
 * 
 *     def drop(self):             # <<<<<<<<<<<<<<
 *         """
 *         Drop all instances in this constraint entity, corresponding to the AMPL
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_5drop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_4drop, "Constraint.drop(self)\nDrop all instances in this constraint entity, corresponding to the AMPL\ncode: `drop constraintname;`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_5drop = {"drop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_5drop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_4drop};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_5drop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("drop (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("drop", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("drop", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_4drop(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_4drop(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("drop", 0);

  /* "amplpy/constraint.pxi":69
 *         code: `drop constraintname;`.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))             # <<<<<<<<<<<<<<
 * 
 *     def restore(self):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityDrop(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 69, __pyx_L1_error)

  /* "amplpy/constraint.pxi":64
 *             return False
 * 
 *     def drop(self):             # <<<<<<<<<<<<<<
 *         """
 *         Drop all instances in this constraint entity, corresponding to the AMPL
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Constraint.drop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":71
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))
 * 
 *     def restore(self):             # <<<<<<<<<<<<<<
 *         """
 *         Restore all instances in this constraint entity, corresponding to the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_7restore(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_6restore, "Constraint.restore(self)\nRestore all instances in this constraint entity, corresponding to the\nAMPL code: `restore constraintname;`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_7restore = {"restore", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_7restore, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_6restore};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_7restore(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("restore (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("restore", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("restore", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_6restore(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_6restore(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("restore", 0);

  /* "amplpy/constraint.pxi":76
 *         AMPL code: `restore constraintname;`.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))             # <<<<<<<<<<<<<<
 * 
 *     def body(self):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityRestore(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 76, __pyx_L1_error)

  /* "amplpy/constraint.pxi":71
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))
 * 
 *     def restore(self):             # <<<<<<<<<<<<<<
 *         """
 *         Restore all instances in this constraint entity, corresponding to the
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Constraint.restore", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":78
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))
 * 
 *     def body(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's body.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_9body(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_8body, "Constraint.body(self)\nGet the current value of the constraint's body.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_9body = {"body", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_9body, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_8body};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_9body(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("body (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("body", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("body", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_8body(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_8body(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("body", 0);

  /* "amplpy/constraint.pxi":83
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_BODY, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_BODY, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 83, __pyx_L1_error)

  /* "amplpy/constraint.pxi":84
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_BODY, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def astatus(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":78
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))
 * 
 *     def body(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's body.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.body", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":86
 *         return value
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current AMPL status (dropped, presolved, or substituted out).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_11astatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_10astatus, "Constraint.astatus(self)\nGet the current AMPL status (dropped, presolved, or substituted out).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_11astatus = {"astatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_11astatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_10astatus};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_11astatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("astatus (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("astatus", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("astatus", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_10astatus(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_10astatus(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("astatus", 0);

  /* "amplpy/constraint.pxi":92
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_ASTATUS, (&__pyx_v_value_c));

  /* "amplpy/constraint.pxi":93
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/constraint.pxi":94
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 94, __pyx_L1_error)

    /* "amplpy/constraint.pxi":93
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/constraint.pxi":95
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(5, 95, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/constraint.pxi":96
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/constraint.pxi":98
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def defvar(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":86
 *         return value
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current AMPL status (dropped, presolved, or substituted out).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.astatus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":100
 *         return value
 * 
 *     def defvar(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the index in `_var` of "defined variable" substituted out by the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_13defvar(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_12defvar, "Constraint.defvar(self)\nGet the index in `_var` of \"defined variable\" substituted out by the\nconstraint.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_13defvar = {"defvar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_13defvar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_12defvar};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_13defvar(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("defvar (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("defvar", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("defvar", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_12defvar(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_12defvar(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  int __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("defvar", 0);

  /* "amplpy/constraint.pxi":106
 *         """
 *         cdef int value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetIntSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DEFVAR, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetIntSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_DEFVAR, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 106, __pyx_L1_error)

  /* "amplpy/constraint.pxi":107
 *         cdef int value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetIntSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DEFVAR, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def dinit(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":100
 *         return value
 * 
 *     def defvar(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the index in `_var` of "defined variable" substituted out by the
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.defvar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":109
 *         return value
 * 
 *     def dinit(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current initial guess for the constraint's dual variable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_15dinit(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_14dinit, "Constraint.dinit(self)\nGet the current initial guess for the constraint's dual variable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_15dinit = {"dinit", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_15dinit, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_14dinit};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_15dinit(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dinit (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("dinit", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("dinit", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_14dinit(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_14dinit(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dinit", 0);

  /* "amplpy/constraint.pxi":114
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DINIT, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_DINIT, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 114, __pyx_L1_error)

  /* "amplpy/constraint.pxi":115
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DINIT, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def dinit0(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":109
 *         return value
 * 
 *     def dinit(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current initial guess for the constraint's dual variable.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.dinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":117
 *         return value
 * 
 *     def dinit0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the original initial guess for the constraint's dual variable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_17dinit0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_16dinit0, "Constraint.dinit0(self)\nGet the original initial guess for the constraint's dual variable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_17dinit0 = {"dinit0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_17dinit0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_16dinit0};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_17dinit0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dinit0 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("dinit0", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("dinit0", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_16dinit0(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_16dinit0(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dinit0", 0);

  /* "amplpy/constraint.pxi":122
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DINIT0, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_DINIT0, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 122, __pyx_L1_error)

  /* "amplpy/constraint.pxi":123
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DINIT0, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def dual(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":117
 *         return value
 * 
 *     def dinit0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the original initial guess for the constraint's dual variable.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.dinit0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":125
 *         return value
 * 
 *     def dual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's dual variable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_19dual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_18dual, "Constraint.dual(self)\nGet the current value of the constraint's dual variable.\n\nNote that dual values are often reset by the underlying AMPL\ninterpreter by the presolve functionalities triggered by some methods.\nA possible workaround is to set the option `presolve` to `false`\n(see :func:`~amplpy.AMPL.setOption`).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_19dual = {"dual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_19dual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_18dual};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_19dual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dual (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("dual", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("dual", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_18dual(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_18dual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dual", 0);

  /* "amplpy/constraint.pxi":135
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DUAL, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_DUAL, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 135, __pyx_L1_error)

  /* "amplpy/constraint.pxi":136
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DUAL, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lb(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":125
 *         return value
 * 
 *     def dual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's dual variable.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.dual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":138
 *         return value
 * 
 *     def lb(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's lower bound.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_21lb(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_20lb, "Constraint.lb(self)\nGet the current value of the constraint's lower bound.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_21lb = {"lb", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_21lb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_20lb};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_21lb(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lb (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lb", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lb", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_20lb(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_20lb(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lb", 0);

  /* "amplpy/constraint.pxi":143
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LB, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 143, __pyx_L1_error)

  /* "amplpy/constraint.pxi":144
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def ub(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":138
 *         return value
 * 
 *     def lb(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's lower bound.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.lb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":146
 *         return value
 * 
 *     def ub(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's upper bound.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_23ub(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_22ub, "Constraint.ub(self)\nGet the current value of the constraint's upper bound.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_23ub = {"ub", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_23ub, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_22ub};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_23ub(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ub (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ub", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ub", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_22ub(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_22ub(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ub", 0);

  /* "amplpy/constraint.pxi":151
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_UB, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 151, __pyx_L1_error)

  /* "amplpy/constraint.pxi":152
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lbs(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":146
 *         return value
 * 
 *     def ub(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's upper bound.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.ub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":154
 *         return value
 * 
 *     def lbs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint lower bound sent to the solver (reflecting
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_25lbs(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_24lbs, "Constraint.lbs(self)\nGet the constraint lower bound sent to the solver (reflecting\nadjustment for fixed variables).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_25lbs = {"lbs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_25lbs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_24lbs};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_25lbs(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lbs (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lbs", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lbs", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_24lbs(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_24lbs(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lbs", 0);

  /* "amplpy/constraint.pxi":160
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LBS, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LBS, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 160, __pyx_L1_error)

  /* "amplpy/constraint.pxi":161
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LBS, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def ubs(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":154
 *         return value
 * 
 *     def lbs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint lower bound sent to the solver (reflecting
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.lbs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":163
 *         return value
 * 
 *     def ubs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint upper bound sent to the solver (reflecting
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_27ubs(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_26ubs, "Constraint.ubs(self)\nGet the constraint upper bound sent to the solver (reflecting\nadjustment for fixed variables).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_27ubs = {"ubs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_27ubs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_26ubs};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_27ubs(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ubs (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ubs", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ubs", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_26ubs(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_26ubs(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ubs", 0);

  /* "amplpy/constraint.pxi":169
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UBS, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_UBS, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 169, __pyx_L1_error)

  /* "amplpy/constraint.pxi":170
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UBS, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def ldual(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":163
 *         return value
 * 
 *     def ubs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint upper bound sent to the solver (reflecting
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.ubs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":172
 *         return value
 * 
 *     def ldual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current dual value associated with the lower bound.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_29ldual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_28ldual, "Constraint.ldual(self)\nGet the current dual value associated with the lower bound.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_29ldual = {"ldual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_29ldual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_28ldual};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_29ldual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ldual (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ldual", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ldual", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_28ldual(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_28ldual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ldual", 0);

  /* "amplpy/constraint.pxi":177
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LDUAL, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LDUAL, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 177, __pyx_L1_error)

  /* "amplpy/constraint.pxi":178
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LDUAL, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def udual(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":172
 *         return value
 * 
 *     def ldual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current dual value associated with the lower bound.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.ldual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":180
 *         return value
 * 
 *     def udual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current dual value associated with the upper bounds.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_31udual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_30udual, "Constraint.udual(self)\nGet the current dual value associated with the upper bounds.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_31udual = {"udual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_31udual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_30udual};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_31udual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("udual (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("udual", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("udual", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_30udual(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_30udual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("udual", 0);

  /* "amplpy/constraint.pxi":185
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UDUAL, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_UDUAL, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 185, __pyx_L1_error)

  /* "amplpy/constraint.pxi":186
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UDUAL, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lslack(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":180
 *         return value
 * 
 *     def udual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current dual value associated with the upper bounds.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.udual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":188
 *         return value
 * 
 *     def lslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the slack at lower bound `body - lb`.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_33lslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_32lslack, "Constraint.lslack(self)\nGet the slack at lower bound `body - lb`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_33lslack = {"lslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_33lslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_32lslack};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_33lslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lslack (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lslack", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lslack", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_32lslack(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_32lslack(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lslack", 0);

  /* "amplpy/constraint.pxi":193
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LSLACK, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LSLACK, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 193, __pyx_L1_error)

  /* "amplpy/constraint.pxi":194
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LSLACK, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def uslack(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":188
 *         return value
 * 
 *     def lslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the slack at lower bound `body - lb`.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.lslack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":196
 *         return value
 * 
 *     def uslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the slack at upper bound `ub - body`.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_35uslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_34uslack, "Constraint.uslack(self)\nGet the slack at upper bound `ub - body`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_35uslack = {"uslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_35uslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_34uslack};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_35uslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("uslack (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("uslack", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("uslack", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_34uslack(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_34uslack(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("uslack", 0);

  /* "amplpy/constraint.pxi":201
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_USLACK, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_USLACK, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 201, __pyx_L1_error)

  /* "amplpy/constraint.pxi":202
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_USLACK, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def slack(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":196
 *         return value
 * 
 *     def uslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the slack at upper bound `ub - body`.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.uslack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":204
 *         return value
 * 
 *     def slack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Constraint slack (the lesser of lslack and uslack).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_37slack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_36slack, "Constraint.slack(self)\nConstraint slack (the lesser of lslack and uslack).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_37slack = {"slack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_37slack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_36slack};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_37slack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("slack (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("slack", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("slack", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_36slack(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_36slack(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("slack", 0);

  /* "amplpy/constraint.pxi":209
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_SLACK, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_SLACK, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 209, __pyx_L1_error)

  /* "amplpy/constraint.pxi":210
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_SLACK, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def sstatus(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":204
 *         return value
 * 
 *     def slack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Constraint slack (the lesser of lslack and uslack).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.slack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":212
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the solver status (basis status of constraint's slack or artificial
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_39sstatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_38sstatus, "Constraint.sstatus(self)\nGet the solver status (basis status of constraint's slack or artificial\nvariable).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_39sstatus = {"sstatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_39sstatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_38sstatus};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_39sstatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sstatus (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("sstatus", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("sstatus", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_38sstatus(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_38sstatus(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sstatus", 0);

  /* "amplpy/constraint.pxi":219
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_SSTATUS, (&__pyx_v_value_c));

  /* "amplpy/constraint.pxi":220
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/constraint.pxi":221
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 221, __pyx_L1_error)

    /* "amplpy/constraint.pxi":220
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/constraint.pxi":222
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(5, 222, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/constraint.pxi":223
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/constraint.pxi":225
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def status(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":212
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the solver status (basis status of constraint's slack or artificial
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.sstatus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":227
 *         return value
 * 
 *     def status(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL status if not `in`, otherwise solver status.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_41status(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_40status, "Constraint.status(self)\nGet the AMPL status if not `in`, otherwise solver status.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_41status = {"status", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_41status, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_40status};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_41status(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("status (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("status", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("status", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_40status(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_40status(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("status", 0);

  /* "amplpy/constraint.pxi":233
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_STATUS, (&__pyx_v_value_c));

  /* "amplpy/constraint.pxi":234
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/constraint.pxi":235
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 235, __pyx_L1_error)

    /* "amplpy/constraint.pxi":234
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/constraint.pxi":236
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(5, 236, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/constraint.pxi":237
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/constraint.pxi":239
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def set_dual(self, dual):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/constraint.pxi":227
 *         return value
 * 
 *     def status(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL status if not `in`, otherwise solver status.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":241
 *         return value
 * 
 *     def set_dual(self, dual):             # <<<<<<<<<<<<<<
 *         """
 *         Set the value of the dual variable associated to this constraint (valid
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_43set_dual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_42set_dual, "Constraint.set_dual(self, dual)\nSet the value of the dual variable associated to this constraint (valid\nonly if the constraint is scalar). Equivalent to the AMPL statement:\n\n`let c := dual;`\n\nNote that dual values are often reset by the underlying AMPL\ninterpreter by the presolve functionalities triggered by some methods.\nA possible workaround is to set the option `presolve` to `False`\n(see :func:`~amplpy.AMPL.setOption`).\n\nArgs:\n    dual: The value to be assigned to the dual variable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_43set_dual = {"set_dual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_43set_dual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_42set_dual};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_43set_dual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_dual = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_dual (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_dual,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(5, 241, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 241, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_dual", 0) < 0) __PYX_ERR(5, 241, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_dual", 1, 1, 1, i); __PYX_ERR(5, 241, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(5, 241, __pyx_L3_error)
    }
    __pyx_v_dual = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_dual", 1, 1, 1, __pyx_nargs); __PYX_ERR(5, 241, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Constraint.set_dual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_42set_dual(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self), __pyx_v_dual);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_42set_dual(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self, PyObject *__pyx_v_dual) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_dual", 0);

  /* "amplpy/constraint.pxi":256
 *             dual: The value to be assigned to the dual variable.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_ConstraintInstanceSetDual(self._ampl._c_ampl, self._name, self._index, float(dual)))             # <<<<<<<<<<<<<<
 * 
 *     def val(self):
*/
  __pyx_t_1 = __Pyx_PyObject_AsDouble(__pyx_v_dual); if (unlikely(__pyx_t_1 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(5, 256, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ConstraintInstanceSetDual(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 256, __pyx_L1_error)

  /* "amplpy/constraint.pxi":241
 *         return value
 * 
 *     def set_dual(self, dual):             # <<<<<<<<<<<<<<
 *         """
 *         Set the value of the dual variable associated to this constraint (valid
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Constraint.set_dual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/constraint.pxi":258
 *         PY_AMPL_CALL(campl.AMPL_ConstraintInstanceSetDual(self._ampl._c_ampl, self._name, self._index, float(dual)))
 * 
 *     def val(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL val suffix. Valid only for logical constraints.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_45val(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_44val, "Constraint.val(self)\nGet the AMPL val suffix. Valid only for logical constraints.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_45val = {"val", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_45val, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_44val};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_45val(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("val (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("val", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("val", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_44val(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_44val(struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("val", 0);

  /* "amplpy/constraint.pxi":263
 *         """
 *         cdef double value
 *         if self.is_logical():             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VAL, &value))
 *             return value
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_logical, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(5, 263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "amplpy/constraint.pxi":264
 *         cdef double value
 *         if self.is_logical():
 *             PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VAL, &value))             # <<<<<<<<<<<<<<
 *             return value
 *         else:
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_VAL, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 264, __pyx_L1_error)

    /* "amplpy/constraint.pxi":265
 *         if self.is_logical():
 *             PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VAL, &value))
 *             return value             # <<<<<<<<<<<<<<
 *         else:
 *             return None
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/constraint.pxi":263
 *         """
 *         cdef double value
 *         if self.is_logical():             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VAL, &value))
 *             return value
*/
  }

  /* "amplpy/constraint.pxi":267
 *             return value
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "amplpy/constraint.pxi":258
 *         PY_AMPL_CALL(campl.AMPL_ConstraintInstanceSetDual(self._ampl._c_ampl, self._name, self._index, float(dual)))
 * 
 *     def val(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL val suffix. Valid only for logical constraints.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Constraint.val", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_47__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_46__reduce_cython__, "Constraint.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_47__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_47__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_46__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_47__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_46__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_46__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Constraint.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_49__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_10Constraint_48__setstate_cython__, "Constraint.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_10Constraint_49__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_49__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_48__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_10Constraint_49__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Constraint.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_10Constraint_48__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Constraint *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_10Constraint_48__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Constraint *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Constraint.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":28
 *     cdef size_t _index
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         row = Row()
*/

static PyObject *__pyx_f_6amplpy_4ampl_3Row_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index) {
  struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_row = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/dataframe.pxi":30
 *     @staticmethod
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         row = Row()             # <<<<<<<<<<<<<<
 *         row._df = df
 *         row._index = index
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Row);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Row); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 30, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_row = ((struct __pyx_obj_6amplpy_4ampl_Row *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":31
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         row = Row()
 *         row._df = df             # <<<<<<<<<<<<<<
 *         row._index = index
 *         return row
*/
  __pyx_v_row->_df = __pyx_v_df;

  /* "amplpy/dataframe.pxi":32
 *         row = Row()
 *         row._df = df
 *         row._index = index             # <<<<<<<<<<<<<<
 *         return row
 * 
*/
  __pyx_v_row->_index = __pyx_v_index;

  /* "amplpy/dataframe.pxi":33
 *         row._df = df
 *         row._index = index
 *         return row             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_row);
  __pyx_r = ((PyObject *)__pyx_v_row);
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":28
 *     cdef size_t _index
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         row = Row()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Row.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_row);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":35
 *         return row
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_1__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_1__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Row___str__(((struct __pyx_obj_6amplpy_4ampl_Row *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Row___str__(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "amplpy/dataframe.pxi":36
 * 
 *     def __str__(self):
 *         return self.to_string()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_string, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":35
 *         return row
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Row.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":38
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return RowIterator.create(self._df, self._index)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Row_2__iter__(((struct __pyx_obj_6amplpy_4ampl_Row *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Row_2__iter__(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/dataframe.pxi":39
 * 
 *     def __iter__(self):
 *         return RowIterator.create(self._df, self._index)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_11RowIterator_create(__pyx_v_self->_df, __pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":38
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return RowIterator.create(self._df, self._index)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Row.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":41
 *         return RowIterator.create(self._df, self._index)
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_VARIANT* v
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, key, &v))
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Row_4__getitem__(((struct __pyx_obj_6amplpy_4ampl_Row *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Row_4__getitem__(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self, PyObject *__pyx_v_key) {
  AMPL_VARIANT *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/dataframe.pxi":43
 *     def __getitem__(self, key):
 *         cdef campl.AMPL_VARIANT* v
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, key, &v))             # <<<<<<<<<<<<<<
 *         return to_py_variant(v)
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_As_size_t(__pyx_v_key); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameElement(__pyx_v_self->_df, __pyx_v_self->_index, __pyx_t_1, (&__pyx_v_v))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L1_error)

  /* "amplpy/dataframe.pxi":44
 *         cdef campl.AMPL_VARIANT* v
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, key, &v))
 *         return to_py_variant(v)             # <<<<<<<<<<<<<<
 * 
 *     def to_string(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":41
 *         return RowIterator.create(self._df, self._index)
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_VARIANT* v
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, key, &v))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Row.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":46
 *         return to_py_variant(v)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         return str(list(self))
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_7to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Row_6to_string, "Row.to_string(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Row_7to_string = {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Row_7to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Row_6to_string};
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_7to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_string", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_string", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Row_6to_string(((struct __pyx_obj_6amplpy_4ampl_Row *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Row_6to_string(struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_string", 0);

  /* "amplpy/dataframe.pxi":47
 * 
 *     def to_string(self):
 *         return str(list(self))             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":46
 *         return to_py_variant(v)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         return str(list(self))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Row.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Row_8__reduce_cython__, "Row.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Row_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Row_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Row_8__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Row_8__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Row *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Row_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Row.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Row_10__setstate_cython__, "Row.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Row_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Row_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Row_10__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_3Row_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Row.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Row_10__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Row *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Row_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Row *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Row.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":60
 *     cdef size_t _index
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         col = Column()
*/

static PyObject *__pyx_f_6amplpy_4ampl_6Column_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index) {
  struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_col = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/dataframe.pxi":62
 *     @staticmethod
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         col = Column()             # <<<<<<<<<<<<<<
 *         col._df = df
 *         col._index = index
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 62, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_col = ((struct __pyx_obj_6amplpy_4ampl_Column *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":63
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         col = Column()
 *         col._df = df             # <<<<<<<<<<<<<<
 *         col._index = index
 *         return col
*/
  __pyx_v_col->_df = __pyx_v_df;

  /* "amplpy/dataframe.pxi":64
 *         col = Column()
 *         col._df = df
 *         col._index = index             # <<<<<<<<<<<<<<
 *         return col
 * 
*/
  __pyx_v_col->_index = __pyx_v_index;

  /* "amplpy/dataframe.pxi":65
 *         col._df = df
 *         col._index = index
 *         return col             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_col);
  __pyx_r = ((PyObject *)__pyx_v_col);
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":60
 *     cdef size_t _index
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         col = Column()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Column.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_col);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":67
 *         return col
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_1__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_1__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Column___str__(((struct __pyx_obj_6amplpy_4ampl_Column *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Column___str__(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "amplpy/dataframe.pxi":68
 * 
 *     def __str__(self):
 *         return self.to_string()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_string, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":67
 *         return col
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Column.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":70
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ColIterator.create(self._df, self._index)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Column_2__iter__(((struct __pyx_obj_6amplpy_4ampl_Column *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Column_2__iter__(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/dataframe.pxi":71
 * 
 *     def __iter__(self):
 *         return ColIterator.create(self._df, self._index)             # <<<<<<<<<<<<<<
 * 
 *     def to_string(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_11ColIterator_create(__pyx_v_self->_df, __pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":70
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return ColIterator.create(self._df, self._index)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Column.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":73
 *         return ColIterator.create(self._df, self._index)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         return str(self.to_list())
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_5to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Column_4to_string, "Column.to_string(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Column_5to_string = {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_5to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_4to_string};
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_5to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_string", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_string", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Column_4to_string(((struct __pyx_obj_6amplpy_4ampl_Column *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Column_4to_string(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_string", 0);

  /* "amplpy/dataframe.pxi":74
 * 
 *     def to_string(self):
 *         return str(self.to_list())             # <<<<<<<<<<<<<<
 * 
 *     def to_list(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 74, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":73
 *         return ColIterator.create(self._df, self._index)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         return str(self.to_list())
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Column.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":76
 *         return str(self.to_list())
 * 
 *     def to_list(self):             # <<<<<<<<<<<<<<
 *         py_list = []
 *         cdef campl.AMPL_VARIANT* v
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_7to_list(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Column_6to_list, "Column.to_list(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Column_7to_list = {"to_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_7to_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_6to_list};
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_7to_list(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_list (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_list", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_list", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Column_6to_list(((struct __pyx_obj_6amplpy_4ampl_Column *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Column_6to_list(struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self) {
  PyObject *__pyx_v_py_list = NULL;
  AMPL_VARIANT *__pyx_v_v;
  size_t __pyx_v_rowindex;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_list", 0);

  /* "amplpy/dataframe.pxi":77
 * 
 *     def to_list(self):
 *         py_list = []             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_VARIANT* v
 *         cdef size_t rowindex
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":81
 *         cdef size_t rowindex
 *         cdef size_t i
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(self._df, &rowindex))             # <<<<<<<<<<<<<<
 *         for i in range(rowindex):
 *             PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, i, self._index, &v))
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameGetNumRows(__pyx_v_self->_df, (&__pyx_v_rowindex))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 81, __pyx_L1_error)

  /* "amplpy/dataframe.pxi":82
 *         cdef size_t i
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(self._df, &rowindex))
 *         for i in range(rowindex):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, i, self._index, &v))
 *             py_list.append(to_py_variant(v))
*/
  __pyx_t_2 = __pyx_v_rowindex;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "amplpy/dataframe.pxi":83
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(self._df, &rowindex))
 *         for i in range(rowindex):
 *             PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, i, self._index, &v))             # <<<<<<<<<<<<<<
 *             py_list.append(to_py_variant(v))
 *         return py_list
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameElement(__pyx_v_self->_df, __pyx_v_i, __pyx_v_self->_index, (&__pyx_v_v))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 83, __pyx_L1_error)

    /* "amplpy/dataframe.pxi":84
 *         for i in range(rowindex):
 *             PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, i, self._index, &v))
 *             py_list.append(to_py_variant(v))             # <<<<<<<<<<<<<<
 *         return py_list
 * 
*/
    __pyx_t_1 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_py_list, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 84, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "amplpy/dataframe.pxi":85
 *             PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, i, self._index, &v))
 *             py_list.append(to_py_variant(v))
 *         return py_list             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_py_list);
  __pyx_r = __pyx_v_py_list;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":76
 *         return str(self.to_list())
 * 
 *     def to_list(self):             # <<<<<<<<<<<<<<
 *         py_list = []
 *         cdef campl.AMPL_VARIANT* v
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Column.to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Column_8__reduce_cython__, "Column.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Column_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_8__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Column_8__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Column *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Column_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Column.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Column_10__setstate_cython__, "Column.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Column_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_10__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_6Column_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Column.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Column_10__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Column *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Column_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Column *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Column.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":126
 *     cdef campl.AMPL_DATAFRAME* _c_df
 * 
 *     def __cinit__(self, index, columns=tuple(), **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Create a new DataFrame with specifed index and column headers.
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_9DataFrame_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6amplpy_4ampl_9DataFrame_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_columns = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_index,&__pyx_mstate_global->__pyx_n_u_columns,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 126, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 126, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 126, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 1) < 0) __PYX_ERR(1, 126, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k_);
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, i); __PYX_ERR(1, 126, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 126, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 126, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k_);
    }
    __pyx_v_index = values[0];
    __pyx_v_columns = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, __pyx_nargs); __PYX_ERR(1, 126, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame___cinit__(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_index, __pyx_v_columns, __pyx_v_kwargs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_9DataFrame___cinit__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_columns, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  char **__pyx_v_headers;
  size_t __pyx_v_index_size;
  size_t __pyx_v_column_size;
  PyObject *__pyx_v_index_names = NULL;
  PyObject *__pyx_v_column_names = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_temp = NULL;
  PyObject *__pyx_v_col = NULL;
  PyObject *__pyx_7genexpr__pyx_v_col = NULL;
  PyObject *__pyx_8genexpr1__pyx_v_col = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  char const *__pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_index);
  __Pyx_INCREF(__pyx_v_columns);

  /* "amplpy/dataframe.pxi":137
 *         cdef char** headers
 *         cdef size_t index_size, column_size
 *         if index is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(index, str):
 *                 index = (index,)
*/
  __pyx_t_1 = (__pyx_v_index != Py_None);
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":138
 *         cdef size_t index_size, column_size
 *         if index is not None:
 *             if isinstance(index, str):             # <<<<<<<<<<<<<<
 *                 index = (index,)
 *             if isinstance(columns, str):
*/
    __pyx_t_1 = PyUnicode_Check(__pyx_v_index); 
    if (__pyx_t_1) {

      /* "amplpy/dataframe.pxi":139
 *         if index is not None:
 *             if isinstance(index, str):
 *                 index = (index,)             # <<<<<<<<<<<<<<
 *             if isinstance(columns, str):
 *                 columns = (columns,)
*/
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_index);
      __Pyx_GIVEREF(__pyx_v_index);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 139, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "amplpy/dataframe.pxi":138
 *         cdef size_t index_size, column_size
 *         if index is not None:
 *             if isinstance(index, str):             # <<<<<<<<<<<<<<
 *                 index = (index,)
 *             if isinstance(columns, str):
*/
    }

    /* "amplpy/dataframe.pxi":140
 *             if isinstance(index, str):
 *                 index = (index,)
 *             if isinstance(columns, str):             # <<<<<<<<<<<<<<
 *                 columns = (columns,)
 *             index_names = [col[0] if isinstance(col, tuple) else col for col in index]
*/
    __pyx_t_1 = PyUnicode_Check(__pyx_v_columns); 
    if (__pyx_t_1) {

      /* "amplpy/dataframe.pxi":141
 *                 index = (index,)
 *             if isinstance(columns, str):
 *                 columns = (columns,)             # <<<<<<<<<<<<<<
 *             index_names = [col[0] if isinstance(col, tuple) else col for col in index]
 *             column_names = [
*/
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_columns);
      __Pyx_GIVEREF(__pyx_v_columns);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_columns) != (0)) __PYX_ERR(1, 141, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_columns, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "amplpy/dataframe.pxi":140
 *             if isinstance(index, str):
 *                 index = (index,)
 *             if isinstance(columns, str):             # <<<<<<<<<<<<<<
 *                 columns = (columns,)
 *             index_names = [col[0] if isinstance(col, tuple) else col for col in index]
*/
    }

    /* "amplpy/dataframe.pxi":142
 *             if isinstance(columns, str):
 *                 columns = (columns,)
 *             index_names = [col[0] if isinstance(col, tuple) else col for col in index]             # <<<<<<<<<<<<<<
 *             column_names = [
 *                 col[0] if isinstance(col, tuple) else col for col in columns
*/
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 142, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
        __pyx_t_3 = __pyx_v_index; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 142, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 142, __pyx_L8_error)
      }
      for (;;) {
        if (likely(!__pyx_t_5)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 142, __pyx_L8_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_3, __pyx_t_4);
            ++__pyx_t_4;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 142, __pyx_L8_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
            #endif
            ++__pyx_t_4;
          }
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 142, __pyx_L8_error)
        } else {
          __pyx_t_6 = __pyx_t_5(__pyx_t_3);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 142, __pyx_L8_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_col, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_1 = PyTuple_Check(__pyx_7genexpr__pyx_v_col); 
        if (__pyx_t_1) {
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_7genexpr__pyx_v_col, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 142, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = __pyx_t_7;
          __pyx_t_7 = 0;
        } else {
          __Pyx_INCREF(__pyx_7genexpr__pyx_v_col);
          __pyx_t_6 = __pyx_7genexpr__pyx_v_col;
        }
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 142, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_col); __pyx_7genexpr__pyx_v_col = 0;
      goto __pyx_L12_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_col); __pyx_7genexpr__pyx_v_col = 0;
      goto __pyx_L1_error;
      __pyx_L12_exit_scope:;
    } /* exit inner scope */
    __pyx_v_index_names = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":143
 *                 columns = (columns,)
 *             index_names = [col[0] if isinstance(col, tuple) else col for col in index]
 *             column_names = [             # <<<<<<<<<<<<<<
 *                 col[0] if isinstance(col, tuple) else col for col in columns
 *             ]
*/
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 143, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "amplpy/dataframe.pxi":144
 *             index_names = [col[0] if isinstance(col, tuple) else col for col in index]
 *             column_names = [
 *                 col[0] if isinstance(col, tuple) else col for col in columns             # <<<<<<<<<<<<<<
 *             ]
 *             index_size = len(index_names)
*/
      if (likely(PyList_CheckExact(__pyx_v_columns)) || PyTuple_CheckExact(__pyx_v_columns)) {
        __pyx_t_3 = __pyx_v_columns; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_columns); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 144, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 144, __pyx_L15_error)
      }
      for (;;) {
        if (likely(!__pyx_t_5)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 144, __pyx_L15_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_3, __pyx_t_4);
            ++__pyx_t_4;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 144, __pyx_L15_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
            #endif
            ++__pyx_t_4;
          }
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 144, __pyx_L15_error)
        } else {
          __pyx_t_6 = __pyx_t_5(__pyx_t_3);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 144, __pyx_L15_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_col, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_1 = PyTuple_Check(__pyx_8genexpr1__pyx_v_col); 
        if (__pyx_t_1) {
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_col, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 144, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = __pyx_t_7;
          __pyx_t_7 = 0;
        } else {
          __Pyx_INCREF(__pyx_8genexpr1__pyx_v_col);
          __pyx_t_6 = __pyx_8genexpr1__pyx_v_col;
        }
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 143, __pyx_L15_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_col); __pyx_8genexpr1__pyx_v_col = 0;
      goto __pyx_L19_exit_scope;
      __pyx_L15_error:;
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_col); __pyx_8genexpr1__pyx_v_col = 0;
      goto __pyx_L1_error;
      __pyx_L19_exit_scope:;
    } /* exit inner scope */
    __pyx_v_column_names = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":146
 *                 col[0] if isinstance(col, tuple) else col for col in columns
 *             ]
 *             index_size = len(index_names)             # <<<<<<<<<<<<<<
 *             column_size = len(column_names)
 *             headers = <char**> malloc((index_size+column_size) * sizeof(char*))
*/
    __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_v_index_names); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 146, __pyx_L1_error)
    __pyx_v_index_size = __pyx_t_4;

    /* "amplpy/dataframe.pxi":147
 *             ]
 *             index_size = len(index_names)
 *             column_size = len(column_names)             # <<<<<<<<<<<<<<
 *             headers = <char**> malloc((index_size+column_size) * sizeof(char*))
 * 
*/
    __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_v_column_names); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 147, __pyx_L1_error)
    __pyx_v_column_size = __pyx_t_4;

    /* "amplpy/dataframe.pxi":148
 *             index_size = len(index_names)
 *             column_size = len(column_names)
 *             headers = <char**> malloc((index_size+column_size) * sizeof(char*))             # <<<<<<<<<<<<<<
 * 
 *             for i in range(index_size + column_size):
*/
    __pyx_v_headers = ((char **)malloc(((__pyx_v_index_size + __pyx_v_column_size) * (sizeof(char *)))));

    /* "amplpy/dataframe.pxi":150
 *             headers = <char**> malloc((index_size+column_size) * sizeof(char*))
 * 
 *             for i in range(index_size + column_size):             # <<<<<<<<<<<<<<
 *                 if i < index_size:
 *                     temp = index_names[i].encode('utf-8')
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_range);
    __pyx_t_6 = __pyx_builtin_range; 
    __pyx_t_7 = __Pyx_PyLong_FromSize_t((__pyx_v_index_size + __pyx_v_column_size)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 150, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 150, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_6, __pyx_t_4);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 150, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 150, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_6);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 150, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "amplpy/dataframe.pxi":151
 * 
 *             for i in range(index_size + column_size):
 *                 if i < index_size:             # <<<<<<<<<<<<<<
 *                     temp = index_names[i].encode('utf-8')
 *                 else:
*/
      __pyx_t_2 = __Pyx_PyLong_FromSize_t(__pyx_v_index_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_1) {

        /* "amplpy/dataframe.pxi":152
 *             for i in range(index_size + column_size):
 *                 if i < index_size:
 *                     temp = index_names[i].encode('utf-8')             # <<<<<<<<<<<<<<
 *                 else:
 *                     temp = column_names[i - index_size].encode('utf-8')
*/
        __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_index_names, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 152, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_8 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
          __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 152, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_v_temp, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "amplpy/dataframe.pxi":151
 * 
 *             for i in range(index_size + column_size):
 *                 if i < index_size:             # <<<<<<<<<<<<<<
 *                     temp = index_names[i].encode('utf-8')
 *                 else:
*/
        goto __pyx_L22;
      }

      /* "amplpy/dataframe.pxi":154
 *                     temp = index_names[i].encode('utf-8')
 *                 else:
 *                     temp = column_names[i - index_size].encode('utf-8')             # <<<<<<<<<<<<<<
 *                 headers[i] = strdup(temp)
 * 
*/
      /*else*/ {
        __pyx_t_2 = __Pyx_PyLong_FromSize_t(__pyx_v_index_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 154, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = PyNumber_Subtract(__pyx_v_i, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 154, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_column_names, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 154, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_3 = __pyx_t_2;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_8 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
          __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 154, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_XDECREF_SET(__pyx_v_temp, __pyx_t_7);
        __pyx_t_7 = 0;
      }
      __pyx_L22:;

      /* "amplpy/dataframe.pxi":155
 *                 else:
 *                     temp = column_names[i - index_size].encode('utf-8')
 *                 headers[i] = strdup(temp)             # <<<<<<<<<<<<<<
 * 
 *             PY_AMPL_CALL(campl.AMPL_DataFrameCreate(&self._c_df, index_size, column_size, headers))
*/
      __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_temp); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(1, 155, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 155, __pyx_L1_error)
      (__pyx_v_headers[__pyx_t_11]) = strdup(__pyx_t_10);

      /* "amplpy/dataframe.pxi":150
 *             headers = <char**> malloc((index_size+column_size) * sizeof(char*))
 * 
 *             for i in range(index_size + column_size):             # <<<<<<<<<<<<<<
 *                 if i < index_size:
 *                     temp = index_names[i].encode('utf-8')
*/
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "amplpy/dataframe.pxi":157
 *                 headers[i] = strdup(temp)
 * 
 *             PY_AMPL_CALL(campl.AMPL_DataFrameCreate(&self._c_df, index_size, column_size, headers))             # <<<<<<<<<<<<<<
 * 
 *             for i in range(index_size+column_size):
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameCreate((&__pyx_v_self->_c_df), __pyx_v_index_size, __pyx_v_column_size, __pyx_v_headers)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error)

    /* "amplpy/dataframe.pxi":159
 *             PY_AMPL_CALL(campl.AMPL_DataFrameCreate(&self._c_df, index_size, column_size, headers))
 * 
 *             for i in range(index_size+column_size):             # <<<<<<<<<<<<<<
 *                 if headers[i] != NULL:
 *                     free(headers[i])
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_range);
    __pyx_t_2 = __pyx_builtin_range; 
    __pyx_t_3 = __Pyx_PyLong_FromSize_t((__pyx_v_index_size + __pyx_v_column_size)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 159, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_4);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 159, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 159, __pyx_L1_error)
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 159, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "amplpy/dataframe.pxi":160
 * 
 *             for i in range(index_size+column_size):
 *                 if headers[i] != NULL:             # <<<<<<<<<<<<<<
 *                     free(headers[i])
 *             free(headers)
*/
      __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 160, __pyx_L1_error)
      __pyx_t_1 = ((__pyx_v_headers[__pyx_t_11]) != NULL);
      if (__pyx_t_1) {

        /* "amplpy/dataframe.pxi":161
 *             for i in range(index_size+column_size):
 *                 if headers[i] != NULL:
 *                     free(headers[i])             # <<<<<<<<<<<<<<
 *             free(headers)
 * 
*/
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 161, __pyx_L1_error)
        free((__pyx_v_headers[__pyx_t_11]));

        /* "amplpy/dataframe.pxi":160
 * 
 *             for i in range(index_size+column_size):
 *                 if headers[i] != NULL:             # <<<<<<<<<<<<<<
 *                     free(headers[i])
 *             free(headers)
*/
      }

      /* "amplpy/dataframe.pxi":159
 *             PY_AMPL_CALL(campl.AMPL_DataFrameCreate(&self._c_df, index_size, column_size, headers))
 * 
 *             for i in range(index_size+column_size):             # <<<<<<<<<<<<<<
 *                 if headers[i] != NULL:
 *                     free(headers[i])
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":162
 *                 if headers[i] != NULL:
 *                     free(headers[i])
 *             free(headers)             # <<<<<<<<<<<<<<
 * 
 *             for col in index:
*/
    free(__pyx_v_headers);

    /* "amplpy/dataframe.pxi":164
 *             free(headers)
 * 
 *             for col in index:             # <<<<<<<<<<<<<<
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])
*/
    if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
      __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 164, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 164, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 164, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_4);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 164, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 164, __pyx_L1_error)
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 164, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_col, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "amplpy/dataframe.pxi":165
 * 
 *             for col in index:
 *                 if isinstance(col, tuple):             # <<<<<<<<<<<<<<
 *                     self._set_column(col[0], col[1])
 *             for col in columns:
*/
      __pyx_t_1 = PyTuple_Check(__pyx_v_col); 
      if (__pyx_t_1) {

        /* "amplpy/dataframe.pxi":166
 *             for col in index:
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])             # <<<<<<<<<<<<<<
 *             for col in columns:
 *                 if isinstance(col, tuple):
*/
        __pyx_t_3 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_col, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 166, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_col, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 166, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_9};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_column, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 166, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/dataframe.pxi":165
 * 
 *             for col in index:
 *                 if isinstance(col, tuple):             # <<<<<<<<<<<<<<
 *                     self._set_column(col[0], col[1])
 *             for col in columns:
*/
      }

      /* "amplpy/dataframe.pxi":164
 *             free(headers)
 * 
 *             for col in index:             # <<<<<<<<<<<<<<
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":167
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])
 *             for col in columns:             # <<<<<<<<<<<<<<
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])
*/
    if (likely(PyList_CheckExact(__pyx_v_columns)) || PyTuple_CheckExact(__pyx_v_columns)) {
      __pyx_t_2 = __pyx_v_columns; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_columns); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 167, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 167, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_4);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 167, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 167, __pyx_L1_error)
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 167, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_col, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "amplpy/dataframe.pxi":168
 *                     self._set_column(col[0], col[1])
 *             for col in columns:
 *                 if isinstance(col, tuple):             # <<<<<<<<<<<<<<
 *                     self._set_column(col[0], col[1])
 * 
*/
      __pyx_t_1 = PyTuple_Check(__pyx_v_col); 
      if (__pyx_t_1) {

        /* "amplpy/dataframe.pxi":169
 *             for col in columns:
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])             # <<<<<<<<<<<<<<
 * 
 *     cdef campl.AMPL_DATAFRAME* get_ptr(self):
*/
        __pyx_t_9 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_9);
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_col, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_col, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_3};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_column, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 169, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/dataframe.pxi":168
 *                     self._set_column(col[0], col[1])
 *             for col in columns:
 *                 if isinstance(col, tuple):             # <<<<<<<<<<<<<<
 *                     self._set_column(col[0], col[1])
 * 
*/
      }

      /* "amplpy/dataframe.pxi":167
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])
 *             for col in columns:             # <<<<<<<<<<<<<<
 *                 if isinstance(col, tuple):
 *                     self._set_column(col[0], col[1])
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":137
 *         cdef char** headers
 *         cdef size_t index_size, column_size
 *         if index is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(index, str):
 *                 index = (index,)
*/
  }

  /* "amplpy/dataframe.pxi":126
 *     cdef campl.AMPL_DATAFRAME* _c_df
 * 
 *     def __cinit__(self, index, columns=tuple(), **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Create a new DataFrame with specifed index and column headers.
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index_names);
  __Pyx_XDECREF(__pyx_v_column_names);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_temp);
  __Pyx_XDECREF(__pyx_v_col);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_col);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_col);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_columns);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":171
 *                     self._set_column(col[0], col[1])
 * 
 *     cdef campl.AMPL_DATAFRAME* get_ptr(self):             # <<<<<<<<<<<<<<
 *         return self._c_df
 * 
*/

static AMPL_DATAFRAME *__pyx_f_6amplpy_4ampl_9DataFrame_get_ptr(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  AMPL_DATAFRAME *__pyx_r;

  /* "amplpy/dataframe.pxi":172
 * 
 *     cdef campl.AMPL_DATAFRAME* get_ptr(self):
 *         return self._c_df             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __pyx_r = __pyx_v_self->_c_df;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":171
 *                     self._set_column(col[0], col[1])
 * 
 *     cdef campl.AMPL_DATAFRAME* get_ptr(self):             # <<<<<<<<<<<<<<
 *         return self._c_df
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":174
 *         return self._c_df
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df_c):
 *         df = DataFrame(index=None)
*/

static PyObject *__pyx_f_6amplpy_4ampl_9DataFrame_create(AMPL_DATAFRAME *__pyx_v_df_c) {
  struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_df = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/dataframe.pxi":176
 *     @staticmethod
 *     cdef create(campl.AMPL_DATAFRAME* df_c):
 *         df = DataFrame(index=None)             # <<<<<<<<<<<<<<
 *         df._c_df = df_c
 *         return df
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_None, __pyx_t_5, __pyx_callargs+1, 0) < 0) __PYX_ERR(1, 176, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 176, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_df = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":177
 *     cdef create(campl.AMPL_DATAFRAME* df_c):
 *         df = DataFrame(index=None)
 *         df._c_df = df_c             # <<<<<<<<<<<<<<
 *         return df
 * 
*/
  __pyx_v_df->_c_df = __pyx_v_df_c;

  /* "amplpy/dataframe.pxi":178
 *         df = DataFrame(index=None)
 *         df._c_df = df_c
 *         return df             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_df);
  __pyx_r = ((PyObject *)__pyx_v_df);
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":174
 *         return self._c_df
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df_c):
 *         df = DataFrame(index=None)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_df);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":180
 *         return df
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Default destructor:
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_9DataFrame_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_9DataFrame_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_9DataFrame_2__dealloc__(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_9DataFrame_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {

  /* "amplpy/dataframe.pxi":185
 *         releases all the resources related to the Dataframe instance.
 *         """
 *         campl.AMPL_DataFrameFree(&self._c_df)             # <<<<<<<<<<<<<<
 * 
 *     def to_string(self):
*/
  AMPL_DataFrameFree((&__pyx_v_self->_c_df));

  /* "amplpy/dataframe.pxi":180
 *         return df
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Default destructor:
*/

  /* function exit code */
}

/* "amplpy/dataframe.pxi":187
 *         campl.AMPL_DataFrameFree(&self._c_df)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef char* value_c
 *         PY_AMPL_CALL(campl.AMPL_DataFrameToString(self._c_df, &value_c))
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_5to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_4to_string, "DataFrame.to_string(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_5to_string = {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_5to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_4to_string};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_5to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_string", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_string", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_4to_string(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_4to_string(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_string", 0);

  /* "amplpy/dataframe.pxi":189
 *     def to_string(self):
 *         cdef char* value_c
 *         PY_AMPL_CALL(campl.AMPL_DataFrameToString(self._c_df, &value_c))             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameToString(__pyx_v_self->_c_df, (&__pyx_v_value_c))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 189, __pyx_L1_error)

  /* "amplpy/dataframe.pxi":190
 *         cdef char* value_c
 *         PY_AMPL_CALL(campl.AMPL_DataFrameToString(self._c_df, &value_c))
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 *         return value
*/
  __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 190, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_1, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_value = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/dataframe.pxi":191
 *         PY_AMPL_CALL(campl.AMPL_DataFrameToString(self._c_df, &value_c))
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/dataframe.pxi":192
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":187
 *         campl.AMPL_DataFrameFree(&self._c_df)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef char* value_c
 *         PY_AMPL_CALL(campl.AMPL_DataFrameToString(self._c_df, &value_c))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":194
 *         return value
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_7__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_6__str__(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_6__str__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "amplpy/dataframe.pxi":195
 * 
 *     def __str__(self):
 *         return self.to_string()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_string, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":194
 *         return value
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":197
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         # FIXME: C++ iterators for dataframes not working with SWIG.
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_8__iter__(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_8__iter___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/dataframe.pxi":199
 *     def __iter__(self):
 *         # FIXME: C++ iterators for dataframes not working with SWIG.
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))             # <<<<<<<<<<<<<<
 * 
 *     def _get_num_cols(self):
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_8__iter___genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 199, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9DataFrame_8__iter___2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_iter___locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(1, 199, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__iter__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_8__iter___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(1, 199, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(1, 199, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 199, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 199, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 199, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 199, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 199, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(1, 199, __pyx_L1_error) }
    __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_i};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_row_by_index, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 199, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":197
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         # FIXME: C++ iterators for dataframes not working with SWIG.
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_8__iter__(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *__pyx_cur_scope;
  PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_8__iter___2generator = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct____iter__(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 197, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "amplpy/dataframe.pxi":199
 *     def __iter__(self):
 *         # FIXME: C++ iterators for dataframes not working with SWIG.
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))             # <<<<<<<<<<<<<<
 * 
 *     def _get_num_cols(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_range);
  __pyx_t_3 = __pyx_builtin_range; 
  __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_rows, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = __pyx_pf_6amplpy_4ampl_9DataFrame_8__iter___genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":197
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         # FIXME: C++ iterators for dataframes not working with SWIG.
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9DataFrame_8__iter___2generator);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":201
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))
 * 
 *     def _get_num_cols(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the total number of columns in this dataframe (indexarity + number
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_11_get_num_cols(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_10_get_num_cols, "DataFrame._get_num_cols(self)\nGet the total number of columns in this dataframe (indexarity + number\nof values).\n\nReturns:\n    The number of columns.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_11_get_num_cols = {"_get_num_cols", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_11_get_num_cols, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_10_get_num_cols};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_11_get_num_cols(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_num_cols (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_get_num_cols", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_get_num_cols", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_10_get_num_cols(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_10_get_num_cols(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  size_t __pyx_v_num;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_num_cols", 0);

  /* "amplpy/dataframe.pxi":210
 *         """
 *         cdef size_t num
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumCols(self._c_df, &num))             # <<<<<<<<<<<<<<
 *         return int(num)
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameGetNumCols(__pyx_v_self->_c_df, (&__pyx_v_num))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 210, __pyx_L1_error)

  /* "amplpy/dataframe.pxi":211
 *         cdef size_t num
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumCols(self._c_df, &num))
 *         return int(num)             # <<<<<<<<<<<<<<
 * 
 *     def _get_num_rows(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":201
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))
 * 
 *     def _get_num_cols(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the total number of columns in this dataframe (indexarity + number
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_num_cols", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":213
 *         return int(num)
 * 
 *     def _get_num_rows(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of data rows in this dataframe.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_13_get_num_rows(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_12_get_num_rows, "DataFrame._get_num_rows(self)\nGet the number of data rows in this dataframe.\n\nReturns:\n    The number of rows.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_13_get_num_rows = {"_get_num_rows", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_13_get_num_rows, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_12_get_num_rows};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_13_get_num_rows(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_num_rows (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_get_num_rows", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_get_num_rows", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_12_get_num_rows(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_12_get_num_rows(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  size_t __pyx_v_num;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_num_rows", 0);

  /* "amplpy/dataframe.pxi":221
 *         """
 *         cdef size_t num
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(self._c_df, &num))             # <<<<<<<<<<<<<<
 *         return int(num)
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameGetNumRows(__pyx_v_self->_c_df, (&__pyx_v_num))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 221, __pyx_L1_error)

  /* "amplpy/dataframe.pxi":222
 *         cdef size_t num
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(self._c_df, &num))
 *         return int(num)             # <<<<<<<<<<<<<<
 * 
 *     def _get_num_indices(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":213
 *         return int(num)
 * 
 *     def _get_num_rows(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of data rows in this dataframe.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_num_rows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":224
 *         return int(num)
 * 
 *     def _get_num_indices(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of indices (the indexarity) of this dataframe.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_15_get_num_indices(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_14_get_num_indices, "DataFrame._get_num_indices(self)\nGet the number of indices (the indexarity) of this dataframe.\n\nReturns:\n    The number of indices needed to access one row of this dataframe.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_15_get_num_indices = {"_get_num_indices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_15_get_num_indices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_14_get_num_indices};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_15_get_num_indices(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_num_indices (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_get_num_indices", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_get_num_indices", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_14_get_num_indices(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_14_get_num_indices(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  size_t __pyx_v_num;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_num_indices", 0);

  /* "amplpy/dataframe.pxi":232
 *         """
 *         cdef size_t num
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumIndices(self._c_df, &num))             # <<<<<<<<<<<<<<
 *         return int(num)
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameGetNumIndices(__pyx_v_self->_c_df, (&__pyx_v_num))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 232, __pyx_L1_error)

  /* "amplpy/dataframe.pxi":233
 *         cdef size_t num
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumIndices(self._c_df, &num))
 *         return int(num)             # <<<<<<<<<<<<<<
 * 
 *     def _add_row(self, *value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":224
 *         return int(num)
 * 
 *     def _get_num_indices(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of indices (the indexarity) of this dataframe.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_num_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":235
 *         return int(num)
 * 
 *     def _add_row(self, *value):             # <<<<<<<<<<<<<<
 *         """
 *         Add a row to the DataFrame. The size of the tuple must be equal to the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_17_add_row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_16_add_row, "DataFrame._add_row(self, *value)\nAdd a row to the DataFrame. The size of the tuple must be equal to the\ntotal number of columns in the dataframe.\n\nArgs:\n   value: A single argument with a tuple containing all the values\n   for the row to be added, or multiple arguments with the values for\n   each column.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_17_add_row = {"_add_row", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_17_add_row, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_16_add_row};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_17_add_row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_value = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_add_row (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_add_row", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_value = __pyx_args;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_16_add_row(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_value);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_16_add_row(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_value) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_TUPLE *__pyx_v_tuple_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  AMPL_TUPLE *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_add_row", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "amplpy/dataframe.pxi":246
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         if len(value) == 1 and isinstance(value[0], (tuple, list)):             # <<<<<<<<<<<<<<
 *             value = value[0]
 *         assert len(value) == self._get_num_cols()
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 246, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 == 1);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_Check(__pyx_t_4); 
  if (!__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = PyList_Check(__pyx_t_4); 
  __pyx_t_3 = __pyx_t_5;
  __pyx_L6_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":247
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         if len(value) == 1 and isinstance(value[0], (tuple, list)):
 *             value = value[0]             # <<<<<<<<<<<<<<
 *         assert len(value) == self._get_num_cols()
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(tuple(value))
*/
    __pyx_t_4 = __Pyx_PyTuple_GET_ITEM(__pyx_v_value, 0);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "amplpy/dataframe.pxi":246
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         if len(value) == 1 and isinstance(value[0], (tuple, list)):             # <<<<<<<<<<<<<<
 *             value = value[0]
 *         assert len(value) == self._get_num_cols()
*/
  }

  /* "amplpy/dataframe.pxi":248
 *         if len(value) == 1 and isinstance(value[0], (tuple, list)):
 *             value = value[0]
 *         assert len(value) == self._get_num_cols()             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(tuple(value))
 *         errorinfo = campl.AMPL_DataFrameAddRow(self._c_df, tuple_c)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 248, __pyx_L1_error)
    __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_cols, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 248, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 248, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 248, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 248, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":249
 *             value = value[0]
 *         assert len(value) == self._get_num_cols()
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(tuple(value))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_DataFrameAddRow(self._c_df, tuple_c)
 *         campl.AMPL_TupleFree(&tuple_c)
*/
  __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_t_7); if (unlikely(__pyx_t_9 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(1, 249, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_tuple_c = __pyx_t_9;

  /* "amplpy/dataframe.pxi":250
 *         assert len(value) == self._get_num_cols()
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(tuple(value))
 *         errorinfo = campl.AMPL_DataFrameAddRow(self._c_df, tuple_c)             # <<<<<<<<<<<<<<
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:
*/
  __pyx_v_errorinfo = AMPL_DataFrameAddRow(__pyx_v_self->_c_df, __pyx_v_tuple_c);

  /* "amplpy/dataframe.pxi":251
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(tuple(value))
 *         errorinfo = campl.AMPL_DataFrameAddRow(self._c_df, tuple_c)
 *         campl.AMPL_TupleFree(&tuple_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  (void)(AMPL_TupleFree((&__pyx_v_tuple_c)));

  /* "amplpy/dataframe.pxi":252
 *         errorinfo = campl.AMPL_DataFrameAddRow(self._c_df, tuple_c)
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":253
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *     def _add_column(self, header, values=None):
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 253, __pyx_L1_error)

    /* "amplpy/dataframe.pxi":252
 *         errorinfo = campl.AMPL_DataFrameAddRow(self._c_df, tuple_c)
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  }

  /* "amplpy/dataframe.pxi":235
 *         return int(num)
 * 
 *     def _add_row(self, *value):             # <<<<<<<<<<<<<<
 *         """
 *         Add a row to the DataFrame. The size of the tuple must be equal to the
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._add_row", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":255
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def _add_column(self, header, values=None):             # <<<<<<<<<<<<<<
 *         """
 *         Add a new column with the corresponding header and values to the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_19_add_column(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_18_add_column, "DataFrame._add_column(self, header, values=None)\nAdd a new column with the corresponding header and values to the\ndataframe.\n\nArgs:\n    header: The name of the new column.\n\n    values: A list of size :func:`~amplpy.DataFrame.getNumRows` with\n    all the values of the new column.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_19_add_column = {"_add_column", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_19_add_column, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_18_add_column};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_19_add_column(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_header = 0;
  PyObject *__pyx_v_values = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_add_column (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_header,&__pyx_mstate_global->__pyx_n_u_values,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 255, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 255, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 255, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_add_column", 0) < 0) __PYX_ERR(1, 255, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_add_column", 0, 1, 2, i); __PYX_ERR(1, 255, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 255, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 255, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_header = values[0];
    __pyx_v_values = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_add_column", 0, 1, 2, __pyx_nargs); __PYX_ERR(1, 255, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._add_column", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_18_add_column(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_header, __pyx_v_values);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/dataframe.pxi":276
 *         else:
 *             assert len(values) == self._get_num_rows()
 *             if any(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
 *                 if not isinstance(values, (list, tuple)):
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_11_add_column_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_2_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 276, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_2generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_add_column_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(1, 276, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._add_column.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 276, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(1, 276, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 276, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 276, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 276, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 276, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = PyUnicode_Check(__pyx_cur_scope->__pyx_v_value); 
    if (__pyx_t_5) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/dataframe.pxi":289
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 c_double_array = <double*> malloc(size * sizeof(double))
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_11_add_column_3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 289, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_5generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_add_column_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(1, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._add_column.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 289, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(1, 289, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 289, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 289, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 289, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 289, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 289, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":255
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def _add_column(self, header, values=None):             # <<<<<<<<<<<<<<
 *         """
 *         Add a new column with the corresponding header and values to the
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_18_add_column(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_header, PyObject *__pyx_v_values) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  size_t __pyx_v_size;
  char const **__pyx_v_c_string_array;
  double *__pyx_v_c_double_array;
  size_t __pyx_v_i;
  PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_2generator1 = 0;
  PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_5generator2 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  size_t __pyx_t_9;
  size_t __pyx_t_10;
  size_t __pyx_t_11;
  char const *__pyx_t_12;
  char const *__pyx_t_13;
  double __pyx_t_14;
  char const *__pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_add_column", 0);
  __Pyx_INCREF(__pyx_v_values);

  /* "amplpy/dataframe.pxi":267
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef size_t size = len(values)             # <<<<<<<<<<<<<<
 *         cdef const char** c_string_array = NULL
 *         cdef double* c_double_array = NULL
*/
  __pyx_t_1 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 267, __pyx_L1_error)
  __pyx_v_size = __pyx_t_1;

  /* "amplpy/dataframe.pxi":268
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef size_t size = len(values)
 *         cdef const char** c_string_array = NULL             # <<<<<<<<<<<<<<
 *         cdef double* c_double_array = NULL
 *         if values is None:
*/
  __pyx_v_c_string_array = NULL;

  /* "amplpy/dataframe.pxi":269
 *         cdef size_t size = len(values)
 *         cdef const char** c_string_array = NULL
 *         cdef double* c_double_array = NULL             # <<<<<<<<<<<<<<
 *         if values is None:
 *             values = []
*/
  __pyx_v_c_double_array = NULL;

  /* "amplpy/dataframe.pxi":270
 *         cdef const char** c_string_array = NULL
 *         cdef double* c_double_array = NULL
 *         if values is None:             # <<<<<<<<<<<<<<
 *             values = []
 *         if size == 0:
*/
  __pyx_t_2 = (__pyx_v_values == Py_None);
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":271
 *         cdef double* c_double_array = NULL
 *         if values is None:
 *             values = []             # <<<<<<<<<<<<<<
 *         if size == 0:
 *             PY_AMPL_CALL(campl.AMPL_DataFrameAddEmptyColumn(self._c_df, header.encode('utf-8')))
*/
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "amplpy/dataframe.pxi":270
 *         cdef const char** c_string_array = NULL
 *         cdef double* c_double_array = NULL
 *         if values is None:             # <<<<<<<<<<<<<<
 *             values = []
 *         if size == 0:
*/
  }

  /* "amplpy/dataframe.pxi":272
 *         if values is None:
 *             values = []
 *         if size == 0:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_DataFrameAddEmptyColumn(self._c_df, header.encode('utf-8')))
 *         else:
*/
  __pyx_t_2 = (__pyx_v_size == 0);
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":273
 *             values = []
 *         if size == 0:
 *             PY_AMPL_CALL(campl.AMPL_DataFrameAddEmptyColumn(self._c_df, header.encode('utf-8')))             # <<<<<<<<<<<<<<
 *         else:
 *             assert len(values) == self._get_num_rows()
*/
    __pyx_t_4 = __pyx_v_header;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(1, 273, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameAddEmptyColumn(__pyx_v_self->_c_df, __pyx_t_6)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 273, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "amplpy/dataframe.pxi":272
 *         if values is None:
 *             values = []
 *         if size == 0:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_DataFrameAddEmptyColumn(self._c_df, header.encode('utf-8')))
 *         else:
*/
    goto __pyx_L4;
  }

  /* "amplpy/dataframe.pxi":275
 *             PY_AMPL_CALL(campl.AMPL_DataFrameAddEmptyColumn(self._c_df, header.encode('utf-8')))
 *         else:
 *             assert len(values) == self._get_num_rows()             # <<<<<<<<<<<<<<
 *             if any(isinstance(value, str) for value in values):
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
*/
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 275, __pyx_L1_error)
      __pyx_t_3 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_rows, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 275, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 275, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(1, 275, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(1, 275, __pyx_L1_error)
    #endif

    /* "amplpy/dataframe.pxi":276
 *         else:
 *             assert len(values) == self._get_num_rows()
 *             if any(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
 *                 if not isinstance(values, (list, tuple)):
*/
    __pyx_t_7 = __pyx_pf_6amplpy_4ampl_9DataFrame_11_add_column_genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_Generator_GetInlinedResult(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 276, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "amplpy/dataframe.pxi":277
 *             assert len(values) == self._get_num_rows()
 *             if any(isinstance(value, str) for value in values):
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/
      __pyx_v_c_string_array = ((char const **)malloc((__pyx_v_size * (sizeof(char const *)))));

      /* "amplpy/dataframe.pxi":278
 *             if any(isinstance(value, str) for value in values):
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
 *                 if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *                     values = list(values)
 *                 for i in range(size):
*/
      __pyx_t_8 = PyList_Check(__pyx_v_values); 
      if (!__pyx_t_8) {
      } else {
        __pyx_t_2 = __pyx_t_8;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_8 = PyTuple_Check(__pyx_v_values); 
      __pyx_t_2 = __pyx_t_8;
      __pyx_L7_bool_binop_done:;
      __pyx_t_8 = (!__pyx_t_2);
      if (__pyx_t_8) {

        /* "amplpy/dataframe.pxi":279
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)             # <<<<<<<<<<<<<<
 *                 for i in range(size):
 *                     c_string_array[i] = strdup(values[i].encode('utf-8'))
*/
        __pyx_t_4 = PySequence_List(__pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 279, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "amplpy/dataframe.pxi":278
 *             if any(isinstance(value, str) for value in values):
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
 *                 if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *                     values = list(values)
 *                 for i in range(size):
*/
      }

      /* "amplpy/dataframe.pxi":280
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
 *                 for i in range(size):             # <<<<<<<<<<<<<<
 *                     c_string_array[i] = strdup(values[i].encode('utf-8'))
 *                 errorinfo = campl.AMPL_DataFrameAddColumnString(self._c_df, header.encode('utf-8'), c_string_array)
*/
      __pyx_t_5 = __pyx_v_size;
      __pyx_t_9 = __pyx_t_5;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
        __pyx_v_i = __pyx_t_10;

        /* "amplpy/dataframe.pxi":281
 *                     values = list(values)
 *                 for i in range(size):
 *                     c_string_array[i] = strdup(values[i].encode('utf-8'))             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_DataFrameAddColumnString(self._c_df, header.encode('utf-8'), c_string_array)
 *                 for i in range(size):
*/
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 281, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = __pyx_t_3;
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_11 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_utf_8};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(1, 281, __pyx_L1_error)
        (__pyx_v_c_string_array[__pyx_v_i]) = strdup(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }

      /* "amplpy/dataframe.pxi":282
 *                 for i in range(size):
 *                     c_string_array[i] = strdup(values[i].encode('utf-8'))
 *                 errorinfo = campl.AMPL_DataFrameAddColumnString(self._c_df, header.encode('utf-8'), c_string_array)             # <<<<<<<<<<<<<<
 *                 for i in range(size):
 *                     if c_string_array[i] != NULL:
*/
      __pyx_t_3 = __pyx_v_header;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 282, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_13 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) __PYX_ERR(1, 282, __pyx_L1_error)
      __pyx_v_errorinfo = AMPL_DataFrameAddColumnString(__pyx_v_self->_c_df, __pyx_t_13, __pyx_v_c_string_array);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "amplpy/dataframe.pxi":283
 *                     c_string_array[i] = strdup(values[i].encode('utf-8'))
 *                 errorinfo = campl.AMPL_DataFrameAddColumnString(self._c_df, header.encode('utf-8'), c_string_array)
 *                 for i in range(size):             # <<<<<<<<<<<<<<
 *                     if c_string_array[i] != NULL:
 *                         free(c_string_array[i])
*/
      __pyx_t_5 = __pyx_v_size;
      __pyx_t_9 = __pyx_t_5;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
        __pyx_v_i = __pyx_t_10;

        /* "amplpy/dataframe.pxi":284
 *                 errorinfo = campl.AMPL_DataFrameAddColumnString(self._c_df, header.encode('utf-8'), c_string_array)
 *                 for i in range(size):
 *                     if c_string_array[i] != NULL:             # <<<<<<<<<<<<<<
 *                         free(c_string_array[i])
 *                 free(c_string_array)
*/
        __pyx_t_8 = ((__pyx_v_c_string_array[__pyx_v_i]) != NULL);
        if (__pyx_t_8) {

          /* "amplpy/dataframe.pxi":285
 *                 for i in range(size):
 *                     if c_string_array[i] != NULL:
 *                         free(c_string_array[i])             # <<<<<<<<<<<<<<
 *                 free(c_string_array)
 *                 if errorinfo:
*/
          free((__pyx_v_c_string_array[__pyx_v_i]));

          /* "amplpy/dataframe.pxi":284
 *                 errorinfo = campl.AMPL_DataFrameAddColumnString(self._c_df, header.encode('utf-8'), c_string_array)
 *                 for i in range(size):
 *                     if c_string_array[i] != NULL:             # <<<<<<<<<<<<<<
 *                         free(c_string_array[i])
 *                 free(c_string_array)
*/
        }
      }

      /* "amplpy/dataframe.pxi":286
 *                     if c_string_array[i] != NULL:
 *                         free(c_string_array[i])
 *                 free(c_string_array)             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      free(__pyx_v_c_string_array);

      /* "amplpy/dataframe.pxi":287
 *                         free(c_string_array[i])
 *                 free(c_string_array)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):
*/
      __pyx_t_8 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_8) {

        /* "amplpy/dataframe.pxi":288
 *                 free(c_string_array)
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *             elif all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 288, __pyx_L1_error)

        /* "amplpy/dataframe.pxi":287
 *                         free(c_string_array[i])
 *                 free(c_string_array)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):
*/
      }

      /* "amplpy/dataframe.pxi":276
 *         else:
 *             assert len(values) == self._get_num_rows()
 *             if any(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 c_string_array = <const char**> malloc(size * sizeof(const char*))
 *                 if not isinstance(values, (list, tuple)):
*/
      goto __pyx_L5;
    }

    /* "amplpy/dataframe.pxi":289
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 c_double_array = <double*> malloc(size * sizeof(double))
*/
    __pyx_t_4 = __pyx_pf_6amplpy_4ampl_9DataFrame_11_add_column_3genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(__pyx_t_8)) {

      /* "amplpy/dataframe.pxi":290
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))             # <<<<<<<<<<<<<<
 *                 c_double_array = <double*> malloc(size * sizeof(double))
 *                 for i in range(size):
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_map);
      __pyx_t_7 = __pyx_builtin_map; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)(&PyFloat_Type)), __pyx_v_values};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 290, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_7 = __Pyx_PySequence_ListKeepNew(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "amplpy/dataframe.pxi":291
 *             elif all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))
 *                 c_double_array = <double*> malloc(size * sizeof(double))             # <<<<<<<<<<<<<<
 *                 for i in range(size):
 *                     c_double_array[i] = values[i]
*/
      __pyx_v_c_double_array = ((double *)malloc((__pyx_v_size * (sizeof(double)))));

      /* "amplpy/dataframe.pxi":292
 *                 values = list(map(float, values))
 *                 c_double_array = <double*> malloc(size * sizeof(double))
 *                 for i in range(size):             # <<<<<<<<<<<<<<
 *                     c_double_array[i] = values[i]
 *                 errorinfo = campl.AMPL_DataFrameAddColumnDouble(self._c_df, header.encode('utf-8'), c_double_array)
*/
      __pyx_t_5 = __pyx_v_size;
      __pyx_t_9 = __pyx_t_5;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
        __pyx_v_i = __pyx_t_10;

        /* "amplpy/dataframe.pxi":293
 *                 c_double_array = <double*> malloc(size * sizeof(double))
 *                 for i in range(size):
 *                     c_double_array[i] = values[i]             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_DataFrameAddColumnDouble(self._c_df, header.encode('utf-8'), c_double_array)
 *                 free(c_double_array)
*/
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_14 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 293, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        (__pyx_v_c_double_array[__pyx_v_i]) = __pyx_t_14;
      }

      /* "amplpy/dataframe.pxi":294
 *                 for i in range(size):
 *                     c_double_array[i] = values[i]
 *                 errorinfo = campl.AMPL_DataFrameAddColumnDouble(self._c_df, header.encode('utf-8'), c_double_array)             # <<<<<<<<<<<<<<
 *                 free(c_double_array)
 *                 if errorinfo:
*/
      __pyx_t_3 = __pyx_v_header;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
        __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 294, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_t_7); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(1, 294, __pyx_L1_error)
      __pyx_v_errorinfo = AMPL_DataFrameAddColumnDouble(__pyx_v_self->_c_df, __pyx_t_15, __pyx_v_c_double_array);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "amplpy/dataframe.pxi":295
 *                     c_double_array[i] = values[i]
 *                 errorinfo = campl.AMPL_DataFrameAddColumnDouble(self._c_df, header.encode('utf-8'), c_double_array)
 *                 free(c_double_array)             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      free(__pyx_v_c_double_array);

      /* "amplpy/dataframe.pxi":296
 *                 errorinfo = campl.AMPL_DataFrameAddColumnDouble(self._c_df, header.encode('utf-8'), c_double_array)
 *                 free(c_double_array)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
*/
      __pyx_t_8 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_8) {

        /* "amplpy/dataframe.pxi":297
 *                 free(c_double_array)
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise NotImplementedError
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 297, __pyx_L1_error)

        /* "amplpy/dataframe.pxi":296
 *                 errorinfo = campl.AMPL_DataFrameAddColumnDouble(self._c_df, header.encode('utf-8'), c_double_array)
 *                 free(c_double_array)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
*/
      }

      /* "amplpy/dataframe.pxi":289
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 c_double_array = <double*> malloc(size * sizeof(double))
*/
      goto __pyx_L5;
    }

    /* "amplpy/dataframe.pxi":299
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
 *                 raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def _get_column(self, header):
*/
    /*else*/ {
      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 299, __pyx_L1_error)
    }
    __pyx_L5:;
  }
  __pyx_L4:;

  /* "amplpy/dataframe.pxi":255
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def _add_column(self, header, values=None):             # <<<<<<<<<<<<<<
 *         """
 *         Add a new column with the corresponding header and values to the
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._add_column", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_2generator1);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9DataFrame_11_add_column_5generator2);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":301
 *                 raise NotImplementedError
 * 
 *     def _get_column(self, header):             # <<<<<<<<<<<<<<
 *         """
 *         Get the specified column as a view object.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_21_get_column(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_20_get_column, "DataFrame._get_column(self, header)\nGet the specified column as a view object.\n\nArgs:\n    header: The header of the column.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_21_get_column = {"_get_column", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_21_get_column, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_20_get_column};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_21_get_column(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_header = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_column (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_header,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 301, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 301, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_column", 0) < 0) __PYX_ERR(1, 301, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_column", 1, 1, 1, i); __PYX_ERR(1, 301, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 301, __pyx_L3_error)
    }
    __pyx_v_header = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_column", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 301, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_column", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_20_get_column(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_header);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_20_get_column(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_header) {
  size_t __pyx_v_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_column", 0);

  /* "amplpy/dataframe.pxi":309
 *         """
 *         cdef size_t index
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetColumnIndex(self._c_df, header.encode('utf-8'), &index))             # <<<<<<<<<<<<<<
 *         return Column.create(self._c_df, index)
 * 
*/
  __pyx_t_2 = __pyx_v_header;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 309, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameGetColumnIndex(__pyx_v_self->_c_df, __pyx_t_4, (&__pyx_v_index))); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 309, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":310
 *         cdef size_t index
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetColumnIndex(self._c_df, header.encode('utf-8'), &index))
 *         return Column.create(self._c_df, index)             # <<<<<<<<<<<<<<
 * 
 *     def _set_column(self, header, values):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_6Column_create(__pyx_v_self->_c_df, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":301
 *                 raise NotImplementedError
 * 
 *     def _get_column(self, header):             # <<<<<<<<<<<<<<
 *         """
 *         Get the specified column as a view object.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_column", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":312
 *         return Column.create(self._c_df, index)
 * 
 *     def _set_column(self, header, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of a column.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_23_set_column(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_22_set_column, "DataFrame._set_column(self, header, values)\nSet the values of a column.\n\nArgs:\n    header: The header of the column to be set.\n\n    values: The values to set.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_23_set_column = {"_set_column", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_23_set_column, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_22_set_column};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_23_set_column(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_header = 0;
  PyObject *__pyx_v_values = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_column (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_header,&__pyx_mstate_global->__pyx_n_u_values,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 312, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 312, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 312, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_set_column", 0) < 0) __PYX_ERR(1, 312, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_set_column", 1, 2, 2, i); __PYX_ERR(1, 312, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 312, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 312, __pyx_L3_error)
    }
    __pyx_v_header = values[0];
    __pyx_v_values = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_column", 1, 2, 2, __pyx_nargs); __PYX_ERR(1, 312, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._set_column", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_22_set_column(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_header, __pyx_v_values);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_22_set_column(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_header, PyObject *__pyx_v_values) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  double *__pyx_v_c_double_array;
  char **__pyx_v_c_string_array;
  size_t __pyx_v_size;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  char const *__pyx_t_10;
  char const *__pyx_t_11;
  long __pyx_t_12;
  double __pyx_t_13;
  char const *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_column", 0);

  /* "amplpy/dataframe.pxi":322
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef double* c_double_array = NULL             # <<<<<<<<<<<<<<
 *         cdef char** c_string_array = NULL
 *         cdef size_t size = len(values)
*/
  __pyx_v_c_double_array = NULL;

  /* "amplpy/dataframe.pxi":323
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef double* c_double_array = NULL
 *         cdef char** c_string_array = NULL             # <<<<<<<<<<<<<<
 *         cdef size_t size = len(values)
 *         if isinstance(values[0], str):
*/
  __pyx_v_c_string_array = NULL;

  /* "amplpy/dataframe.pxi":324
 *         cdef double* c_double_array = NULL
 *         cdef char** c_string_array = NULL
 *         cdef size_t size = len(values)             # <<<<<<<<<<<<<<
 *         if isinstance(values[0], str):
 *             c_string_array = <char**> malloc(size * sizeof(char*))
*/
  __pyx_t_1 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 324, __pyx_L1_error)
  __pyx_v_size = __pyx_t_1;

  /* "amplpy/dataframe.pxi":325
 *         cdef char** c_string_array = NULL
 *         cdef size_t size = len(values)
 *         if isinstance(values[0], str):             # <<<<<<<<<<<<<<
 *             c_string_array = <char**> malloc(size * sizeof(char*))
 *             for i in range(size):
*/
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyUnicode_Check(__pyx_t_2); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "amplpy/dataframe.pxi":326
 *         cdef size_t size = len(values)
 *         if isinstance(values[0], str):
 *             c_string_array = <char**> malloc(size * sizeof(char*))             # <<<<<<<<<<<<<<
 *             for i in range(size):
 *                 c_string_array[i] = strdup(values[i].encode('utf-8'))
*/
    __pyx_v_c_string_array = ((char **)malloc((__pyx_v_size * (sizeof(char *)))));

    /* "amplpy/dataframe.pxi":327
 *         if isinstance(values[0], str):
 *             c_string_array = <char**> malloc(size * sizeof(char*))
 *             for i in range(size):             # <<<<<<<<<<<<<<
 *                 c_string_array[i] = strdup(values[i].encode('utf-8'))
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgString(self._c_df, header.encode('utf-8'), c_string_array, size)
*/
    __pyx_t_4 = __pyx_v_size;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "amplpy/dataframe.pxi":328
 *             c_string_array = <char**> malloc(size * sizeof(char*))
 *             for i in range(size):
 *                 c_string_array[i] = strdup(values[i].encode('utf-8'))             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgString(self._c_df, header.encode('utf-8'), c_string_array, size)
 *             for i in range(size):
*/
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __pyx_t_8;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_9 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_utf_8};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(1, 328, __pyx_L1_error)
      (__pyx_v_c_string_array[__pyx_v_i]) = strdup(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }

    /* "amplpy/dataframe.pxi":329
 *             for i in range(size):
 *                 c_string_array[i] = strdup(values[i].encode('utf-8'))
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgString(self._c_df, header.encode('utf-8'), c_string_array, size)             # <<<<<<<<<<<<<<
 *             for i in range(size):
 *                 if c_string_array[i] != NULL:
*/
    __pyx_t_8 = __pyx_v_header;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(1, 329, __pyx_L1_error)
    __pyx_v_errorinfo = AMPL_DataFrameSetColumnArgString(__pyx_v_self->_c_df, __pyx_t_11, __pyx_v_c_string_array, __pyx_v_size);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":330
 *                 c_string_array[i] = strdup(values[i].encode('utf-8'))
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgString(self._c_df, header.encode('utf-8'), c_string_array, size)
 *             for i in range(size):             # <<<<<<<<<<<<<<
 *                 if c_string_array[i] != NULL:
 *                     free(c_string_array[i])
*/
    __pyx_t_4 = __pyx_v_size;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "amplpy/dataframe.pxi":331
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgString(self._c_df, header.encode('utf-8'), c_string_array, size)
 *             for i in range(size):
 *                 if c_string_array[i] != NULL:             # <<<<<<<<<<<<<<
 *                     free(c_string_array[i])
 *             free(c_string_array)
*/
      __pyx_t_3 = ((__pyx_v_c_string_array[__pyx_v_i]) != NULL);
      if (__pyx_t_3) {

        /* "amplpy/dataframe.pxi":332
 *             for i in range(size):
 *                 if c_string_array[i] != NULL:
 *                     free(c_string_array[i])             # <<<<<<<<<<<<<<
 *             free(c_string_array)
 *             if errorinfo:
*/
        free((__pyx_v_c_string_array[__pyx_v_i]));

        /* "amplpy/dataframe.pxi":331
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgString(self._c_df, header.encode('utf-8'), c_string_array, size)
 *             for i in range(size):
 *                 if c_string_array[i] != NULL:             # <<<<<<<<<<<<<<
 *                     free(c_string_array[i])
 *             free(c_string_array)
*/
      }
    }

    /* "amplpy/dataframe.pxi":333
 *                 if c_string_array[i] != NULL:
 *                     free(c_string_array[i])
 *             free(c_string_array)             # <<<<<<<<<<<<<<
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
*/
    free(__pyx_v_c_string_array);

    /* "amplpy/dataframe.pxi":334
 *                     free(c_string_array[i])
 *             free(c_string_array)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         else:
*/
    __pyx_t_3 = (__pyx_v_errorinfo != 0);
    if (__pyx_t_3) {

      /* "amplpy/dataframe.pxi":335
 *             free(c_string_array)
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         else:
 *             c_double_array = <double*> malloc(size * sizeof(double))
*/
      __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 335, __pyx_L1_error)

      /* "amplpy/dataframe.pxi":334
 *                     free(c_string_array[i])
 *             free(c_string_array)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         else:
*/
    }

    /* "amplpy/dataframe.pxi":325
 *         cdef char** c_string_array = NULL
 *         cdef size_t size = len(values)
 *         if isinstance(values[0], str):             # <<<<<<<<<<<<<<
 *             c_string_array = <char**> malloc(size * sizeof(char*))
 *             for i in range(size):
*/
    goto __pyx_L3;
  }

  /* "amplpy/dataframe.pxi":337
 *                 PY_AMPL_CALL(errorinfo)
 *         else:
 *             c_double_array = <double*> malloc(size * sizeof(double))             # <<<<<<<<<<<<<<
 *             for i in range(size):
 *                 if PyLong_Check(values[i]):
*/
  /*else*/ {
    __pyx_v_c_double_array = ((double *)malloc((__pyx_v_size * (sizeof(double)))));

    /* "amplpy/dataframe.pxi":338
 *         else:
 *             c_double_array = <double*> malloc(size * sizeof(double))
 *             for i in range(size):             # <<<<<<<<<<<<<<
 *                 if PyLong_Check(values[i]):
 *                     c_double_array[i] = PyLong_AsLong(values[i]);
*/
    __pyx_t_4 = __pyx_v_size;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "amplpy/dataframe.pxi":339
 *             c_double_array = <double*> malloc(size * sizeof(double))
 *             for i in range(size):
 *                 if PyLong_Check(values[i]):             # <<<<<<<<<<<<<<
 *                     c_double_array[i] = PyLong_AsLong(values[i]);
 *                 else:
*/
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 339, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyLong_Check(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_3) {

        /* "amplpy/dataframe.pxi":340
 *             for i in range(size):
 *                 if PyLong_Check(values[i]):
 *                     c_double_array[i] = PyLong_AsLong(values[i]);             # <<<<<<<<<<<<<<
 *                 else:
 *                     PyErr_Clear()
*/
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 340, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_12 = PyLong_AsLong(__pyx_t_2); if (unlikely(__pyx_t_12 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(1, 340, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        (__pyx_v_c_double_array[__pyx_v_i]) = __pyx_t_12;

        /* "amplpy/dataframe.pxi":339
 *             c_double_array = <double*> malloc(size * sizeof(double))
 *             for i in range(size):
 *                 if PyLong_Check(values[i]):             # <<<<<<<<<<<<<<
 *                     c_double_array[i] = PyLong_AsLong(values[i]);
 *                 else:
*/
        goto __pyx_L12;
      }

      /* "amplpy/dataframe.pxi":342
 *                     c_double_array[i] = PyLong_AsLong(values[i]);
 *                 else:
 *                     PyErr_Clear()             # <<<<<<<<<<<<<<
 *                     c_double_array[i] = PyFloat_AsDouble(values[i]);
 *                     if PyErr_Occurred():
*/
      /*else*/ {
        PyErr_Clear();

        /* "amplpy/dataframe.pxi":343
 *                 else:
 *                     PyErr_Clear()
 *                     c_double_array[i] = PyFloat_AsDouble(values[i]);             # <<<<<<<<<<<<<<
 *                     if PyErr_Occurred():
 *                         raise TypeError("Failed to cast value to int/float/double")
*/
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, size_t, 0, __Pyx_PyLong_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_13 = PyFloat_AsDouble(__pyx_t_2); if (unlikely(__pyx_t_13 == ((double)-1.0) && PyErr_Occurred())) __PYX_ERR(1, 343, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        (__pyx_v_c_double_array[__pyx_v_i]) = __pyx_t_13;

        /* "amplpy/dataframe.pxi":344
 *                     PyErr_Clear()
 *                     c_double_array[i] = PyFloat_AsDouble(values[i]);
 *                     if PyErr_Occurred():             # <<<<<<<<<<<<<<
 *                         raise TypeError("Failed to cast value to int/float/double")
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgDouble(self._c_df, header.encode('utf-8'), c_double_array, size)
*/
        __pyx_t_3 = (PyErr_Occurred() != 0);
        if (unlikely(__pyx_t_3)) {

          /* "amplpy/dataframe.pxi":345
 *                     c_double_array[i] = PyFloat_AsDouble(values[i]);
 *                     if PyErr_Occurred():
 *                         raise TypeError("Failed to cast value to int/float/double")             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgDouble(self._c_df, header.encode('utf-8'), c_double_array, size)
 *             free(c_double_array)
*/
          __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_builtin_TypeError);
          __pyx_t_7 = __pyx_builtin_TypeError; 
          __pyx_t_9 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_Failed_to_cast_value_to_int_floa};
            __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 345, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_Raise(__pyx_t_2, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 345, __pyx_L1_error)

          /* "amplpy/dataframe.pxi":344
 *                     PyErr_Clear()
 *                     c_double_array[i] = PyFloat_AsDouble(values[i]);
 *                     if PyErr_Occurred():             # <<<<<<<<<<<<<<
 *                         raise TypeError("Failed to cast value to int/float/double")
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgDouble(self._c_df, header.encode('utf-8'), c_double_array, size)
*/
        }
      }
      __pyx_L12:;
    }

    /* "amplpy/dataframe.pxi":346
 *                     if PyErr_Occurred():
 *                         raise TypeError("Failed to cast value to int/float/double")
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgDouble(self._c_df, header.encode('utf-8'), c_double_array, size)             # <<<<<<<<<<<<<<
 *             free(c_double_array)
 *             if errorinfo:
*/
    __pyx_t_7 = __pyx_v_header;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(1, 346, __pyx_L1_error)
    __pyx_v_errorinfo = AMPL_DataFrameSetColumnArgDouble(__pyx_v_self->_c_df, __pyx_t_14, __pyx_v_c_double_array, __pyx_v_size);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":347
 *                         raise TypeError("Failed to cast value to int/float/double")
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgDouble(self._c_df, header.encode('utf-8'), c_double_array, size)
 *             free(c_double_array)             # <<<<<<<<<<<<<<
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
*/
    free(__pyx_v_c_double_array);

    /* "amplpy/dataframe.pxi":348
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgDouble(self._c_df, header.encode('utf-8'), c_double_array, size)
 *             free(c_double_array)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 * 
*/
    __pyx_t_3 = (__pyx_v_errorinfo != 0);
    if (__pyx_t_3) {

      /* "amplpy/dataframe.pxi":349
 *             free(c_double_array)
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *     def _get_row(self, key):
*/
      __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L1_error)

      /* "amplpy/dataframe.pxi":348
 *             errorinfo = campl.AMPL_DataFrameSetColumnArgDouble(self._c_df, header.encode('utf-8'), c_double_array, size)
 *             free(c_double_array)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 * 
*/
    }
  }
  __pyx_L3:;

  /* "amplpy/dataframe.pxi":312
 *         return Column.create(self._c_df, index)
 * 
 *     def _set_column(self, header, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of a column.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._set_column", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":351
 *                 PY_AMPL_CALL(errorinfo)
 * 
 *     def _get_row(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         Get a row by value of the indexing columns. If the index is not
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_25_get_row(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_24_get_row, "DataFrame._get_row(self, key)\nGet a row by value of the indexing columns. If the index is not\nspecified, gets the only row of a dataframe with no indexing columns.\n\nArgs:\n    key: Tuple representing the index of the desired row.\n\nReturns:\n    The row.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_25_get_row = {"_get_row", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_25_get_row, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_24_get_row};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_25_get_row(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_row (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 351, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 351, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_row", 0) < 0) __PYX_ERR(1, 351, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_row", 1, 1, 1, i); __PYX_ERR(1, 351, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 351, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_row", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 351, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_row", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_24_get_row(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_key);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_24_get_row(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_key) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  size_t __pyx_v_index;
  AMPL_TUPLE *__pyx_v_tuple;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  AMPL_TUPLE *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_row", 0);

  /* "amplpy/dataframe.pxi":364
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef size_t index
 *         cdef campl.AMPL_TUPLE* tuple = to_c_tuple(key)             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_DataFrameGetRowIndex(self._c_df, tuple, &index)
 *         campl.AMPL_TupleFree(&tuple)
*/
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_key); if (unlikely(__pyx_t_1 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(1, 364, __pyx_L1_error)
  __pyx_v_tuple = __pyx_t_1;

  /* "amplpy/dataframe.pxi":365
 *         cdef size_t index
 *         cdef campl.AMPL_TUPLE* tuple = to_c_tuple(key)
 *         errorinfo = campl.AMPL_DataFrameGetRowIndex(self._c_df, tuple, &index)             # <<<<<<<<<<<<<<
 *         campl.AMPL_TupleFree(&tuple)
 *         if errorinfo:
*/
  __pyx_v_errorinfo = AMPL_DataFrameGetRowIndex(__pyx_v_self->_c_df, __pyx_v_tuple, (&__pyx_v_index));

  /* "amplpy/dataframe.pxi":366
 *         cdef campl.AMPL_TUPLE* tuple = to_c_tuple(key)
 *         errorinfo = campl.AMPL_DataFrameGetRowIndex(self._c_df, tuple, &index)
 *         campl.AMPL_TupleFree(&tuple)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  (void)(AMPL_TupleFree((&__pyx_v_tuple)));

  /* "amplpy/dataframe.pxi":367
 *         errorinfo = campl.AMPL_DataFrameGetRowIndex(self._c_df, tuple, &index)
 *         campl.AMPL_TupleFree(&tuple)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         return Row.create(self._c_df, index)
*/
  __pyx_t_2 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":368
 *         campl.AMPL_TupleFree(&tuple)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         return Row.create(self._c_df, index)
 * 
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 368, __pyx_L1_error)

    /* "amplpy/dataframe.pxi":367
 *         errorinfo = campl.AMPL_DataFrameGetRowIndex(self._c_df, tuple, &index)
 *         campl.AMPL_TupleFree(&tuple)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         return Row.create(self._c_df, index)
*/
  }

  /* "amplpy/dataframe.pxi":369
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         return Row.create(self._c_df, index)             # <<<<<<<<<<<<<<
 * 
 *     def _get_row_by_index(self, index):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_f_6amplpy_4ampl_3Row_create(__pyx_v_self->_c_df, __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":351
 *                 PY_AMPL_CALL(errorinfo)
 * 
 *     def _get_row(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         Get a row by value of the indexing columns. If the index is not
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_row", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":371
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_row_by_index(self, index):             # <<<<<<<<<<<<<<
 *         """
 *         Get row by numeric index.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_27_get_row_by_index(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_26_get_row_by_index, "DataFrame._get_row_by_index(self, index)\nGet row by numeric index.\n\nArgs:\n    index: Zero-based index of the row to get.\n\nReturns:\n    The corresponding row.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_27_get_row_by_index = {"_get_row_by_index", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_27_get_row_by_index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_26_get_row_by_index};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_27_get_row_by_index(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_index = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_row_by_index (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_index,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 371, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 371, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_row_by_index", 0) < 0) __PYX_ERR(1, 371, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_row_by_index", 1, 1, 1, i); __PYX_ERR(1, 371, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 371, __pyx_L3_error)
    }
    __pyx_v_index = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_row_by_index", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 371, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_row_by_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_26_get_row_by_index(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_index);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_26_get_row_by_index(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_row_by_index", 0);

  /* "amplpy/dataframe.pxi":381
 *             The corresponding row.
 *         """
 *         return Row.create(self._c_df, index)             # <<<<<<<<<<<<<<
 * 
 *     def _get_headers(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_As_size_t(__pyx_v_index); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 381, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_6amplpy_4ampl_3Row_create(__pyx_v_self->_c_df, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":371
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_row_by_index(self, index):             # <<<<<<<<<<<<<<
 *         """
 *         Get row by numeric index.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_row_by_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":383
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_headers(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the headers of this DataFrame.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_29_get_headers(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_28_get_headers, "DataFrame._get_headers(self)\nGet the headers of this DataFrame.\n\nReturns:\n   The headers of this DataFrame.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_29_get_headers = {"_get_headers", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_29_get_headers, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_28_get_headers};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_29_get_headers(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_headers (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_get_headers", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_get_headers", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_28_get_headers(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_12_get_headers_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/dataframe.pxi":396
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             campl.AMPL_StringFree(&headers[i])
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_12_get_headers_genexpr(PyObject *__pyx_self, size_t __pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_5_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 396, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9DataFrame_12_get_headers_2generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_headers_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(1, 396, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_headers.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_12_get_headers_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(1, 396, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = (__pyx_cur_scope->__pyx_outer_scope->__pyx_v_headers[__pyx_cur_scope->__pyx_v_i]);
    __pyx_t_5 = __Pyx_ssize_strlen(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 396, __pyx_L1_error)
    __pyx_t_6 = __Pyx_decode_c_string(__pyx_t_4, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 396, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":383
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_headers(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the headers of this DataFrame.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_28_get_headers(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers *__pyx_cur_scope;
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  size_t __pyx_v_size;
  PyObject *__pyx_v_headers_py = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_12_get_headers_2generator3 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_headers", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_4__get_headers(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 383, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }

  /* "amplpy/dataframe.pxi":393
 *         cdef size_t size
 *         cdef char** headers
 *         errorinfo = campl.AMPL_DataFrameGetHeaders(self._c_df, &size, &headers)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_DataFrameGetHeaders(__pyx_v_self->_c_df, (&__pyx_v_size), (&__pyx_cur_scope->__pyx_v_headers));

  /* "amplpy/dataframe.pxi":394
 *         cdef char** headers
 *         errorinfo = campl.AMPL_DataFrameGetHeaders(self._c_df, &size, &headers)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":395
 *         errorinfo = campl.AMPL_DataFrameGetHeaders(self._c_df, &size, &headers)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))
 *         for i in range(size):
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 395, __pyx_L1_error)

    /* "amplpy/dataframe.pxi":394
 *         cdef char** headers
 *         errorinfo = campl.AMPL_DataFrameGetHeaders(self._c_df, &size, &headers)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))
*/
  }

  /* "amplpy/dataframe.pxi":396
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             campl.AMPL_StringFree(&headers[i])
*/
  __pyx_t_2 = __pyx_pf_6amplpy_4ampl_9DataFrame_12_get_headers_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_headers_py = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":397
 *             PY_AMPL_CALL(errorinfo)
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             campl.AMPL_StringFree(&headers[i])
 *         free(headers)
*/
  __pyx_t_4 = __pyx_v_size;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "amplpy/dataframe.pxi":398
 *         headers_py = tuple(str(headers[i].decode('utf-8')) for i in range(size))
 *         for i in range(size):
 *             campl.AMPL_StringFree(&headers[i])             # <<<<<<<<<<<<<<
 *         free(headers)
 *         return headers_py
*/
    (void)(AMPL_StringFree((&(__pyx_cur_scope->__pyx_v_headers[__pyx_v_i]))));
  }

  /* "amplpy/dataframe.pxi":399
 *         for i in range(size):
 *             campl.AMPL_StringFree(&headers[i])
 *         free(headers)             # <<<<<<<<<<<<<<
 *         return headers_py
 * 
*/
  free(__pyx_cur_scope->__pyx_v_headers);

  /* "amplpy/dataframe.pxi":400
 *             campl.AMPL_StringFree(&headers[i])
 *         free(headers)
 *         return headers_py             # <<<<<<<<<<<<<<
 * 
 *     def _set_values(self, values):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_headers_py);
  __pyx_r = __pyx_v_headers_py;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":383
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_headers(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the headers of this DataFrame.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._get_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_headers_py);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9DataFrame_12_get_headers_2generator3);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":402
 *         return headers_py
 * 
 *     def _set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of a DataFrame from a dictionary.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_31_set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_30_set_values, "DataFrame._set_values(self, values)\nSet the values of a DataFrame from a dictionary.\n\nArgs:\n    values: Dictionary with the values to set.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_31_set_values = {"_set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_31_set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_30_set_values};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_31_set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_values = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_values,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 402, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 402, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_set_values", 0) < 0) __PYX_ERR(1, 402, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_set_values", 1, 1, 1, i); __PYX_ERR(1, 402, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 402, __pyx_L3_error)
    }
    __pyx_v_values = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_values", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 402, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_30_set_values(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_values);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":412
 *         nindices = self._get_num_indices()
 * 
 *         def conv_to_list(value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, list):
 *                 return value
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_11_set_values_1conv_to_list(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_11_set_values_1conv_to_list = {"conv_to_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_11_set_values_1conv_to_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_11_set_values_1conv_to_list(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conv_to_list (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 412, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 412, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "conv_to_list", 0) < 0) __PYX_ERR(1, 412, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("conv_to_list", 1, 1, 1, i); __PYX_ERR(1, 412, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 412, __pyx_L3_error)
    }
    __pyx_v_value = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("conv_to_list", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 412, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._set_values.conv_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_11_set_values_conv_to_list(__pyx_self, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_11_set_values_conv_to_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("conv_to_list", 0);

  /* "amplpy/dataframe.pxi":413
 * 
 *         def conv_to_list(value):
 *             if isinstance(value, list):             # <<<<<<<<<<<<<<
 *                 return value
 *             elif isinstance(value, tuple):
*/
  __pyx_t_1 = PyList_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":414
 *         def conv_to_list(value):
 *             if isinstance(value, list):
 *                 return value             # <<<<<<<<<<<<<<
 *             elif isinstance(value, tuple):
 *                 return list(value)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;

    /* "amplpy/dataframe.pxi":413
 * 
 *         def conv_to_list(value):
 *             if isinstance(value, list):             # <<<<<<<<<<<<<<
 *                 return value
 *             elif isinstance(value, tuple):
*/
  }

  /* "amplpy/dataframe.pxi":415
 *             if isinstance(value, list):
 *                 return value
 *             elif isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *                 return list(value)
 *             else:
*/
  __pyx_t_1 = PyTuple_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":416
 *                 return value
 *             elif isinstance(value, tuple):
 *                 return list(value)             # <<<<<<<<<<<<<<
 *             else:
 *                 return [value]
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PySequence_List(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "amplpy/dataframe.pxi":415
 *             if isinstance(value, list):
 *                 return value
 *             elif isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *                 return list(value)
 *             else:
*/
  }

  /* "amplpy/dataframe.pxi":418
 *                 return list(value)
 *             else:
 *                 return [value]             # <<<<<<<<<<<<<<
 * 
 *         for key, value in values.items():
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_value) != (0)) __PYX_ERR(1, 418, __pyx_L1_error);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "amplpy/dataframe.pxi":412
 *         nindices = self._get_num_indices()
 * 
 *         def conv_to_list(value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, list):
 *                 return value
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._set_values.conv_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":402
 *         return headers_py
 * 
 *     def _set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of a DataFrame from a dictionary.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_30_set_values(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_values) {
  PyObject *__pyx_v_ncols = NULL;
  PyObject *__pyx_v_nindices = NULL;
  PyObject *__pyx_v_conv_to_list = 0;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_values", 0);

  /* "amplpy/dataframe.pxi":409
 *             values: Dictionary with the values to set.
 *         """
 *         ncols = self._get_num_cols()             # <<<<<<<<<<<<<<
 *         nindices = self._get_num_indices()
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_cols, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_ncols = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":410
 *         """
 *         ncols = self._get_num_cols()
 *         nindices = self._get_num_indices()             # <<<<<<<<<<<<<<
 * 
 *         def conv_to_list(value):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_indices, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_nindices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":412
 *         nindices = self._get_num_indices()
 * 
 *         def conv_to_list(value):             # <<<<<<<<<<<<<<
 *             if isinstance(value, list):
 *                 return value
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_11_set_values_1conv_to_list, 0, __pyx_mstate_global->__pyx_n_u_set_values_locals_conv_to_list, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_conv_to_list = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":420
 *                 return [value]
 * 
 *         for key, value in values.items():             # <<<<<<<<<<<<<<
 *             key = conv_to_list(key)
 *             assert len(key) == nindices
*/
  __pyx_t_4 = 0;
  if (unlikely(__pyx_v_values == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(1, 420, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_values, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;
  while (1) {
    __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_5, &__pyx_t_4, &__pyx_t_2, &__pyx_t_7, NULL, __pyx_t_6);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(1, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "amplpy/dataframe.pxi":421
 * 
 *         for key, value in values.items():
 *             key = conv_to_list(key)             # <<<<<<<<<<<<<<
 *             assert len(key) == nindices
 *             value = conv_to_list(value)
*/
    __pyx_t_7 = __pyx_pf_6amplpy_4ampl_9DataFrame_11_set_values_conv_to_list(__pyx_v_conv_to_list, __pyx_v_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "amplpy/dataframe.pxi":422
 *         for key, value in values.items():
 *             key = conv_to_list(key)
 *             assert len(key) == nindices             # <<<<<<<<<<<<<<
 *             value = conv_to_list(value)
 *             assert len(value) == ncols - nindices
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_9 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 422, __pyx_L1_error)
      __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_v_nindices, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 422, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(1, 422, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_10)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(1, 422, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(1, 422, __pyx_L1_error)
    #endif

    /* "amplpy/dataframe.pxi":423
 *             key = conv_to_list(key)
 *             assert len(key) == nindices
 *             value = conv_to_list(value)             # <<<<<<<<<<<<<<
 *             assert len(value) == ncols - nindices
 *             self._add_row(key + value)
*/
    __pyx_t_2 = __pyx_pf_6amplpy_4ampl_9DataFrame_11_set_values_conv_to_list(__pyx_v_conv_to_list, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":424
 *             assert len(key) == nindices
 *             value = conv_to_list(value)
 *             assert len(value) == ncols - nindices             # <<<<<<<<<<<<<<
 *             self._add_row(key + value)
 * 
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 424, __pyx_L1_error)
      __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyNumber_Subtract(__pyx_v_ncols, __pyx_v_nindices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 424, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(1, 424, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(1, 424, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(1, 424, __pyx_L1_error)
    #endif

    /* "amplpy/dataframe.pxi":425
 *             value = conv_to_list(value)
 *             assert len(value) == ncols - nindices
 *             self._add_row(key + value)             # <<<<<<<<<<<<<<
 * 
 *     def to_dict(self):
*/
    __pyx_t_7 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_2 = PyNumber_Add(__pyx_v_key, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2};
      __pyx_t_11 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_add_row, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":402
 *         return headers_py
 * 
 *     def _set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of a DataFrame from a dictionary.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ncols);
  __Pyx_XDECREF(__pyx_v_nindices);
  __Pyx_XDECREF(__pyx_v_conv_to_list);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":427
 *             self._add_row(key + value)
 * 
 *     def to_dict(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return a dictionary with the DataFrame data.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_33to_dict(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_32to_dict, "DataFrame.to_dict(self)\nReturn a dictionary with the DataFrame data.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_33to_dict = {"to_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_33to_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_32to_dict};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_33to_dict(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_dict (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_dict", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_dict", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_32to_dict(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_32to_dict(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_nindices = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_row = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_8genexpr6__pyx_v_header = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_dict", 0);

  /* "amplpy/dataframe.pxi":431
 *         Return a dictionary with the DataFrame data.
 *         """
 *         d = {}             # <<<<<<<<<<<<<<
 *         nindices = self._get_num_indices()
 *         if nindices == 0:
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":432
 *         """
 *         d = {}
 *         nindices = self._get_num_indices()             # <<<<<<<<<<<<<<
 *         if nindices == 0:
 *             raise ValueError("cannot convert to dictionary without an index")
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_indices, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_nindices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":433
 *         d = {}
 *         nindices = self._get_num_indices()
 *         if nindices == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot convert to dictionary without an index")
 *         data = zip(
*/
  __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_nindices, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 433, __pyx_L1_error)
  if (unlikely(__pyx_t_4)) {

    /* "amplpy/dataframe.pxi":434
 *         nindices = self._get_num_indices()
 *         if nindices == 0:
 *             raise ValueError("cannot convert to dictionary without an index")             # <<<<<<<<<<<<<<
 *         data = zip(
 *             *[self._get_column(header).to_list() for header in self._get_headers()]
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_cannot_convert_to_dictionary_wit};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(1, 434, __pyx_L1_error)

    /* "amplpy/dataframe.pxi":433
 *         d = {}
 *         nindices = self._get_num_indices()
 *         if nindices == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("cannot convert to dictionary without an index")
 *         data = zip(
*/
  }

  /* "amplpy/dataframe.pxi":435
 *         if nindices == 0:
 *             raise ValueError("cannot convert to dictionary without an index")
 *         data = zip(             # <<<<<<<<<<<<<<
 *             *[self._get_column(header).to_list() for header in self._get_headers()]
 *         )
*/
  { /* enter inner scope */

    /* "amplpy/dataframe.pxi":436
 *             raise ValueError("cannot convert to dictionary without an index")
 *         data = zip(
 *             *[self._get_column(header).to_list() for header in self._get_headers()]             # <<<<<<<<<<<<<<
 *         )
 *         for row in data:
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 436, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_headers, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 436, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 436, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 436, __pyx_L6_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 436, __pyx_L6_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_6);
          ++__pyx_t_6;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 436, __pyx_L6_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6);
          #endif
          ++__pyx_t_6;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 436, __pyx_L6_error)
      } else {
        __pyx_t_5 = __pyx_t_7(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 436, __pyx_L6_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_header, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_10 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_10);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_8genexpr6__pyx_v_header};
        __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_column, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 436, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_t_8 = __pyx_t_9;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 436, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 436, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_header); __pyx_8genexpr6__pyx_v_header = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_header); __pyx_8genexpr6__pyx_v_header = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */

  /* "amplpy/dataframe.pxi":435
 *         if nindices == 0:
 *             raise ValueError("cannot convert to dictionary without an index")
 *         data = zip(             # <<<<<<<<<<<<<<
 *             *[self._get_column(header).to_list() for header in self._get_headers()]
 *         )
*/
  __pyx_t_2 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":438
 *             *[self._get_column(header).to_list() for header in self._get_headers()]
 *         )
 *         for row in data:             # <<<<<<<<<<<<<<
 *             if nindices == 1:
 *                 key = row[0]
*/
  if (likely(PyList_CheckExact(__pyx_v_data)) || PyTuple_CheckExact(__pyx_v_data)) {
    __pyx_t_1 = __pyx_v_data; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 438, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_6);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 438, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 438, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 438, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":439
 *         )
 *         for row in data:
 *             if nindices == 1:             # <<<<<<<<<<<<<<
 *                 key = row[0]
 *             else:
*/
    __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_nindices, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 439, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "amplpy/dataframe.pxi":440
 *         for row in data:
 *             if nindices == 1:
 *                 key = row[0]             # <<<<<<<<<<<<<<
 *             else:
 *                 key = tuple(row[:nindices])
*/
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_row, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "amplpy/dataframe.pxi":439
 *         )
 *         for row in data:
 *             if nindices == 1:             # <<<<<<<<<<<<<<
 *                 key = row[0]
 *             else:
*/
      goto __pyx_L13;
    }

    /* "amplpy/dataframe.pxi":442
 *                 key = row[0]
 *             else:
 *                 key = tuple(row[:nindices])             # <<<<<<<<<<<<<<
 *             if len(row) - nindices == 0:
 *                 d[key] = None
*/
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_row, 0, 0, NULL, &__pyx_v_nindices, NULL, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L13:;

    /* "amplpy/dataframe.pxi":443
 *             else:
 *                 key = tuple(row[:nindices])
 *             if len(row) - nindices == 0:             # <<<<<<<<<<<<<<
 *                 d[key] = None
 *             elif len(row) - nindices == 1:
*/
    __pyx_t_11 = PyObject_Length(__pyx_v_row); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(1, 443, __pyx_L1_error)
    __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_v_nindices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "amplpy/dataframe.pxi":444
 *                 key = tuple(row[:nindices])
 *             if len(row) - nindices == 0:
 *                 d[key] = None             # <<<<<<<<<<<<<<
 *             elif len(row) - nindices == 1:
 *                 d[key] = row[nindices]
*/
      if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_v_key, Py_None) < 0))) __PYX_ERR(1, 444, __pyx_L1_error)

      /* "amplpy/dataframe.pxi":443
 *             else:
 *                 key = tuple(row[:nindices])
 *             if len(row) - nindices == 0:             # <<<<<<<<<<<<<<
 *                 d[key] = None
 *             elif len(row) - nindices == 1:
*/
      goto __pyx_L14;
    }

    /* "amplpy/dataframe.pxi":445
 *             if len(row) - nindices == 0:
 *                 d[key] = None
 *             elif len(row) - nindices == 1:             # <<<<<<<<<<<<<<
 *                 d[key] = row[nindices]
 *             else:
*/
    __pyx_t_11 = PyObject_Length(__pyx_v_row); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(1, 445, __pyx_L1_error)
    __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_nindices); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 445, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {

      /* "amplpy/dataframe.pxi":446
 *                 d[key] = None
 *             elif len(row) - nindices == 1:
 *                 d[key] = row[nindices]             # <<<<<<<<<<<<<<
 *             else:
 *                 d[key] = tuple(row[nindices:])
*/
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_row, __pyx_v_nindices); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_v_key, __pyx_t_5) < 0))) __PYX_ERR(1, 446, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "amplpy/dataframe.pxi":445
 *             if len(row) - nindices == 0:
 *                 d[key] = None
 *             elif len(row) - nindices == 1:             # <<<<<<<<<<<<<<
 *                 d[key] = row[nindices]
 *             else:
*/
      goto __pyx_L14;
    }

    /* "amplpy/dataframe.pxi":448
 *                 d[key] = row[nindices]
 *             else:
 *                 d[key] = tuple(row[nindices:])             # <<<<<<<<<<<<<<
 *         return d
 * 
*/
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_row, 0, 0, &__pyx_v_nindices, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 448, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 448, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely((PyDict_SetItem(__pyx_v_d, __pyx_v_key, __pyx_t_2) < 0))) __PYX_ERR(1, 448, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L14:;

    /* "amplpy/dataframe.pxi":438
 *             *[self._get_column(header).to_list() for header in self._get_headers()]
 *         )
 *         for row in data:             # <<<<<<<<<<<<<<
 *             if nindices == 1:
 *                 key = row[0]
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":449
 *             else:
 *                 d[key] = tuple(row[nindices:])
 *         return d             # <<<<<<<<<<<<<<
 * 
 *     def to_list(self, skip_index=False):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_d);
  __pyx_r = __pyx_v_d;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":427
 *             self._add_row(key + value)
 * 
 *     def to_dict(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return a dictionary with the DataFrame data.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_nindices);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_row);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_header);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":451
 *         return d
 * 
 *     def to_list(self, skip_index=False):             # <<<<<<<<<<<<<<
 *         """
 *         Return a list with the DataFrame data.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_35to_list(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_34to_list, "DataFrame.to_list(self, skip_index=False)\nReturn a list with the DataFrame data.\n\nArgs:\n    skip_index: set to True to retrieve only values.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_35to_list = {"to_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_35to_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_34to_list};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_35to_list(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_skip_index = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_list (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_skip_index,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 451, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 451, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_list", 0) < 0) __PYX_ERR(1, 451, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 451, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_skip_index = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_list", 0, 0, 1, __pyx_nargs); __PYX_ERR(1, 451, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_34to_list(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_skip_index);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_34to_list(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_skip_index) {
  PyObject *__pyx_v_lst = NULL;
  PyObject *__pyx_v_ncols = NULL;
  PyObject *__pyx_v_nindices = NULL;
  PyObject *__pyx_8genexpr7__pyx_v_i = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_i = NULL;
  PyObject *__pyx_8genexpr9__pyx_v_row = NULL;
  PyObject *__pyx_9genexpr10__pyx_v_row = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_list", 0);

  /* "amplpy/dataframe.pxi":458
 *             skip_index: set to True to retrieve only values.
 *         """
 *         if self._get_num_cols() > 1:             # <<<<<<<<<<<<<<
 *             lst = [
 *                 tuple(self._get_row_by_index(i)) for i in range(self._get_num_rows())
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_cols, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 458, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 458, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "amplpy/dataframe.pxi":459
 *         """
 *         if self._get_num_cols() > 1:
 *             lst = [             # <<<<<<<<<<<<<<
 *                 tuple(self._get_row_by_index(i)) for i in range(self._get_num_rows())
 *             ]
*/
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 459, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "amplpy/dataframe.pxi":460
 *         if self._get_num_cols() > 1:
 *             lst = [
 *                 tuple(self._get_row_by_index(i)) for i in range(self._get_num_rows())             # <<<<<<<<<<<<<<
 *             ]
 *         else:
*/
      __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_builtin_range);
      __pyx_t_6 = __pyx_builtin_range; 
      __pyx_t_8 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
        __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_rows, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 460, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6);
        __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 460, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 460, __pyx_L6_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (likely(!__pyx_t_10)) {
          if (likely(PyList_CheckExact(__pyx_t_6))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 460, __pyx_L6_error)
              #endif
              if (__pyx_t_9 >= __pyx_temp) break;
            }
            __pyx_t_1 = __Pyx_PyList_GetItemRef(__pyx_t_6, __pyx_t_9);
            ++__pyx_t_9;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 460, __pyx_L6_error)
              #endif
              if (__pyx_t_9 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9));
            #else
            __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_9);
            #endif
            ++__pyx_t_9;
          }
          if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __pyx_L6_error)
        } else {
          __pyx_t_1 = __pyx_t_10(__pyx_t_6);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 460, __pyx_L6_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_i, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_7 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_8genexpr7__pyx_v_i};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_row_by_index, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 460, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 460, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) __PYX_ERR(1, 459, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_i); __pyx_8genexpr7__pyx_v_i = 0;
      goto __pyx_L10_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_i); __pyx_8genexpr7__pyx_v_i = 0;
      goto __pyx_L1_error;
      __pyx_L10_exit_scope:;
    } /* exit inner scope */
    __pyx_v_lst = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":458
 *             skip_index: set to True to retrieve only values.
 *         """
 *         if self._get_num_cols() > 1:             # <<<<<<<<<<<<<<
 *             lst = [
 *                 tuple(self._get_row_by_index(i)) for i in range(self._get_num_rows())
*/
    goto __pyx_L3;
  }

  /* "amplpy/dataframe.pxi":463
 *             ]
 *         else:
 *             lst = [self._get_row_by_index(i)[0] for i in range(self._get_num_rows())]             # <<<<<<<<<<<<<<
 *         if skip_index:
 *             ncols = self._get_num_cols()
*/
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 463, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_range);
      __pyx_t_1 = __pyx_builtin_range; 
      __pyx_t_8 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_rows, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 463, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 463, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 463, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 463, __pyx_L13_error)
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (likely(!__pyx_t_10)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 463, __pyx_L13_error)
              #endif
              if (__pyx_t_9 >= __pyx_temp) break;
            }
            __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_9);
            ++__pyx_t_9;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 463, __pyx_L13_error)
              #endif
              if (__pyx_t_9 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9));
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_9);
            #endif
            ++__pyx_t_9;
          }
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 463, __pyx_L13_error)
        } else {
          __pyx_t_6 = __pyx_t_10(__pyx_t_1);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 463, __pyx_L13_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_i, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_5 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_8genexpr8__pyx_v_i};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_row_by_index, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 463, __pyx_L13_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 463, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 463, __pyx_L13_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_i); __pyx_8genexpr8__pyx_v_i = 0;
      goto __pyx_L17_exit_scope;
      __pyx_L13_error:;
      __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_i); __pyx_8genexpr8__pyx_v_i = 0;
      goto __pyx_L1_error;
      __pyx_L17_exit_scope:;
    } /* exit inner scope */
    __pyx_v_lst = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "amplpy/dataframe.pxi":464
 *         else:
 *             lst = [self._get_row_by_index(i)[0] for i in range(self._get_num_rows())]
 *         if skip_index:             # <<<<<<<<<<<<<<
 *             ncols = self._get_num_cols()
 *             nindices = self._get_num_indices()
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_skip_index); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 464, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "amplpy/dataframe.pxi":465
 *             lst = [self._get_row_by_index(i)[0] for i in range(self._get_num_rows())]
 *         if skip_index:
 *             ncols = self._get_num_cols()             # <<<<<<<<<<<<<<
 *             nindices = self._get_num_indices()
 *             if ncols - nindices == 1:
*/
    __pyx_t_1 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_cols, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_v_ncols = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":466
 *         if skip_index:
 *             ncols = self._get_num_cols()
 *             nindices = self._get_num_indices()             # <<<<<<<<<<<<<<
 *             if ncols - nindices == 1:
 *                 return [row[len(row)-1] for row in lst]
*/
    __pyx_t_1 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_indices, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_v_nindices = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "amplpy/dataframe.pxi":467
 *             ncols = self._get_num_cols()
 *             nindices = self._get_num_indices()
 *             if ncols - nindices == 1:             # <<<<<<<<<<<<<<
 *                 return [row[len(row)-1] for row in lst]
 *             else:
*/
    __pyx_t_2 = PyNumber_Subtract(__pyx_v_ncols, __pyx_v_nindices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 467, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "amplpy/dataframe.pxi":468
 *             nindices = self._get_num_indices()
 *             if ncols - nindices == 1:
 *                 return [row[len(row)-1] for row in lst]             # <<<<<<<<<<<<<<
 *             else:
 *                 return [row[nindices:] for row in lst]
*/
      __Pyx_XDECREF(__pyx_r);
      { /* enter inner scope */
        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 468, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __pyx_v_lst; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_9 = 0;
        for (;;) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 468, __pyx_L22_error)
            #endif
            if (__pyx_t_9 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_9);
          ++__pyx_t_9;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 468, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_row, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_11 = PyObject_Length(__pyx_8genexpr9__pyx_v_row); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(1, 468, __pyx_L22_error)
          __pyx_t_12 = (__pyx_t_11 - 1);
          __pyx_t_5 = __Pyx_GetItemInt(__pyx_8genexpr9__pyx_v_row, __pyx_t_12, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 468, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 468, __pyx_L22_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_row); __pyx_8genexpr9__pyx_v_row = 0;
        goto __pyx_L26_exit_scope;
        __pyx_L22_error:;
        __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_row); __pyx_8genexpr9__pyx_v_row = 0;
        goto __pyx_L1_error;
        __pyx_L26_exit_scope:;
      } /* exit inner scope */
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "amplpy/dataframe.pxi":467
 *             ncols = self._get_num_cols()
 *             nindices = self._get_num_indices()
 *             if ncols - nindices == 1:             # <<<<<<<<<<<<<<
 *                 return [row[len(row)-1] for row in lst]
 *             else:
*/
    }

    /* "amplpy/dataframe.pxi":470
 *                 return [row[len(row)-1] for row in lst]
 *             else:
 *                 return [row[nindices:] for row in lst]             # <<<<<<<<<<<<<<
 *         else:
 *             return lst
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      { /* enter inner scope */
        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 470, __pyx_L29_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __pyx_v_lst; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_9 = 0;
        for (;;) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 470, __pyx_L29_error)
            #endif
            if (__pyx_t_9 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_9);
          ++__pyx_t_9;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 470, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_row, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_9genexpr10__pyx_v_row, 0, 0, &__pyx_v_nindices, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 470, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 470, __pyx_L29_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_row); __pyx_9genexpr10__pyx_v_row = 0;
        goto __pyx_L33_exit_scope;
        __pyx_L29_error:;
        __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_row); __pyx_9genexpr10__pyx_v_row = 0;
        goto __pyx_L1_error;
        __pyx_L33_exit_scope:;
      } /* exit inner scope */
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "amplpy/dataframe.pxi":464
 *         else:
 *             lst = [self._get_row_by_index(i)[0] for i in range(self._get_num_rows())]
 *         if skip_index:             # <<<<<<<<<<<<<<
 *             ncols = self._get_num_cols()
 *             nindices = self._get_num_indices()
*/
  }

  /* "amplpy/dataframe.pxi":472
 *                 return [row[nindices:] for row in lst]
 *         else:
 *             return lst             # <<<<<<<<<<<<<<
 * 
 *     def to_pandas(self, multi_index=True):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_lst);
    __pyx_r = __pyx_v_lst;
    goto __pyx_L0;
  }

  /* "amplpy/dataframe.pxi":451
 *         return d
 * 
 *     def to_list(self, skip_index=False):             # <<<<<<<<<<<<<<
 *         """
 *         Return a list with the DataFrame data.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lst);
  __Pyx_XDECREF(__pyx_v_ncols);
  __Pyx_XDECREF(__pyx_v_nindices);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_i);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_i);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_row);
  __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_row);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":474
 *             return lst
 * 
 *     def to_pandas(self, multi_index=True):             # <<<<<<<<<<<<<<
 *         """
 *         Return a pandas.DataFrame with the DataFrame data.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_37to_pandas(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_36to_pandas, "DataFrame.to_pandas(self, multi_index=True)\nReturn a pandas.DataFrame with the DataFrame data.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_37to_pandas = {"to_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_37to_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_36to_pandas};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_37to_pandas(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_multi_index = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_pandas (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_multi_index,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 474, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 474, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_pandas", 0) < 0) __PYX_ERR(1, 474, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 474, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_multi_index = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_pandas", 0, 0, 1, __pyx_nargs); __PYX_ERR(1, 474, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.to_pandas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_36to_pandas(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v_multi_index);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_36to_pandas(struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, PyObject *__pyx_v_multi_index) {
  PyObject *__pyx_v_nindices = NULL;
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_columns = NULL;
  PyObject *__pyx_v_index_names = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_header = NULL;
  PyObject *__pyx_9genexpr12__pyx_v_header = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_header = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_pandas", 0);

  /* "amplpy/dataframe.pxi":478
 *         Return a pandas.DataFrame with the DataFrame data.
 *         """
 *         assert pd is not None             # <<<<<<<<<<<<<<
 *         nindices = self._get_num_indices()
 *         headers = self._get_headers()
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (__pyx_t_1 != Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 478, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 478, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":479
 *         """
 *         assert pd is not None
 *         nindices = self._get_num_indices()             # <<<<<<<<<<<<<<
 *         headers = self._get_headers()
 *         columns = {
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_num_indices, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_nindices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":480
 *         assert pd is not None
 *         nindices = self._get_num_indices()
 *         headers = self._get_headers()             # <<<<<<<<<<<<<<
 *         columns = {
 *             header: self._get_column(header).to_list() for header in headers[nindices:]
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_headers, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_headers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":481
 *         nindices = self._get_num_indices()
 *         headers = self._get_headers()
 *         columns = {             # <<<<<<<<<<<<<<
 *             header: self._get_column(header).to_list() for header in headers[nindices:]
 *         }
*/
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 481, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "amplpy/dataframe.pxi":482
 *         headers = self._get_headers()
 *         columns = {
 *             header: self._get_column(header).to_list() for header in headers[nindices:]             # <<<<<<<<<<<<<<
 *         }
 *         index_names = headers[:nindices]
*/
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_headers, 0, 0, &__pyx_v_nindices, NULL, NULL, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 482, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 482, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 482, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 482, __pyx_L5_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_5, __pyx_t_6);
          ++__pyx_t_6;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 482, __pyx_L5_error)
            #endif
            if (__pyx_t_6 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6));
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6);
          #endif
          ++__pyx_t_6;
        }
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 482, __pyx_L5_error)
      } else {
        __pyx_t_3 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 482, __pyx_L5_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_header, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_10 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_10);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_9genexpr11__pyx_v_header};
        __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_column, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 482, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_t_8 = __pyx_t_9;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 482, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr11__pyx_v_header, (PyObject*)__pyx_t_3))) __PYX_ERR(1, 482, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_header); __pyx_9genexpr11__pyx_v_header = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_header); __pyx_9genexpr11__pyx_v_header = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_v_columns = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":484
 *             header: self._get_column(header).to_list() for header in headers[nindices:]
 *         }
 *         index_names = headers[:nindices]             # <<<<<<<<<<<<<<
 *         if len(index_names) >= 2 and multi_index is True:
 *             index = pd.MultiIndex.from_arrays(
*/
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_headers, 0, 0, NULL, &__pyx_v_nindices, NULL, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_index_names = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/dataframe.pxi":485
 *         }
 *         index_names = headers[:nindices]
 *         if len(index_names) >= 2 and multi_index is True:             # <<<<<<<<<<<<<<
 *             index = pd.MultiIndex.from_arrays(
 *                 [self._get_column(header).to_list() for header in index_names],
*/
  __pyx_t_6 = PyObject_Length(__pyx_v_index_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(1, 485, __pyx_L1_error)
  __pyx_t_11 = (__pyx_t_6 >= 2);
  if (__pyx_t_11) {
  } else {
    __pyx_t_2 = __pyx_t_11;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_11 = (__pyx_v_multi_index == Py_True);
  __pyx_t_2 = __pyx_t_11;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":486
 *         index_names = headers[:nindices]
 *         if len(index_names) >= 2 and multi_index is True:
 *             index = pd.MultiIndex.from_arrays(             # <<<<<<<<<<<<<<
 *                 [self._get_column(header).to_list() for header in index_names],
 *                 names=index_names,
*/
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_MultiIndex); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __pyx_t_9;
    __Pyx_INCREF(__pyx_t_5);
    { /* enter inner scope */

      /* "amplpy/dataframe.pxi":487
 *         if len(index_names) >= 2 and multi_index is True:
 *             index = pd.MultiIndex.from_arrays(
 *                 [self._get_column(header).to_list() for header in index_names],             # <<<<<<<<<<<<<<
 *                 names=index_names,
 *             )
*/
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 487, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(PyList_CheckExact(__pyx_v_index_names)) || PyTuple_CheckExact(__pyx_v_index_names)) {
        __pyx_t_8 = __pyx_v_index_names; __Pyx_INCREF(__pyx_t_8);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_index_names); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 487, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 487, __pyx_L15_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_8))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 487, __pyx_L15_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_10 = __Pyx_PyList_GetItemRef(__pyx_t_8, __pyx_t_6);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 487, __pyx_L15_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6));
            #else
            __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 487, __pyx_L15_error)
        } else {
          __pyx_t_10 = __pyx_t_7(__pyx_t_8);
          if (unlikely(!__pyx_t_10)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 487, __pyx_L15_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_header, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_14 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_14);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_9genexpr12__pyx_v_header};
          __pyx_t_13 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_column, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 487, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_13);
        }
        __pyx_t_12 = __pyx_t_13;
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
          __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 487, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_10);
        }
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_10))) __PYX_ERR(1, 487, __pyx_L15_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_header); __pyx_9genexpr12__pyx_v_header = 0;
      goto __pyx_L19_exit_scope;
      __pyx_L15_error:;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_header); __pyx_9genexpr12__pyx_v_header = 0;
      goto __pyx_L1_error;
      __pyx_L19_exit_scope:;
    } /* exit inner scope */

    /* "amplpy/dataframe.pxi":488
 *             index = pd.MultiIndex.from_arrays(
 *                 [self._get_column(header).to_list() for header in index_names],
 *                 names=index_names,             # <<<<<<<<<<<<<<
 *             )
 *             return pd.DataFrame(columns, index=index)
*/
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_names, __pyx_v_index_names, __pyx_t_8, __pyx_callargs+2, 0) < 0) __PYX_ERR(1, 486, __pyx_L1_error)
      __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_from_arrays, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_index = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "amplpy/dataframe.pxi":490
 *                 names=index_names,
 *             )
 *             return pd.DataFrame(columns, index=index)             # <<<<<<<<<<<<<<
 *         else:
 *             index = zip(*[self._get_column(header).to_list() for header in index_names])
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_9);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_9, __pyx_v_columns};
      __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_index, __pyx_t_8, __pyx_callargs+2, 0) < 0) __PYX_ERR(1, 490, __pyx_L1_error)
      __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/dataframe.pxi":485
 *         }
 *         index_names = headers[:nindices]
 *         if len(index_names) >= 2 and multi_index is True:             # <<<<<<<<<<<<<<
 *             index = pd.MultiIndex.from_arrays(
 *                 [self._get_column(header).to_list() for header in index_names],
*/
  }

  /* "amplpy/dataframe.pxi":492
 *             return pd.DataFrame(columns, index=index)
 *         else:
 *             index = zip(*[self._get_column(header).to_list() for header in index_names])             # <<<<<<<<<<<<<<
 *             index = [key if len(key) > 1 else key[0] for key in index]
 *             if index == []:
*/
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_v_index_names)) || PyTuple_CheckExact(__pyx_v_index_names)) {
        __pyx_t_3 = __pyx_v_index_names; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_index_names); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 492, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 492, __pyx_L22_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 492, __pyx_L22_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_8 = __Pyx_PyList_GetItemRef(__pyx_t_3, __pyx_t_6);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 492, __pyx_L22_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 492, __pyx_L22_error)
        } else {
          __pyx_t_8 = __pyx_t_7(__pyx_t_3);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 492, __pyx_L22_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_header, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_10 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_9genexpr13__pyx_v_header};
          __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_column, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 492, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_t_9 = __pyx_t_5;
        __Pyx_INCREF(__pyx_t_9);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
          __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 492, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_8);
        }
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_8))) __PYX_ERR(1, 492, __pyx_L22_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_header); __pyx_9genexpr13__pyx_v_header = 0;
      goto __pyx_L26_exit_scope;
      __pyx_L22_error:;
      __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_header); __pyx_9genexpr13__pyx_v_header = 0;
      goto __pyx_L1_error;
      __pyx_L26_exit_scope:;
    } /* exit inner scope */
    __pyx_t_3 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_index = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "amplpy/dataframe.pxi":493
 *         else:
 *             index = zip(*[self._get_column(header).to_list() for header in index_names])
 *             index = [key if len(key) > 1 else key[0] for key in index]             # <<<<<<<<<<<<<<
 *             if index == []:
 *                 return pd.DataFrame(columns, index=None)
*/
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L29_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
        __pyx_t_3 = __pyx_v_index; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 493, __pyx_L29_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 493, __pyx_L29_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 493, __pyx_L29_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_8 = __Pyx_PyList_GetItemRef(__pyx_t_3, __pyx_t_6);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 493, __pyx_L29_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
            #else
            __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 493, __pyx_L29_error)
        } else {
          __pyx_t_8 = __pyx_t_7(__pyx_t_3);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 493, __pyx_L29_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_key, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_15 = PyObject_Length(__pyx_9genexpr14__pyx_v_key); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(1, 493, __pyx_L29_error)
        __pyx_t_2 = (__pyx_t_15 > 1);
        if (__pyx_t_2) {
          __Pyx_INCREF(__pyx_9genexpr14__pyx_v_key);
          __pyx_t_8 = __pyx_9genexpr14__pyx_v_key;
        } else {
          __pyx_t_5 = __Pyx_GetItemInt(__pyx_9genexpr14__pyx_v_key, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_8 = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_8))) __PYX_ERR(1, 493, __pyx_L29_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_key); __pyx_9genexpr14__pyx_v_key = 0;
      goto __pyx_L33_exit_scope;
      __pyx_L29_error:;
      __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_key); __pyx_9genexpr14__pyx_v_key = 0;
      goto __pyx_L1_error;
      __pyx_L33_exit_scope:;
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/dataframe.pxi":494
 *             index = zip(*[self._get_column(header).to_list() for header in index_names])
 *             index = [key if len(key) > 1 else key[0] for key in index]
 *             if index == []:             # <<<<<<<<<<<<<<
 *                 return pd.DataFrame(columns, index=None)
 *             else:
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_index, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 494, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 494, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "amplpy/dataframe.pxi":495
 *             index = [key if len(key) > 1 else key[0] for key in index]
 *             if index == []:
 *                 return pd.DataFrame(columns, index=None)             # <<<<<<<<<<<<<<
 *             else:
 *                 return pd.DataFrame(columns, index=index)
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_v_columns};
        __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, Py_None, __pyx_t_8, __pyx_callargs+2, 0) < 0) __PYX_ERR(1, 495, __pyx_L1_error)
        __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "amplpy/dataframe.pxi":494
 *             index = zip(*[self._get_column(header).to_list() for header in index_names])
 *             index = [key if len(key) > 1 else key[0] for key in index]
 *             if index == []:             # <<<<<<<<<<<<<<
 *                 return pd.DataFrame(columns, index=None)
 *             else:
*/
    }

    /* "amplpy/dataframe.pxi":497
 *                 return pd.DataFrame(columns, index=None)
 *             else:
 *                 return pd.DataFrame(columns, index=index)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_columns};
        __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_index, __pyx_t_8, __pyx_callargs+2, 0) < 0) __PYX_ERR(1, 497, __pyx_L1_error)
        __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
  }

  /* "amplpy/dataframe.pxi":474
 *             return lst
 * 
 *     def to_pandas(self, multi_index=True):             # <<<<<<<<<<<<<<
 *         """
 *         Return a pandas.DataFrame with the DataFrame data.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.to_pandas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nindices);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_columns);
  __Pyx_XDECREF(__pyx_v_index_names);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_header);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_header);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_header);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":499
 *                 return pd.DataFrame(columns, index=index)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_dict(cls, dic, index_names=None, column_names=None):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_39from_dict(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_38from_dict, "DataFrame.from_dict(cls, dic, index_names=None, column_names=None)\nCreate a :class:`~amplpy.DataFrame` from a dictionary.\n\nArgs:\n    dic: dictionary to load.\n    index_names: index names to use.\n    column_names: column names to use.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_39from_dict = {"from_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_39from_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_38from_dict};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_39from_dict(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_dic = 0;
  PyObject *__pyx_v_index_names = 0;
  PyObject *__pyx_v_column_names = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_dict (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_dic,&__pyx_mstate_global->__pyx_n_u_index_names,&__pyx_mstate_global->__pyx_n_u_column_names,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 499, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 499, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 499, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 499, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_dict", 0) < 0) __PYX_ERR(1, 499, __pyx_L3_error)

      /* "amplpy/dataframe.pxi":500
 * 
 *     @classmethod
 *     def from_dict(cls, dic, index_names=None, column_names=None):             # <<<<<<<<<<<<<<
 *         """
 *         Create a :class:`~amplpy.DataFrame` from a dictionary.
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_dict", 0, 1, 3, i); __PYX_ERR(1, 499, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 499, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 499, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 499, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_dic = values[0];
    __pyx_v_index_names = values[1];
    __pyx_v_column_names = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_dict", 0, 1, 3, __pyx_nargs); __PYX_ERR(1, 499, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_38from_dict(((PyTypeObject*)__pyx_v_cls), __pyx_v_dic, __pyx_v_index_names, __pyx_v_column_names);

  /* "amplpy/dataframe.pxi":499
 *                 return pd.DataFrame(columns, index=index)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_dict(cls, dic, index_names=None, column_names=None):
 *         """
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":512
 *         assert len(dic) != 0
 * 
 *         def to_tuple(e):             # <<<<<<<<<<<<<<
 *             if isinstance(e, (tuple, list)):
 *                 return tuple(e)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_9from_dict_1to_tuple(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_9from_dict_1to_tuple = {"to_tuple", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_9from_dict_1to_tuple, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_9from_dict_1to_tuple(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_e = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_tuple (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 512, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 512, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_tuple", 0) < 0) __PYX_ERR(1, 512, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_tuple", 1, 1, 1, i); __PYX_ERR(1, 512, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 512, __pyx_L3_error)
    }
    __pyx_v_e = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_tuple", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 512, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_dict.to_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_to_tuple(__pyx_self, __pyx_v_e);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_to_tuple(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_tuple", 0);

  /* "amplpy/dataframe.pxi":513
 * 
 *         def to_tuple(e):
 *             if isinstance(e, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 return tuple(e)
 *             else:
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_e); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyList_Check(__pyx_v_e); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":514
 *         def to_tuple(e):
 *             if isinstance(e, (tuple, list)):
 *                 return tuple(e)             # <<<<<<<<<<<<<<
 *             else:
 *                 return (e,)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "amplpy/dataframe.pxi":513
 * 
 *         def to_tuple(e):
 *             if isinstance(e, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 return tuple(e)
 *             else:
*/
  }

  /* "amplpy/dataframe.pxi":516
 *                 return tuple(e)
 *             else:
 *                 return (e,)             # <<<<<<<<<<<<<<
 * 
 *         lst_index = list(map(to_tuple, dic.keys()))
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_e);
    __Pyx_GIVEREF(__pyx_v_e);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e) != (0)) __PYX_ERR(1, 516, __pyx_L1_error);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "amplpy/dataframe.pxi":512
 *         assert len(dic) != 0
 * 
 *         def to_tuple(e):             # <<<<<<<<<<<<<<
 *             if isinstance(e, (tuple, list)):
 *                 return tuple(e)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_dict.to_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_4generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/dataframe.pxi":523
 *         assert index_names is None or nindices == len(index_names)
 *         assert column_names is None or ncolumns == len(column_names)
 *         assert all(len(k) == nindices for k in lst_index)             # <<<<<<<<<<<<<<
 *         assert all(len(v) == ncolumns for v in lst_columns)
 * 
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_2genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_7_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 523, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_4generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_from_dict_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(1, 523, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_dict.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_4generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 523, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(1, 523, __pyx_L1_error) }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 523, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_4 = PyObject_Length(__pyx_cur_scope->__pyx_v_k); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 523, __pyx_L1_error)
    __pyx_t_5 = (!(__pyx_t_4 == __pyx_cur_scope->__pyx_outer_scope->__pyx_v_nindices));
    if (__pyx_t_5) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_7generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/dataframe.pxi":524
 *         assert column_names is None or ncolumns == len(column_names)
 *         assert all(len(k) == nindices for k in lst_index)
 *         assert all(len(v) == ncolumns for v in lst_columns)             # <<<<<<<<<<<<<<
 * 
 *         index = zip(*lst_index)
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_5genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_8_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 524, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_7generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_from_dict_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_dict.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_7generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 524, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(1, 524, __pyx_L1_error) }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 524, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_4 = PyObject_Length(__pyx_cur_scope->__pyx_v_v); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 524, __pyx_L1_error)
    __pyx_t_5 = (!(__pyx_t_4 == __pyx_cur_scope->__pyx_outer_scope->__pyx_v_ncolumns));
    if (__pyx_t_5) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":499
 *                 return pd.DataFrame(columns, index=index)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_dict(cls, dic, index_names=None, column_names=None):
 *         """
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_38from_dict(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_dic, PyObject *__pyx_v_index_names, PyObject *__pyx_v_column_names) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *__pyx_cur_scope;
  PyObject *__pyx_v_to_tuple = 0;
  PyObject *__pyx_v_lst_index = NULL;
  PyObject *__pyx_v_lst_columns = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_columns = NULL;
  PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_4generator4 = 0;
  PyObject *__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_7generator5 = 0;
  Py_ssize_t __pyx_9genexpr17__pyx_v_i;
  Py_ssize_t __pyx_9genexpr18__pyx_v_i;
  PyObject *__pyx_9genexpr19__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr19__pyx_v_cindex = NULL;
  PyObject *__pyx_9genexpr20__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr20__pyx_v_column = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_dict", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_6_from_dict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 499, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __Pyx_INCREF(__pyx_v_index_names);
  __Pyx_INCREF(__pyx_v_column_names);

  /* "amplpy/dataframe.pxi":509
 *             column_names: column names to use.
 *         """
 *         assert isinstance(dic, dict)             # <<<<<<<<<<<<<<
 *         assert len(dic) != 0
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = PyDict_Check(__pyx_v_dic); 
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 509, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 509, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":510
 *         """
 *         assert isinstance(dic, dict)
 *         assert len(dic) != 0             # <<<<<<<<<<<<<<
 * 
 *         def to_tuple(e):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_Length(__pyx_v_dic); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 510, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 510, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 510, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":512
 *         assert len(dic) != 0
 * 
 *         def to_tuple(e):             # <<<<<<<<<<<<<<
 *             if isinstance(e, (tuple, list)):
 *                 return tuple(e)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_9from_dict_1to_tuple, 0, __pyx_mstate_global->__pyx_n_u_from_dict_locals_to_tuple, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_to_tuple = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":518
 *                 return (e,)
 * 
 *         lst_index = list(map(to_tuple, dic.keys()))             # <<<<<<<<<<<<<<
 *         lst_columns = list(map(to_tuple, dic.values()))
 *         nindices, ncolumns = len(lst_index[0]), len(lst_columns[0])
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_builtin_map);
  __pyx_t_5 = __pyx_builtin_map; 
  __pyx_t_7 = __pyx_v_dic;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_keys, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_to_tuple, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_5 = __Pyx_PySequence_ListKeepNew(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_lst_index = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "amplpy/dataframe.pxi":519
 * 
 *         lst_index = list(map(to_tuple, dic.keys()))
 *         lst_columns = list(map(to_tuple, dic.values()))             # <<<<<<<<<<<<<<
 *         nindices, ncolumns = len(lst_index[0]), len(lst_columns[0])
 *         assert index_names is None or nindices == len(index_names)
*/
  __pyx_t_3 = NULL;
  __Pyx_INCREF(__pyx_builtin_map);
  __pyx_t_6 = __pyx_builtin_map; 
  __pyx_t_7 = __pyx_v_dic;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_to_tuple, __pyx_t_4};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __Pyx_PySequence_ListKeepNew(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_lst_columns = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "amplpy/dataframe.pxi":520
 *         lst_index = list(map(to_tuple, dic.keys()))
 *         lst_columns = list(map(to_tuple, dic.values()))
 *         nindices, ncolumns = len(lst_index[0]), len(lst_columns[0])             # <<<<<<<<<<<<<<
 *         assert index_names is None or nindices == len(index_names)
 *         assert column_names is None or ncolumns == len(column_names)
*/
  __pyx_t_6 = __Pyx_PyList_GET_ITEM(__pyx_v_lst_index, 0);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 520, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyList_GET_ITEM(__pyx_v_lst_columns, 0);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_9 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 520, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_cur_scope->__pyx_v_nindices = __pyx_t_2;
  __pyx_cur_scope->__pyx_v_ncolumns = __pyx_t_9;

  /* "amplpy/dataframe.pxi":521
 *         lst_columns = list(map(to_tuple, dic.values()))
 *         nindices, ncolumns = len(lst_index[0]), len(lst_columns[0])
 *         assert index_names is None or nindices == len(index_names)             # <<<<<<<<<<<<<<
 *         assert column_names is None or ncolumns == len(column_names)
 *         assert all(len(k) == nindices for k in lst_index)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_10 = (__pyx_v_index_names == Py_None);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_1 = __pyx_t_10;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_9 = PyObject_Length(__pyx_v_index_names); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 521, __pyx_L1_error)
    __pyx_t_10 = (__pyx_cur_scope->__pyx_v_nindices == __pyx_t_9);
    __pyx_t_1 = __pyx_t_10;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 521, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 521, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":522
 *         nindices, ncolumns = len(lst_index[0]), len(lst_columns[0])
 *         assert index_names is None or nindices == len(index_names)
 *         assert column_names is None or ncolumns == len(column_names)             # <<<<<<<<<<<<<<
 *         assert all(len(k) == nindices for k in lst_index)
 *         assert all(len(v) == ncolumns for v in lst_columns)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_10 = (__pyx_v_column_names == Py_None);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_1 = __pyx_t_10;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_9 = PyObject_Length(__pyx_v_column_names); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 522, __pyx_L1_error)
    __pyx_t_10 = (__pyx_cur_scope->__pyx_v_ncolumns == __pyx_t_9);
    __pyx_t_1 = __pyx_t_10;
    __pyx_L5_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 522, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 522, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":523
 *         assert index_names is None or nindices == len(index_names)
 *         assert column_names is None or ncolumns == len(column_names)
 *         assert all(len(k) == nindices for k in lst_index)             # <<<<<<<<<<<<<<
 *         assert all(len(v) == ncolumns for v in lst_columns)
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_6 = __pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_2genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_lst_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_Generator_GetInlinedResult(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 523, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 523, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 523, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":524
 *         assert column_names is None or ncolumns == len(column_names)
 *         assert all(len(k) == nindices for k in lst_index)
 *         assert all(len(v) == ncolumns for v in lst_columns)             # <<<<<<<<<<<<<<
 * 
 *         index = zip(*lst_index)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_5 = __pyx_pf_6amplpy_4ampl_9DataFrame_9from_dict_5genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_lst_columns); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_Generator_GetInlinedResult(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 524, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 524, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":526
 *         assert all(len(v) == ncolumns for v in lst_columns)
 * 
 *         index = zip(*lst_index)             # <<<<<<<<<<<<<<
 *         columns = zip(*lst_columns)
 * 
*/
  __pyx_t_6 = PySequence_Tuple(__pyx_v_lst_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_index = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "amplpy/dataframe.pxi":527
 * 
 *         index = zip(*lst_index)
 *         columns = zip(*lst_columns)             # <<<<<<<<<<<<<<
 * 
 *         if index_names is None:
*/
  __pyx_t_5 = PySequence_Tuple(__pyx_v_lst_columns); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_columns = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "amplpy/dataframe.pxi":529
 *         columns = zip(*lst_columns)
 * 
 *         if index_names is None:             # <<<<<<<<<<<<<<
 *             index_names = [f"index{i}" for i in range(nindices)]
 * 
*/
  __pyx_t_1 = (__pyx_v_index_names == Py_None);
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":530
 * 
 *         if index_names is None:
 *             index_names = [f"index{i}" for i in range(nindices)]             # <<<<<<<<<<<<<<
 * 
 *         if column_names is None:
*/
    { /* enter inner scope */
      __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 530, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __pyx_cur_scope->__pyx_v_nindices;
      __pyx_t_2 = __pyx_t_9;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11+=1) {
        __pyx_9genexpr17__pyx_v_i = __pyx_t_11;
        __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_9genexpr17__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 530, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_n_u_index, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 530, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_4))) __PYX_ERR(1, 530, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_index_names, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "amplpy/dataframe.pxi":529
 *         columns = zip(*lst_columns)
 * 
 *         if index_names is None:             # <<<<<<<<<<<<<<
 *             index_names = [f"index{i}" for i in range(nindices)]
 * 
*/
  }

  /* "amplpy/dataframe.pxi":532
 *             index_names = [f"index{i}" for i in range(nindices)]
 * 
 *         if column_names is None:             # <<<<<<<<<<<<<<
 *             column_names = [f"value{i}" for i in range(ncolumns)]
 * 
*/
  __pyx_t_1 = (__pyx_v_column_names == Py_None);
  if (__pyx_t_1) {

    /* "amplpy/dataframe.pxi":533
 * 
 *         if column_names is None:
 *             column_names = [f"value{i}" for i in range(ncolumns)]             # <<<<<<<<<<<<<<
 * 
 *         index = [(index_names[i], cindex) for i, cindex in enumerate(zip(*lst_index))]
*/
    { /* enter inner scope */
      __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __pyx_cur_scope->__pyx_v_ncolumns;
      __pyx_t_2 = __pyx_t_9;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11+=1) {
        __pyx_9genexpr18__pyx_v_i = __pyx_t_11;
        __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_9genexpr18__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 533, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_n_u_value, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 533, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 533, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    } /* exit inner scope */
    __Pyx_DECREF_SET(__pyx_v_column_names, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "amplpy/dataframe.pxi":532
 *             index_names = [f"index{i}" for i in range(nindices)]
 * 
 *         if column_names is None:             # <<<<<<<<<<<<<<
 *             column_names = [f"value{i}" for i in range(ncolumns)]
 * 
*/
  }

  /* "amplpy/dataframe.pxi":535
 *             column_names = [f"value{i}" for i in range(ncolumns)]
 * 
 *         index = [(index_names[i], cindex) for i, cindex in enumerate(zip(*lst_index))]             # <<<<<<<<<<<<<<
 *         columns = [
 *             (column_names[i], column) for i, column in enumerate(zip(*lst_columns))
*/
  { /* enter inner scope */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 535, __pyx_L15_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_t_5 = __pyx_mstate_global->__pyx_int_0;
    __pyx_t_4 = PySequence_Tuple(__pyx_v_lst_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 535, __pyx_L15_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 535, __pyx_L15_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_9 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 535, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 535, __pyx_L15_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 535, __pyx_L15_error)
            #endif
            if (__pyx_t_9 >= __pyx_temp) break;
          }
          __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_9);
          ++__pyx_t_9;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 535, __pyx_L15_error)
            #endif
            if (__pyx_t_9 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9));
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9);
          #endif
          ++__pyx_t_9;
        }
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 535, __pyx_L15_error)
      } else {
        __pyx_t_3 = __pyx_t_12(__pyx_t_4);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 535, __pyx_L15_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_cindex, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_i, __pyx_t_5);
      __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 535, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5);
      __pyx_t_5 = __pyx_t_3;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_index_names, __pyx_9genexpr19__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 535, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 535, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3) != (0)) __PYX_ERR(1, 535, __pyx_L15_error);
      __Pyx_INCREF(__pyx_9genexpr19__pyx_v_cindex);
      __Pyx_GIVEREF(__pyx_9genexpr19__pyx_v_cindex);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_9genexpr19__pyx_v_cindex) != (0)) __PYX_ERR(1, 535, __pyx_L15_error);
      __pyx_t_3 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_7))) __PYX_ERR(1, 535, __pyx_L15_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_cindex); __pyx_9genexpr19__pyx_v_cindex = 0;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_i); __pyx_9genexpr19__pyx_v_i = 0;
    goto __pyx_L19_exit_scope;
    __pyx_L15_error:;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_cindex); __pyx_9genexpr19__pyx_v_cindex = 0;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_i); __pyx_9genexpr19__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L19_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "amplpy/dataframe.pxi":536
 * 
 *         index = [(index_names[i], cindex) for i, cindex in enumerate(zip(*lst_index))]
 *         columns = [             # <<<<<<<<<<<<<<
 *             (column_names[i], column) for i, column in enumerate(zip(*lst_columns))
 *         ]
*/
  { /* enter inner scope */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 536, __pyx_L22_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_t_5 = __pyx_mstate_global->__pyx_int_0;

    /* "amplpy/dataframe.pxi":537
 *         index = [(index_names[i], cindex) for i, cindex in enumerate(zip(*lst_index))]
 *         columns = [
 *             (column_names[i], column) for i, column in enumerate(zip(*lst_columns))             # <<<<<<<<<<<<<<
 *         ]
 *         return cls(index=index, columns=columns)
*/
    __pyx_t_4 = PySequence_Tuple(__pyx_v_lst_columns); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 537, __pyx_L22_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 537, __pyx_L22_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
      __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_9 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 537, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 537, __pyx_L22_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 537, __pyx_L22_error)
            #endif
            if (__pyx_t_9 >= __pyx_temp) break;
          }
          __pyx_t_7 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_9);
          ++__pyx_t_9;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 537, __pyx_L22_error)
            #endif
            if (__pyx_t_9 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9));
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9);
          #endif
          ++__pyx_t_9;
        }
        if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 537, __pyx_L22_error)
      } else {
        __pyx_t_7 = __pyx_t_12(__pyx_t_4);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 537, __pyx_L22_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_column, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_i, __pyx_t_5);
      __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 537, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5);
      __pyx_t_5 = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "amplpy/dataframe.pxi":536
 * 
 *         index = [(index_names[i], cindex) for i, cindex in enumerate(zip(*lst_index))]
 *         columns = [             # <<<<<<<<<<<<<<
 *             (column_names[i], column) for i, column in enumerate(zip(*lst_columns))
 *         ]
*/
      __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_column_names, __pyx_9genexpr20__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 537, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "amplpy/dataframe.pxi":537
 *         index = [(index_names[i], cindex) for i, cindex in enumerate(zip(*lst_index))]
 *         columns = [
 *             (column_names[i], column) for i, column in enumerate(zip(*lst_columns))             # <<<<<<<<<<<<<<
 *         ]
 *         return cls(index=index, columns=columns)
*/
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 537, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7) != (0)) __PYX_ERR(1, 537, __pyx_L22_error);
      __Pyx_INCREF(__pyx_9genexpr20__pyx_v_column);
      __Pyx_GIVEREF(__pyx_9genexpr20__pyx_v_column);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_9genexpr20__pyx_v_column) != (0)) __PYX_ERR(1, 537, __pyx_L22_error);
      __pyx_t_7 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(1, 536, __pyx_L22_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_column); __pyx_9genexpr20__pyx_v_column = 0;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_i); __pyx_9genexpr20__pyx_v_i = 0;
    goto __pyx_L26_exit_scope;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_column); __pyx_9genexpr20__pyx_v_column = 0;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_i); __pyx_9genexpr20__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L26_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_columns, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "amplpy/dataframe.pxi":539
 *             (column_names[i], column) for i, column in enumerate(zip(*lst_columns))
 *         ]
 *         return cls(index=index, columns=columns)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_cls);
  __pyx_t_4 = ((PyObject *)__pyx_v_cls); 
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, NULL};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_index, __pyx_t_3, __pyx_callargs+1, 0) < 0) __PYX_ERR(1, 539, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_columns, __pyx_v_columns, __pyx_t_3, __pyx_callargs+1, 1) < 0) __PYX_ERR(1, 539, __pyx_L1_error)
    __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_4, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":499
 *                 return pd.DataFrame(columns, index=index)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_dict(cls, dic, index_names=None, column_names=None):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_to_tuple);
  __Pyx_XDECREF(__pyx_v_lst_index);
  __Pyx_XDECREF(__pyx_v_lst_columns);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_columns);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_4generator4);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9DataFrame_9from_dict_7generator5);
  __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_cindex);
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_column);
  __Pyx_XDECREF(__pyx_v_index_names);
  __Pyx_XDECREF(__pyx_v_column_names);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":541
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_41from_pandas(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_40from_pandas, "DataFrame.from_pandas(cls, df, index_names=None, indexarity=None)\nCreate a :class:`~amplpy.DataFrame` from a pandas DataFrame.\n\nArgs:\n    df: Pandas DataFrame to load.\n    index_names: index names to use.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_41from_pandas = {"from_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_41from_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_40from_pandas};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_41from_pandas(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_df = 0;
  PyObject *__pyx_v_index_names = 0;
  PyObject *__pyx_v_indexarity = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_pandas (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_df,&__pyx_mstate_global->__pyx_n_u_index_names,&__pyx_mstate_global->__pyx_n_u_indexarity,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 541, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_pandas", 0) < 0) __PYX_ERR(1, 541, __pyx_L3_error)

      /* "amplpy/dataframe.pxi":542
 * 
 *     @classmethod
 *     def from_pandas(cls, df, index_names=None, indexarity=None):             # <<<<<<<<<<<<<<
 *         """
 *         Create a :class:`~amplpy.DataFrame` from a pandas DataFrame.
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_pandas", 0, 1, 3, i); __PYX_ERR(1, 541, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 541, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 541, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_df = values[0];
    __pyx_v_index_names = values[1];
    __pyx_v_indexarity = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_pandas", 0, 1, 3, __pyx_nargs); __PYX_ERR(1, 541, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_pandas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_40from_pandas(((PyTypeObject*)__pyx_v_cls), __pyx_v_df, __pyx_v_index_names, __pyx_v_indexarity);

  /* "amplpy/dataframe.pxi":541
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_40from_pandas(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df, PyObject *__pyx_v_index_names, PyObject *__pyx_v_indexarity) {
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_index = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_columns = NULL;
  PyObject *__pyx_9genexpr21__pyx_v_key = NULL;
  PyObject *__pyx_9genexpr22__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr22__pyx_v_cindex = NULL;
  PyObject *__pyx_9genexpr23__pyx_v_cname = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_pandas", 0);
  __Pyx_INCREF(__pyx_v_df);

  /* "amplpy/dataframe.pxi":550
 *             index_names: index names to use.
 *         """
 *         assert pd is not None             # <<<<<<<<<<<<<<
 *         if isinstance(df, pd.Series):
 *             df = pd.DataFrame(df)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (__pyx_t_1 != Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 550, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 550, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":551
 *         """
 *         assert pd is not None
 *         if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *             df = pd.DataFrame(df)
 *         else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_df, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":552
 *         assert pd is not None
 *         if isinstance(df, pd.Series):
 *             df = pd.DataFrame(df)             # <<<<<<<<<<<<<<
 *         else:
 *             assert isinstance(df, pd.DataFrame)
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_df};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 552, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF_SET(__pyx_v_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "amplpy/dataframe.pxi":551
 *         """
 *         assert pd is not None
 *         if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *             df = pd.DataFrame(df)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/dataframe.pxi":554
 *             df = pd.DataFrame(df)
 *         else:
 *             assert isinstance(df, pd.DataFrame)             # <<<<<<<<<<<<<<
 *         if len(df) == 0:
 *             return cls(index=df.index.names, columns=df.columns.tolist())
*/
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 554, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_2 = PyObject_IsInstance(__pyx_v_df, __pyx_t_5); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 554, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(1, 554, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(1, 554, __pyx_L1_error)
    #endif
  }
  __pyx_L3:;

  /* "amplpy/dataframe.pxi":555
 *         else:
 *             assert isinstance(df, pd.DataFrame)
 *         if len(df) == 0:             # <<<<<<<<<<<<<<
 *             return cls(index=df.index.names, columns=df.columns.tolist())
 *         if isinstance(df.index[0], tuple):
*/
  __pyx_t_7 = PyObject_Length(__pyx_v_df); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(1, 555, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_7 == 0);
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":556
 *             assert isinstance(df, pd.DataFrame)
 *         if len(df) == 0:
 *             return cls(index=df.index.names, columns=df.columns.tolist())             # <<<<<<<<<<<<<<
 *         if isinstance(df.index[0], tuple):
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = NULL;
    __Pyx_INCREF((PyObject *)__pyx_v_cls);
    __pyx_t_1 = ((PyObject *)__pyx_v_cls); 
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_names); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_columns); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __pyx_t_10;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_3, NULL};
      __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_t_8, __pyx_t_10, __pyx_callargs+1, 0) < 0) __PYX_ERR(1, 556, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_columns, __pyx_t_4, __pyx_t_10, __pyx_callargs+1, 1) < 0) __PYX_ERR(1, 556, __pyx_L1_error)
      __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_1, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "amplpy/dataframe.pxi":555
 *         else:
 *             assert isinstance(df, pd.DataFrame)
 *         if len(df) == 0:             # <<<<<<<<<<<<<<
 *             return cls(index=df.index.names, columns=df.columns.tolist())
 *         if isinstance(df.index[0], tuple):
*/
  }

  /* "amplpy/dataframe.pxi":557
 *         if len(df) == 0:
 *             return cls(index=df.index.names, columns=df.columns.tolist())
 *         if isinstance(df.index[0], tuple):             # <<<<<<<<<<<<<<
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         if indexarity == df.index.nlevels + 1:
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = PyTuple_Check(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":558
 *             return cls(index=df.index.names, columns=df.columns.tolist())
 *         if isinstance(df.index[0], tuple):
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())             # <<<<<<<<<<<<<<
 *         if indexarity == df.index.nlevels + 1:
 *             df = df.stack()
*/
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_MultiIndex); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_from_tuples, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_1) < 0) __PYX_ERR(1, 558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/dataframe.pxi":557
 *         if len(df) == 0:
 *             return cls(index=df.index.names, columns=df.columns.tolist())
 *         if isinstance(df.index[0], tuple):             # <<<<<<<<<<<<<<
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         if indexarity == df.index.nlevels + 1:
*/
  }

  /* "amplpy/dataframe.pxi":559
 *         if isinstance(df.index[0], tuple):
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         if indexarity == df.index.nlevels + 1:             # <<<<<<<<<<<<<<
 *             df = df.stack()
 *             if isinstance(df, pd.Series):
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_nlevels); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_indexarity, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":560
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         if indexarity == df.index.nlevels + 1:
 *             df = df.stack()             # <<<<<<<<<<<<<<
 *             if isinstance(df, pd.Series):
 *                 df = pd.DataFrame(df)
*/
    __pyx_t_1 = __pyx_v_df;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_stack, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF_SET(__pyx_v_df, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "amplpy/dataframe.pxi":561
 *         if indexarity == df.index.nlevels + 1:
 *             df = df.stack()
 *             if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *                 df = pd.DataFrame(df)
 *         if isinstance(df.index[0], tuple):
*/
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_df, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 561, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "amplpy/dataframe.pxi":562
 *             df = df.stack()
 *             if isinstance(df, pd.Series):
 *                 df = pd.DataFrame(df)             # <<<<<<<<<<<<<<
 *         if isinstance(df.index[0], tuple):
 *             keys = df.index.tolist()
*/
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_df};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF_SET(__pyx_v_df, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "amplpy/dataframe.pxi":561
 *         if indexarity == df.index.nlevels + 1:
 *             df = df.stack()
 *             if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *                 df = pd.DataFrame(df)
 *         if isinstance(df.index[0], tuple):
*/
    }

    /* "amplpy/dataframe.pxi":559
 *         if isinstance(df.index[0], tuple):
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         if indexarity == df.index.nlevels + 1:             # <<<<<<<<<<<<<<
 *             df = df.stack()
 *             if isinstance(df, pd.Series):
*/
  }

  /* "amplpy/dataframe.pxi":563
 *             if isinstance(df, pd.Series):
 *                 df = pd.DataFrame(df)
 *         if isinstance(df.index[0], tuple):             # <<<<<<<<<<<<<<
 *             keys = df.index.tolist()
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = PyTuple_Check(__pyx_t_5); 
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":564
 *                 df = pd.DataFrame(df)
 *         if isinstance(df.index[0], tuple):
 *             keys = df.index.tolist()             # <<<<<<<<<<<<<<
 *         else:
 *             keys = [(key,) for key in df.index]
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_v_keys = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "amplpy/dataframe.pxi":563
 *             if isinstance(df, pd.Series):
 *                 df = pd.DataFrame(df)
 *         if isinstance(df.index[0], tuple):             # <<<<<<<<<<<<<<
 *             keys = df.index.tolist()
 *         else:
*/
    goto __pyx_L8;
  }

  /* "amplpy/dataframe.pxi":566
 *             keys = df.index.tolist()
 *         else:
 *             keys = [(key,) for key in df.index]             # <<<<<<<<<<<<<<
 *         index = [(f"index{i}", cindex) for i, cindex in enumerate(zip(*keys))]
 *         if index_names is not None:
*/
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 566, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 566, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = 0;
        __pyx_t_11 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 566, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 566, __pyx_L11_error)
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(!__pyx_t_11)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 566, __pyx_L11_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_7);
            ++__pyx_t_7;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 566, __pyx_L11_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7));
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7);
            #endif
            ++__pyx_t_7;
          }
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 566, __pyx_L11_error)
        } else {
          __pyx_t_4 = __pyx_t_11(__pyx_t_1);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 566, __pyx_L11_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_9genexpr21__pyx_v_key, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 566, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_9genexpr21__pyx_v_key);
        __Pyx_GIVEREF(__pyx_9genexpr21__pyx_v_key);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_9genexpr21__pyx_v_key) != (0)) __PYX_ERR(1, 566, __pyx_L11_error);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) __PYX_ERR(1, 566, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_key); __pyx_9genexpr21__pyx_v_key = 0;
      goto __pyx_L15_exit_scope;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_key); __pyx_9genexpr21__pyx_v_key = 0;
      goto __pyx_L1_error;
      __pyx_L15_exit_scope:;
    } /* exit inner scope */
    __pyx_v_keys = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L8:;

  /* "amplpy/dataframe.pxi":567
 *         else:
 *             keys = [(key,) for key in df.index]
 *         index = [(f"index{i}", cindex) for i, cindex in enumerate(zip(*keys))]             # <<<<<<<<<<<<<<
 *         if index_names is not None:
 *             assert len(index) == len(index_names)
*/
  { /* enter inner scope */
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 567, __pyx_L18_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 567, __pyx_L18_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 567, __pyx_L18_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
      __pyx_t_4 = __pyx_t_10; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_7 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 567, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 567, __pyx_L18_error)
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 567, __pyx_L18_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          __pyx_t_10 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_7);
          ++__pyx_t_7;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 567, __pyx_L18_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7));
          #else
          __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7);
          #endif
          ++__pyx_t_7;
        }
        if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 567, __pyx_L18_error)
      } else {
        __pyx_t_10 = __pyx_t_11(__pyx_t_4);
        if (unlikely(!__pyx_t_10)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 567, __pyx_L18_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_cindex, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_i, __pyx_t_1);
      __pyx_t_10 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 567, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1);
      __pyx_t_1 = __pyx_t_10;
      __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_9genexpr22__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 567, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_n_u_index, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 567, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 567, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3) != (0)) __PYX_ERR(1, 567, __pyx_L18_error);
      __Pyx_INCREF(__pyx_9genexpr22__pyx_v_cindex);
      __Pyx_GIVEREF(__pyx_9genexpr22__pyx_v_cindex);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_9genexpr22__pyx_v_cindex) != (0)) __PYX_ERR(1, 567, __pyx_L18_error);
      __pyx_t_3 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_10))) __PYX_ERR(1, 567, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_cindex); __pyx_9genexpr22__pyx_v_cindex = 0;
    __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_i); __pyx_9genexpr22__pyx_v_i = 0;
    goto __pyx_L22_exit_scope;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_cindex); __pyx_9genexpr22__pyx_v_cindex = 0;
    __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_i); __pyx_9genexpr22__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L22_exit_scope:;
  } /* exit inner scope */
  __pyx_v_index = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "amplpy/dataframe.pxi":568
 *             keys = [(key,) for key in df.index]
 *         index = [(f"index{i}", cindex) for i, cindex in enumerate(zip(*keys))]
 *         if index_names is not None:             # <<<<<<<<<<<<<<
 *             assert len(index) == len(index_names)
 *             for i in range(len(index)):
*/
  __pyx_t_2 = (__pyx_v_index_names != Py_None);
  if (__pyx_t_2) {

    /* "amplpy/dataframe.pxi":569
 *         index = [(f"index{i}", cindex) for i, cindex in enumerate(zip(*keys))]
 *         if index_names is not None:
 *             assert len(index) == len(index_names)             # <<<<<<<<<<<<<<
 *             for i in range(len(index)):
 *                 index[i] = (index_names[i], index[i][1])
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_7 = __Pyx_PyList_GET_SIZE(__pyx_v_index); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(1, 569, __pyx_L1_error)
      __pyx_t_12 = PyObject_Length(__pyx_v_index_names); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 569, __pyx_L1_error)
      __pyx_t_2 = (__pyx_t_7 == __pyx_t_12);
      if (unlikely(!__pyx_t_2)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(1, 569, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(1, 569, __pyx_L1_error)
    #endif

    /* "amplpy/dataframe.pxi":570
 *         if index_names is not None:
 *             assert len(index) == len(index_names)
 *             for i in range(len(index)):             # <<<<<<<<<<<<<<
 *                 index[i] = (index_names[i], index[i][1])
 *         columns = [(str(cname), df[cname].tolist()) for cname in df.columns.tolist()]
*/
    __pyx_t_12 = __Pyx_PyList_GET_SIZE(__pyx_v_index); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 570, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_12;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_7; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "amplpy/dataframe.pxi":571
 *             assert len(index) == len(index_names)
 *             for i in range(len(index)):
 *                 index[i] = (index_names[i], index[i][1])             # <<<<<<<<<<<<<<
 *         columns = [(str(cname), df[cname].tolist()) for cname in df.columns.tolist()]
 *         return cls(index=index, columns=columns)
*/
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_index_names, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_GetItemInt(__Pyx_PyList_GET_ITEM(__pyx_v_index, __pyx_v_i), 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 571, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 571, __pyx_L1_error);
      __pyx_t_5 = 0;
      __pyx_t_1 = 0;
      if (unlikely((__Pyx_SetItemInt(__pyx_v_index, __pyx_v_i, __pyx_t_4, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 0, 0) < 0))) __PYX_ERR(1, 571, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }

    /* "amplpy/dataframe.pxi":568
 *             keys = [(key,) for key in df.index]
 *         index = [(f"index{i}", cindex) for i, cindex in enumerate(zip(*keys))]
 *         if index_names is not None:             # <<<<<<<<<<<<<<
 *             assert len(index) == len(index_names)
 *             for i in range(len(index)):
*/
  }

  /* "amplpy/dataframe.pxi":572
 *             for i in range(len(index)):
 *                 index[i] = (index_names[i], index[i][1])
 *         columns = [(str(cname), df[cname].tolist()) for cname in df.columns.tolist()]             # <<<<<<<<<<<<<<
 *         return cls(index=index, columns=columns)
 * 
*/
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 572, __pyx_L28_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_columns); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 572, __pyx_L28_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = __pyx_t_10;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 572, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10);
      __pyx_t_12 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 572, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 572, __pyx_L28_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_10))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 572, __pyx_L28_error)
            #endif
            if (__pyx_t_12 >= __pyx_temp) break;
          }
          __pyx_t_1 = __Pyx_PyList_GetItemRef(__pyx_t_10, __pyx_t_12);
          ++__pyx_t_12;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 572, __pyx_L28_error)
            #endif
            if (__pyx_t_12 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_12));
          #else
          __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_12);
          #endif
          ++__pyx_t_12;
        }
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 572, __pyx_L28_error)
      } else {
        __pyx_t_1 = __pyx_t_11(__pyx_t_10);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 572, __pyx_L28_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_9genexpr23__pyx_v_cname, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_9genexpr23__pyx_v_cname); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 572, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_df, __pyx_9genexpr23__pyx_v_cname); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 572, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __pyx_t_8;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 572, __pyx_L28_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 572, __pyx_L28_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 572, __pyx_L28_error);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5) != (0)) __PYX_ERR(1, 572, __pyx_L28_error);
      __pyx_t_1 = 0;
      __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_8))) __PYX_ERR(1, 572, __pyx_L28_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_cname); __pyx_9genexpr23__pyx_v_cname = 0;
    goto __pyx_L32_exit_scope;
    __pyx_L28_error:;
    __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_cname); __pyx_9genexpr23__pyx_v_cname = 0;
    goto __pyx_L1_error;
    __pyx_L32_exit_scope:;
  } /* exit inner scope */
  __pyx_v_columns = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "amplpy/dataframe.pxi":573
 *                 index[i] = (index_names[i], index[i][1])
 *         columns = [(str(cname), df[cname].tolist()) for cname in df.columns.tolist()]
 *         return cls(index=index, columns=columns)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_cls);
  __pyx_t_8 = ((PyObject *)__pyx_v_cls); 
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_10, NULL};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_index, __pyx_t_5, __pyx_callargs+1, 0) < 0) __PYX_ERR(1, 573, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_columns, __pyx_v_columns, __pyx_t_5, __pyx_callargs+1, 1) < 0) __PYX_ERR(1, 573, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":541
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_pandas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_columns);
  __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_key);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_cindex);
  __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_cname);
  __Pyx_XDECREF(__pyx_v_df);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":575
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_numpy(cls, data):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_43from_numpy(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_42from_numpy, "DataFrame.from_numpy(cls, data)\nCreate a :class:`~amplpy.DataFrame` from a numpy array or matrix.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_43from_numpy = {"from_numpy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_43from_numpy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_42from_numpy};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_43from_numpy(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_numpy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 575, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 575, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_numpy", 0) < 0) __PYX_ERR(1, 575, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_numpy", 1, 1, 1, i); __PYX_ERR(1, 575, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 575, __pyx_L3_error)
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_numpy", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 575, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_numpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_42from_numpy(((PyTypeObject*)__pyx_v_cls), __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_42from_numpy(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_data) {
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_columns = NULL;
  PyObject *__pyx_9genexpr24__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr24__pyx_v_col = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_numpy", 0);

  /* "amplpy/dataframe.pxi":580
 *         Create a :class:`~amplpy.DataFrame` from a numpy array or matrix.
 *         """
 *         assert np is not None             # <<<<<<<<<<<<<<
 *         if isinstance(data, np.ndarray):
 *             index = []
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (__pyx_t_1 != Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(1, 580, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 580, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe.pxi":581
 *         """
 *         assert np is not None
 *         if isinstance(data, np.ndarray):             # <<<<<<<<<<<<<<
 *             index = []
 *             if len(data.shape) == 1:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_data, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 581, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(__pyx_t_2)) {

    /* "amplpy/dataframe.pxi":582
 *         assert np is not None
 *         if isinstance(data, np.ndarray):
 *             index = []             # <<<<<<<<<<<<<<
 *             if len(data.shape) == 1:
 *                 columns = [("value", data.tolist())]
*/
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_index = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "amplpy/dataframe.pxi":583
 *         if isinstance(data, np.ndarray):
 *             index = []
 *             if len(data.shape) == 1:             # <<<<<<<<<<<<<<
 *                 columns = [("value", data.tolist())]
 *             elif len(data.shape) == 2:
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 583, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = (__pyx_t_4 == 1);
    if (__pyx_t_2) {

      /* "amplpy/dataframe.pxi":584
 *             index = []
 *             if len(data.shape) == 1:
 *                 columns = [("value", data.tolist())]             # <<<<<<<<<<<<<<
 *             elif len(data.shape) == 2:
 *                 columns = [(f"c{i}", col) for i, col in enumerate(zip(*data.tolist()))]
*/
      __pyx_t_1 = __pyx_v_data;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_value);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_value);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_value) != (0)) __PYX_ERR(1, 584, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 584, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 584, __pyx_L1_error);
      __pyx_t_1 = 0;
      __pyx_v_columns = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "amplpy/dataframe.pxi":583
 *         if isinstance(data, np.ndarray):
 *             index = []
 *             if len(data.shape) == 1:             # <<<<<<<<<<<<<<
 *                 columns = [("value", data.tolist())]
 *             elif len(data.shape) == 2:
*/
      goto __pyx_L4;
    }

    /* "amplpy/dataframe.pxi":585
 *             if len(data.shape) == 1:
 *                 columns = [("value", data.tolist())]
 *             elif len(data.shape) == 2:             # <<<<<<<<<<<<<<
 *                 columns = [(f"c{i}", col) for i, col in enumerate(zip(*data.tolist()))]
 *             else:
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 585, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = (__pyx_t_4 == 2);
    if (likely(__pyx_t_2)) {

      /* "amplpy/dataframe.pxi":586
 *                 columns = [("value", data.tolist())]
 *             elif len(data.shape) == 2:
 *                 columns = [(f"c{i}", col) for i, col in enumerate(zip(*data.tolist()))]             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError
*/
      { /* enter inner scope */
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 586, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
        __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
        __pyx_t_7 = __pyx_v_data;
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 586, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 586, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 586, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
          __pyx_t_7 = __pyx_t_6; __Pyx_INCREF(__pyx_t_7);
          __pyx_t_4 = 0;
          __pyx_t_8 = NULL;
        } else {
          __pyx_t_4 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 586, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 586, __pyx_L7_error)
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        for (;;) {
          if (likely(!__pyx_t_8)) {
            if (likely(PyList_CheckExact(__pyx_t_7))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 586, __pyx_L7_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_7, __pyx_t_4);
              ++__pyx_t_4;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 586, __pyx_L7_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_4));
              #else
              __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_4);
              #endif
              ++__pyx_t_4;
            }
            if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 586, __pyx_L7_error)
          } else {
            __pyx_t_6 = __pyx_t_8(__pyx_t_7);
            if (unlikely(!__pyx_t_6)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 586, __pyx_L7_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_XDECREF_SET(__pyx_9genexpr24__pyx_v_col, __pyx_t_6);
          __pyx_t_6 = 0;
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_XDECREF_SET(__pyx_9genexpr24__pyx_v_i, __pyx_t_1);
          __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 586, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1);
          __pyx_t_1 = __pyx_t_6;
          __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_9genexpr24__pyx_v_i, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 586, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_n_u_c, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 586, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 586, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_9);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9) != (0)) __PYX_ERR(1, 586, __pyx_L7_error);
          __Pyx_INCREF(__pyx_9genexpr24__pyx_v_col);
          __Pyx_GIVEREF(__pyx_9genexpr24__pyx_v_col);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_9genexpr24__pyx_v_col) != (0)) __PYX_ERR(1, 586, __pyx_L7_error);
          __pyx_t_9 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 586, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_col); __pyx_9genexpr24__pyx_v_col = 0;
        __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_i); __pyx_9genexpr24__pyx_v_i = 0;
        goto __pyx_L11_exit_scope;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_col); __pyx_9genexpr24__pyx_v_col = 0;
        __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_i); __pyx_9genexpr24__pyx_v_i = 0;
        goto __pyx_L1_error;
        __pyx_L11_exit_scope:;
      } /* exit inner scope */
      __pyx_v_columns = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "amplpy/dataframe.pxi":585
 *             if len(data.shape) == 1:
 *                 columns = [("value", data.tolist())]
 *             elif len(data.shape) == 2:             # <<<<<<<<<<<<<<
 *                 columns = [(f"c{i}", col) for i, col in enumerate(zip(*data.tolist()))]
 *             else:
*/
      goto __pyx_L4;
    }

    /* "amplpy/dataframe.pxi":588
 *                 columns = [(f"c{i}", col) for i, col in enumerate(zip(*data.tolist()))]
 *             else:
 *                 raise TypeError             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError
*/
    /*else*/ {
      __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
      __PYX_ERR(1, 588, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "amplpy/dataframe.pxi":581
 *         """
 *         assert np is not None
 *         if isinstance(data, np.ndarray):             # <<<<<<<<<<<<<<
 *             index = []
 *             if len(data.shape) == 1:
*/
    goto __pyx_L3;
  }

  /* "amplpy/dataframe.pxi":590
 *                 raise TypeError
 *         else:
 *             raise TypeError             # <<<<<<<<<<<<<<
 *         return cls(index=index, columns=columns)
 * 
*/
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    __PYX_ERR(1, 590, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "amplpy/dataframe.pxi":591
 *         else:
 *             raise TypeError
 *         return cls(index=index, columns=columns)             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_cls);
  __pyx_t_7 = ((PyObject *)__pyx_v_cls); 
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, NULL};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_index, __pyx_t_6, __pyx_callargs+1, 0) < 0) __PYX_ERR(1, 591, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_columns, __pyx_v_columns, __pyx_t_6, __pyx_callargs+1, 1) < 0) __PYX_ERR(1, 591, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_7, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":575
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_numpy(cls, data):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.from_numpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_columns);
  __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr24__pyx_v_col);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe.pxi":593
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def _from_data_frame_ref(cls, df_ref):
 *         return cls(None, None, _impl=df_ref)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_45_from_data_frame_ref(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_44_from_data_frame_ref, "DataFrame._from_data_frame_ref(cls, df_ref)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_45_from_data_frame_ref = {"_from_data_frame_ref", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_45_from_data_frame_ref, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_44_from_data_frame_ref};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_45_from_data_frame_ref(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_df_ref = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_from_data_frame_ref (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_df_ref,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 593, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 593, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_from_data_frame_ref", 0) < 0) __PYX_ERR(1, 593, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_from_data_frame_ref", 1, 1, 1, i); __PYX_ERR(1, 593, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 593, __pyx_L3_error)
    }
    __pyx_v_df_ref = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_from_data_frame_ref", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 593, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._from_data_frame_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_44_from_data_frame_ref(((PyTypeObject*)__pyx_v_cls), __pyx_v_df_ref);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_44_from_data_frame_ref(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df_ref) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_from_data_frame_ref", 0);

  /* "amplpy/dataframe.pxi":595
 *     @classmethod
 *     def _from_data_frame_ref(cls, df_ref):
 *         return cls(None, None, _impl=df_ref)             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_impl, __pyx_v_df_ref) < 0) __PYX_ERR(1, 595, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_mstate_global->__pyx_tuple[0], __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/dataframe.pxi":593
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def _from_data_frame_ref(cls, df_ref):
 *         return cls(None, None, _impl=df_ref)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.DataFrame._from_data_frame_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_47__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_46__reduce_cython__, "DataFrame.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_47__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_47__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_46__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_47__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_46__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_46__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_49__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9DataFrame_48__setstate_cython__, "DataFrame.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9DataFrame_49__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_49__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_48__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9DataFrame_49__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9DataFrame_48__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9DataFrame_48__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrame.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe_arrow.pxi":37
 *     cdef object _capsule_array
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_df = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_14DataFrameArrow_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6amplpy_4ampl_14DataFrameArrow_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_14DataFrameArrow___cinit__(((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_14DataFrameArrow___cinit__(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self) {
  int __pyx_r;

  /* "amplpy/dataframe_arrow.pxi":38
 * 
 *     def __cinit__(self):
 *         self._c_df = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_v_self->_c_df = NULL;

  /* "amplpy/dataframe_arrow.pxi":37
 *     cdef object _capsule_array
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._c_df = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "amplpy/dataframe_arrow.pxi":40
 *         self._c_df = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_df != NULL:
 *             # Uncomment when Free is implemented
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_14DataFrameArrow_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_14DataFrameArrow_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_14DataFrameArrow_2__dealloc__(((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_14DataFrameArrow_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self) {
  int __pyx_t_1;

  /* "amplpy/dataframe_arrow.pxi":41
 * 
 *     def __dealloc__(self):
 *         if self._c_df != NULL:             # <<<<<<<<<<<<<<
 *             # Uncomment when Free is implemented
 *             # campl.AMPL_DataFrameArrowFree(&self._c_df)
*/
  __pyx_t_1 = (__pyx_v_self->_c_df != NULL);
  if (__pyx_t_1) {

    /* "amplpy/dataframe_arrow.pxi":44
 *             # Uncomment when Free is implemented
 *             # campl.AMPL_DataFrameArrowFree(&self._c_df)
 *             self._c_df = NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_self->_c_df = NULL;

    /* "amplpy/dataframe_arrow.pxi":41
 * 
 *     def __dealloc__(self):
 *         if self._c_df != NULL:             # <<<<<<<<<<<<<<
 *             # Uncomment when Free is implemented
 *             # campl.AMPL_DataFrameArrowFree(&self._c_df)
*/
  }

  /* "amplpy/dataframe_arrow.pxi":40
 *         self._c_df = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._c_df != NULL:
 *             # Uncomment when Free is implemented
*/

  /* function exit code */
}

/* "amplpy/dataframe_arrow.pxi":47
 * 
 * 
 *     cdef void init_from_arrow(self,             # <<<<<<<<<<<<<<
 *                               campl.ArrowSchema* schema_ptr,
 *                               campl.ArrowArray* array_ptr,
*/

static void __pyx_f_6amplpy_4ampl_14DataFrameArrow_init_from_arrow(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self, struct ArrowSchema *__pyx_v_schema_ptr, struct ArrowArray *__pyx_v_array_ptr, int64_t __pyx_v_nindices) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "amplpy/dataframe_arrow.pxi":54
 *         #    raise ValueError("ArrowArray has been released  invalid memory.")
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         errorinfo = campl.AMPL_DataFrameArrowCreate(&self._c_df,             # <<<<<<<<<<<<<<
 *                                                     schema_ptr,
 *                                                     array_ptr,
*/
  __pyx_v_errorinfo = AMPL_DataFrameArrowCreate((&__pyx_v_self->_c_df), __pyx_v_schema_ptr, __pyx_v_array_ptr, __pyx_v_nindices);

  /* "amplpy/dataframe_arrow.pxi":58
 *                                                     array_ptr,
 *                                                     nindices)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/dataframe_arrow.pxi":59
 *                                                     nindices)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *     cdef campl.AMPL_DATAFRAMEARROW* get_ptr(self):
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 59, __pyx_L1_error)

    /* "amplpy/dataframe_arrow.pxi":58
 *                                                     array_ptr,
 *                                                     nindices)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  }

  /* "amplpy/dataframe_arrow.pxi":47
 * 
 * 
 *     cdef void init_from_arrow(self,             # <<<<<<<<<<<<<<
 *                               campl.ArrowSchema* schema_ptr,
 *                               campl.ArrowArray* array_ptr,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.init_from_arrow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "amplpy/dataframe_arrow.pxi":61
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     cdef campl.AMPL_DATAFRAMEARROW* get_ptr(self):             # <<<<<<<<<<<<<<
 *         return self._c_df
 * 
*/

static struct AMPL_DATAFRAMEARROW *__pyx_f_6amplpy_4ampl_14DataFrameArrow_get_ptr(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self) {
  struct AMPL_DATAFRAMEARROW *__pyx_r;

  /* "amplpy/dataframe_arrow.pxi":62
 * 
 *     cdef campl.AMPL_DATAFRAMEARROW* get_ptr(self):
 *         return self._c_df             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
  __pyx_r = __pyx_v_self->_c_df;
  goto __pyx_L0;

  /* "amplpy/dataframe_arrow.pxi":61
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     cdef campl.AMPL_DATAFRAMEARROW* get_ptr(self):             # <<<<<<<<<<<<<<
 *         return self._c_df
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "amplpy/dataframe_arrow.pxi":64
 *         return self._c_df
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_polars(cls, df):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_5from_polars(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_14DataFrameArrow_4from_polars, "DataFrameArrow.from_polars(cls, df)\nCreate a :class:`~amplpy.DataFrameArrow` from a Polars DataFrame.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_14DataFrameArrow_5from_polars = {"from_polars", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_5from_polars, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_4from_polars};
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_5from_polars(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_df = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_polars (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_df,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 64, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 64, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_polars", 0) < 0) __PYX_ERR(9, 64, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_polars", 1, 1, 1, i); __PYX_ERR(9, 64, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 64, __pyx_L3_error)
    }
    __pyx_v_df = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_polars", 1, 1, 1, __pyx_nargs); __PYX_ERR(9, 64, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.from_polars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_14DataFrameArrow_4from_polars(((PyTypeObject*)__pyx_v_cls), __pyx_v_df);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_4from_polars(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df) {
  PyObject *__pyx_v_stream = NULL;
  PyObject *__pyx_v_c_schema_capsule = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_v_c_array_capsule = NULL;
  struct ArrowSchema const *__pyx_v_schema_ptr;
  struct ArrowArray const *__pyx_v_array_ptr;
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_obj = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  void *__pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_polars", 0);

  /* "amplpy/dataframe_arrow.pxi":69
 *         Create a :class:`~amplpy.DataFrameArrow` from a Polars DataFrame.
 *         """
 *         assert pl is not None and isinstance(df, pl.DataFrame)             # <<<<<<<<<<<<<<
 *         stream = na.c_array_stream(df.to_arrow())
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pl); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 69, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = (__pyx_t_2 != Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pl); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 69, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 69, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_df, __pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(9, 69, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(9, 69, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(9, 69, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe_arrow.pxi":70
 *         """
 *         assert pl is not None and isinstance(df, pl.DataFrame)
 *         stream = na.c_array_stream(df.to_arrow())             # <<<<<<<<<<<<<<
 * 
 *         c_schema_capsule = stream.get_schema().__arrow_c_schema__()
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_na); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_c_array_stream); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __pyx_v_df;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_arrow, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 70, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 70, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_v_stream = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "amplpy/dataframe_arrow.pxi":72
 *         stream = na.c_array_stream(df.to_arrow())
 * 
 *         c_schema_capsule = stream.get_schema().__arrow_c_schema__()             # <<<<<<<<<<<<<<
 *         _, c_array_capsule = stream.get_next().__arrow_c_array__()
 * 
*/
  __pyx_t_2 = __pyx_v_stream;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_schema, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_6 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_arrow_c_schema, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_v_c_schema_capsule = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "amplpy/dataframe_arrow.pxi":73
 * 
 *         c_schema_capsule = stream.get_schema().__arrow_c_schema__()
 *         _, c_array_capsule = stream.get_next().__arrow_c_array__()             # <<<<<<<<<<<<<<
 * 
 *         cdef const campl.ArrowSchema* schema_ptr = <const campl.ArrowSchema*>PyCapsule_GetPointer(c_schema_capsule, "arrow_schema")
*/
  __pyx_t_2 = __pyx_v_stream;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_next, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 73, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_5 = __pyx_t_6;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_arrow_c_array, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 73, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(9, 73, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_5);
    } else {
      __pyx_t_6 = __Pyx_PyList_GetItemRef(sequence, 0);
      if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 73, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyList_GetItemRef(sequence, 1);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 73, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_5);
    }
    #else
    __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 73, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 73, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 73, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
    index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_5 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < 0) __PYX_ERR(9, 73, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(9, 73, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v__ = __pyx_t_6;
  __pyx_t_6 = 0;
  __pyx_v_c_array_capsule = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "amplpy/dataframe_arrow.pxi":75
 *         _, c_array_capsule = stream.get_next().__arrow_c_array__()
 * 
 *         cdef const campl.ArrowSchema* schema_ptr = <const campl.ArrowSchema*>PyCapsule_GetPointer(c_schema_capsule, "arrow_schema")             # <<<<<<<<<<<<<<
 *         cdef const campl.ArrowArray* array_ptr = <const campl.ArrowArray*>PyCapsule_GetPointer(c_array_capsule, "arrow_array")
 * 
*/
  __pyx_t_10 = PyCapsule_GetPointer(__pyx_v_c_schema_capsule, ((char const *)"arrow_schema")); if (unlikely(__pyx_t_10 == ((void *)0) && PyErr_Occurred())) __PYX_ERR(9, 75, __pyx_L1_error)
  __pyx_v_schema_ptr = ((struct ArrowSchema const *)__pyx_t_10);

  /* "amplpy/dataframe_arrow.pxi":76
 * 
 *         cdef const campl.ArrowSchema* schema_ptr = <const campl.ArrowSchema*>PyCapsule_GetPointer(c_schema_capsule, "arrow_schema")
 *         cdef const campl.ArrowArray* array_ptr = <const campl.ArrowArray*>PyCapsule_GetPointer(c_array_capsule, "arrow_array")             # <<<<<<<<<<<<<<
 * 
 *         cdef DataFrameArrow obj = DataFrameArrow()
*/
  __pyx_t_10 = PyCapsule_GetPointer(__pyx_v_c_array_capsule, ((char const *)"arrow_array")); if (unlikely(__pyx_t_10 == ((void *)0) && PyErr_Occurred())) __PYX_ERR(9, 76, __pyx_L1_error)
  __pyx_v_array_ptr = ((struct ArrowArray const *)__pyx_t_10);

  /* "amplpy/dataframe_arrow.pxi":78
 *         cdef const campl.ArrowArray* array_ptr = <const campl.ArrowArray*>PyCapsule_GetPointer(c_array_capsule, "arrow_array")
 * 
 *         cdef DataFrameArrow obj = DataFrameArrow()             # <<<<<<<<<<<<<<
 * 
 *         obj.init_from_arrow(schema_ptr, array_ptr, 0)
*/
  __pyx_t_5 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow);
  __pyx_t_6 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow); 
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 78, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __pyx_v_obj = ((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "amplpy/dataframe_arrow.pxi":80
 *         cdef DataFrameArrow obj = DataFrameArrow()
 * 
 *         obj.init_from_arrow(schema_ptr, array_ptr, 0)             # <<<<<<<<<<<<<<
 *         return obj
 * 
*/
  ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow *)__pyx_v_obj->__pyx_vtab)->init_from_arrow(__pyx_v_obj, __pyx_v_schema_ptr, __pyx_v_array_ptr, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 80, __pyx_L1_error)

  /* "amplpy/dataframe_arrow.pxi":81
 * 
 *         obj.init_from_arrow(schema_ptr, array_ptr, 0)
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_obj);
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  /* "amplpy/dataframe_arrow.pxi":64
 *         return self._c_df
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_polars(cls, df):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.from_polars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_stream);
  __Pyx_XDECREF(__pyx_v_c_schema_capsule);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_c_array_capsule);
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/dataframe_arrow.pxi":83
 *         return obj
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_7from_pandas(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_14DataFrameArrow_6from_pandas, "DataFrameArrow.from_pandas(cls, df, index_names=None, indexarity=None)\nCreate a :class:`~amplpy.DataFrameArrow` from a pandas DataFrame.\n\nArgs:\n    df: Pandas DataFrame or Series to load.\n    index_names: Optional list of index column names.\n    indexarity: Optional number of index columns.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_14DataFrameArrow_7from_pandas = {"from_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_7from_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_6from_pandas};
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_7from_pandas(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_df = 0;
  PyObject *__pyx_v_index_names = 0;
  PyObject *__pyx_v_indexarity = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_pandas (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_df,&__pyx_mstate_global->__pyx_n_u_index_names,&__pyx_mstate_global->__pyx_n_u_indexarity,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(9, 83, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(9, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(9, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_pandas", 0) < 0) __PYX_ERR(9, 83, __pyx_L3_error)

      /* "amplpy/dataframe_arrow.pxi":84
 * 
 *     @classmethod
 *     def from_pandas(cls, df, index_names=None, indexarity=None):             # <<<<<<<<<<<<<<
 *         """
 *         Create a :class:`~amplpy.DataFrameArrow` from a pandas DataFrame.
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_pandas", 0, 1, 3, i); __PYX_ERR(9, 83, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(9, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(9, 83, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(9, 83, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_df = values[0];
    __pyx_v_index_names = values[1];
    __pyx_v_indexarity = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_pandas", 0, 1, 3, __pyx_nargs); __PYX_ERR(9, 83, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.from_pandas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_14DataFrameArrow_6from_pandas(((PyTypeObject*)__pyx_v_cls), __pyx_v_df, __pyx_v_index_names, __pyx_v_indexarity);

  /* "amplpy/dataframe_arrow.pxi":83
 *         return obj
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_6from_pandas(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_df, PyObject *__pyx_v_index_names, PyObject *__pyx_v_indexarity) {
  PyObject *__pyx_v_df_reset = NULL;
  PyObject *__pyx_v_pa_df = NULL;
  PyObject *__pyx_v_array_stream = NULL;
  PyObject *__pyx_v_c_schema_capsule = NULL;
  PyObject *__pyx_v_c_array_capsule = NULL;
  struct ArrowSchema *__pyx_v_arrow_schema_ptr;
  struct ArrowArray *__pyx_v_arrow_array_ptr;
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_obj = 0;
  int64_t __pyx_v_nindices;
  PyObject *__pyx_9genexpr25__pyx_v_idx = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *(*__pyx_t_13)(PyObject *);
  void *__pyx_t_14;
  int64_t __pyx_t_15;
  int64_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_pandas", 0);
  __Pyx_INCREF(__pyx_v_df);

  /* "amplpy/dataframe_arrow.pxi":93
 *             indexarity: Optional number of index columns.
 *         """
 *         assert None not in (pd, pa, na) and isinstance(df, (pd.DataFrame, pd.Series))             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(df, pd.Series):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L5_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pa); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L5_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_na); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __pyx_t_6;
    __pyx_L5_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __pyx_t_3;
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L3_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 93, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_df, __pyx_t_5); 
    if (!__pyx_t_3) {
    } else {
      __pyx_t_6 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_df, __pyx_t_4); 
    __pyx_t_6 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __pyx_t_6;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(9, 93, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(9, 93, __pyx_L1_error)
  #endif

  /* "amplpy/dataframe_arrow.pxi":95
 *         assert None not in (pd, pa, na) and isinstance(df, (pd.DataFrame, pd.Series))
 * 
 *         if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *             df = pd.DataFrame(df)
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_df, __pyx_t_4); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "amplpy/dataframe_arrow.pxi":96
 * 
 *         if isinstance(df, pd.Series):
 *             df = pd.DataFrame(df)             # <<<<<<<<<<<<<<
 * 
 *         if len(df) == 0:
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_df};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF_SET(__pyx_v_df, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "amplpy/dataframe_arrow.pxi":95
 *         assert None not in (pd, pa, na) and isinstance(df, (pd.DataFrame, pd.Series))
 * 
 *         if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *             df = pd.DataFrame(df)
 * 
*/
  }

  /* "amplpy/dataframe_arrow.pxi":98
 *             df = pd.DataFrame(df)
 * 
 *         if len(df) == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create DataFrameArrow from empty DataFrame")
 * 
*/
  __pyx_t_9 = PyObject_Length(__pyx_v_df); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(9, 98, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_9 == 0);
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/dataframe_arrow.pxi":99
 * 
 *         if len(df) == 0:
 *             raise ValueError("Cannot create DataFrameArrow from empty DataFrame")             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(df.index[0], tuple):
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Cannot_create_DataFrameArrow_fro};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 99, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(9, 99, __pyx_L1_error)

    /* "amplpy/dataframe_arrow.pxi":98
 *             df = pd.DataFrame(df)
 * 
 *         if len(df) == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create DataFrameArrow from empty DataFrame")
 * 
*/
  }

  /* "amplpy/dataframe_arrow.pxi":101
 *             raise ValueError("Cannot create DataFrameArrow from empty DataFrame")
 * 
 *         if isinstance(df.index[0], tuple):             # <<<<<<<<<<<<<<
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         elif df.index.nlevels == 1 and not isinstance(df.index, pd.MultiIndex):
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = PyTuple_Check(__pyx_t_5); 
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "amplpy/dataframe_arrow.pxi":102
 * 
 *         if isinstance(df.index[0], tuple):
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())             # <<<<<<<<<<<<<<
 *         elif df.index.nlevels == 1 and not isinstance(df.index, pd.MultiIndex):
 *             df.index = pd.MultiIndex.from_tuples([(idx,) for idx in df.index])
*/
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_MultiIndex); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_11)) __PYX_ERR(9, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = __pyx_t_11;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
      __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_from_tuples, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_5) < 0) __PYX_ERR(9, 102, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "amplpy/dataframe_arrow.pxi":101
 *             raise ValueError("Cannot create DataFrameArrow from empty DataFrame")
 * 
 *         if isinstance(df.index[0], tuple):             # <<<<<<<<<<<<<<
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         elif df.index.nlevels == 1 and not isinstance(df.index, pd.MultiIndex):
*/
    goto __pyx_L12;
  }

  /* "amplpy/dataframe_arrow.pxi":103
 *         if isinstance(df.index[0], tuple):
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         elif df.index.nlevels == 1 and not isinstance(df.index, pd.MultiIndex):             # <<<<<<<<<<<<<<
 *             df.index = pd.MultiIndex.from_tuples([(idx,) for idx in df.index])
 * 
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_nlevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(9, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_MultiIndex); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = PyObject_IsInstance(__pyx_t_2, __pyx_t_7); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(9, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = (!__pyx_t_6);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_1) {

    /* "amplpy/dataframe_arrow.pxi":104
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         elif df.index.nlevels == 1 and not isinstance(df.index, pd.MultiIndex):
 *             df.index = pd.MultiIndex.from_tuples([(idx,) for idx in df.index])             # <<<<<<<<<<<<<<
 * 
 *         if indexarity is not None and indexarity == df.index.nlevels + 1:
*/
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_MultiIndex); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_2);
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 104, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_11)) __PYX_ERR(9, 104, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) {
        __pyx_t_10 = __pyx_t_11; __Pyx_INCREF(__pyx_t_10);
        __pyx_t_9 = 0;
        __pyx_t_12 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(9, 104, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(9, 104, __pyx_L17_error)
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      for (;;) {
        if (likely(!__pyx_t_12)) {
          if (likely(PyList_CheckExact(__pyx_t_10))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 104, __pyx_L17_error)
              #endif
              if (__pyx_t_9 >= __pyx_temp) break;
            }
            __pyx_t_11 = __Pyx_PyList_GetItemRef(__pyx_t_10, __pyx_t_9);
            ++__pyx_t_9;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(9, 104, __pyx_L17_error)
              #endif
              if (__pyx_t_9 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_11 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_9));
            #else
            __pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_9);
            #endif
            ++__pyx_t_9;
          }
          if (unlikely(!__pyx_t_11)) __PYX_ERR(9, 104, __pyx_L17_error)
        } else {
          __pyx_t_11 = __pyx_t_12(__pyx_t_10);
          if (unlikely(!__pyx_t_11)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(9, 104, __pyx_L17_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_XDECREF_SET(__pyx_9genexpr25__pyx_v_idx, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(9, 104, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_9genexpr25__pyx_v_idx);
        __Pyx_GIVEREF(__pyx_9genexpr25__pyx_v_idx);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_9genexpr25__pyx_v_idx) != (0)) __PYX_ERR(9, 104, __pyx_L17_error);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_11))) __PYX_ERR(9, 104, __pyx_L17_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_idx); __pyx_9genexpr25__pyx_v_idx = 0;
      goto __pyx_L21_exit_scope;
      __pyx_L17_error:;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_idx); __pyx_9genexpr25__pyx_v_idx = 0;
      goto __pyx_L1_error;
      __pyx_L21_exit_scope:;
    } /* exit inner scope */
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_from_tuples, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_7) < 0) __PYX_ERR(9, 104, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/dataframe_arrow.pxi":103
 *         if isinstance(df.index[0], tuple):
 *             df.index = pd.MultiIndex.from_tuples(df.index.tolist())
 *         elif df.index.nlevels == 1 and not isinstance(df.index, pd.MultiIndex):             # <<<<<<<<<<<<<<
 *             df.index = pd.MultiIndex.from_tuples([(idx,) for idx in df.index])
 * 
*/
  }
  __pyx_L12:;

  /* "amplpy/dataframe_arrow.pxi":106
 *             df.index = pd.MultiIndex.from_tuples([(idx,) for idx in df.index])
 * 
 *         if indexarity is not None and indexarity == df.index.nlevels + 1:             # <<<<<<<<<<<<<<
 *             df = df.stack()
 *             if isinstance(df, pd.Series):
*/
  __pyx_t_3 = (__pyx_v_indexarity != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_nlevels); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_indexarity, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(9, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L23_bool_binop_done:;
  if (__pyx_t_1) {

    /* "amplpy/dataframe_arrow.pxi":107
 * 
 *         if indexarity is not None and indexarity == df.index.nlevels + 1:
 *             df = df.stack()             # <<<<<<<<<<<<<<
 *             if isinstance(df, pd.Series):
 *                 df = pd.DataFrame(df)
*/
    __pyx_t_7 = __pyx_v_df;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_stack, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF_SET(__pyx_v_df, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "amplpy/dataframe_arrow.pxi":108
 *         if indexarity is not None and indexarity == df.index.nlevels + 1:
 *             df = df.stack()
 *             if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *                 df = pd.DataFrame(df)
 * 
*/
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = PyObject_IsInstance(__pyx_v_df, __pyx_t_7); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(9, 108, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_1) {

      /* "amplpy/dataframe_arrow.pxi":109
 *             df = df.stack()
 *             if isinstance(df, pd.Series):
 *                 df = pd.DataFrame(df)             # <<<<<<<<<<<<<<
 * 
 *         if index_names is not None:
*/
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_df};
        __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 109, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_DECREF_SET(__pyx_v_df, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "amplpy/dataframe_arrow.pxi":108
 *         if indexarity is not None and indexarity == df.index.nlevels + 1:
 *             df = df.stack()
 *             if isinstance(df, pd.Series):             # <<<<<<<<<<<<<<
 *                 df = pd.DataFrame(df)
 * 
*/
    }

    /* "amplpy/dataframe_arrow.pxi":106
 *             df.index = pd.MultiIndex.from_tuples([(idx,) for idx in df.index])
 * 
 *         if indexarity is not None and indexarity == df.index.nlevels + 1:             # <<<<<<<<<<<<<<
 *             df = df.stack()
 *             if isinstance(df, pd.Series):
*/
  }

  /* "amplpy/dataframe_arrow.pxi":111
 *                 df = pd.DataFrame(df)
 * 
 *         if index_names is not None:             # <<<<<<<<<<<<<<
 *             assert len(index_names) == df.index.nlevels
 *             df.index.names = index_names
*/
  __pyx_t_1 = (__pyx_v_index_names != Py_None);
  if (__pyx_t_1) {

    /* "amplpy/dataframe_arrow.pxi":112
 * 
 *         if index_names is not None:
 *             assert len(index_names) == df.index.nlevels             # <<<<<<<<<<<<<<
 *             df.index.names = index_names
 * 
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_9 = PyObject_Length(__pyx_v_index_names); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(9, 112, __pyx_L1_error)
      __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nlevels); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 112, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(9, 112, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(9, 112, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(9, 112, __pyx_L1_error)
    #endif

    /* "amplpy/dataframe_arrow.pxi":113
 *         if index_names is not None:
 *             assert len(index_names) == df.index.nlevels
 *             df.index.names = index_names             # <<<<<<<<<<<<<<
 * 
 *         df_reset = df.reset_index()
*/
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_names, __pyx_v_index_names) < 0) __PYX_ERR(9, 113, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/dataframe_arrow.pxi":111
 *                 df = pd.DataFrame(df)
 * 
 *         if index_names is not None:             # <<<<<<<<<<<<<<
 *             assert len(index_names) == df.index.nlevels
 *             df.index.names = index_names
*/
  }

  /* "amplpy/dataframe_arrow.pxi":115
 *             df.index.names = index_names
 * 
 *         df_reset = df.reset_index()             # <<<<<<<<<<<<<<
 * 
 *         pa_df = pa.Table.from_pandas(df_reset, preserve_index=False)
*/
  __pyx_t_4 = __pyx_v_df;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_reset_index, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_df_reset = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/dataframe_arrow.pxi":117
 *         df_reset = df.reset_index()
 * 
 *         pa_df = pa.Table.from_pandas(df_reset, preserve_index=False)             # <<<<<<<<<<<<<<
 *         #print(pa_df)
 *         array_stream = na.c_array_stream(pa_df)
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_pa); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Table); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_df_reset};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_preserve_index, Py_False, __pyx_t_7, __pyx_callargs+2, 0) < 0) __PYX_ERR(9, 117, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_pa_df = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/dataframe_arrow.pxi":119
 *         pa_df = pa.Table.from_pandas(df_reset, preserve_index=False)
 *         #print(pa_df)
 *         array_stream = na.c_array_stream(pa_df)             # <<<<<<<<<<<<<<
 *         c_schema_capsule, c_array_capsule = array_stream.get_next().__arrow_c_array__()
 * 
*/
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_na); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_c_array_stream); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_pa_df};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_array_stream = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/dataframe_arrow.pxi":120
 *         #print(pa_df)
 *         array_stream = na.c_array_stream(pa_df)
 *         c_schema_capsule, c_array_capsule = array_stream.get_next().__arrow_c_array__()             # <<<<<<<<<<<<<<
 * 
 *         cdef campl.ArrowSchema* arrow_schema_ptr = <campl.ArrowSchema*>PyCapsule_GetPointer(c_schema_capsule, "arrow_schema")
*/
  __pyx_t_7 = __pyx_v_array_stream;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_next, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_8 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_arrow_c_array, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(9, 120, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_4);
    } else {
      __pyx_t_5 = __Pyx_PyList_GetItemRef(sequence, 0);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 120, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyList_GetItemRef(sequence, 1);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 120, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
    }
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
    index = 0; __pyx_t_5 = __pyx_t_13(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L27_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_4 = __pyx_t_13(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L27_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_7), 2) < 0) __PYX_ERR(9, 120, __pyx_L1_error)
    __pyx_t_13 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L28_unpacking_done;
    __pyx_L27_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_13 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(9, 120, __pyx_L1_error)
    __pyx_L28_unpacking_done:;
  }
  __pyx_v_c_schema_capsule = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_c_array_capsule = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "amplpy/dataframe_arrow.pxi":122
 *         c_schema_capsule, c_array_capsule = array_stream.get_next().__arrow_c_array__()
 * 
 *         cdef campl.ArrowSchema* arrow_schema_ptr = <campl.ArrowSchema*>PyCapsule_GetPointer(c_schema_capsule, "arrow_schema")             # <<<<<<<<<<<<<<
 *         cdef campl.ArrowArray* arrow_array_ptr = <campl.ArrowArray*>PyCapsule_GetPointer(c_array_capsule, "arrow_array")
 * 
*/
  __pyx_t_14 = PyCapsule_GetPointer(__pyx_v_c_schema_capsule, ((char const *)"arrow_schema")); if (unlikely(__pyx_t_14 == ((void *)0) && PyErr_Occurred())) __PYX_ERR(9, 122, __pyx_L1_error)
  __pyx_v_arrow_schema_ptr = ((struct ArrowSchema *)__pyx_t_14);

  /* "amplpy/dataframe_arrow.pxi":123
 * 
 *         cdef campl.ArrowSchema* arrow_schema_ptr = <campl.ArrowSchema*>PyCapsule_GetPointer(c_schema_capsule, "arrow_schema")
 *         cdef campl.ArrowArray* arrow_array_ptr = <campl.ArrowArray*>PyCapsule_GetPointer(c_array_capsule, "arrow_array")             # <<<<<<<<<<<<<<
 * 
 *         # VALIDATE capsule contents
*/
  __pyx_t_14 = PyCapsule_GetPointer(__pyx_v_c_array_capsule, ((char const *)"arrow_array")); if (unlikely(__pyx_t_14 == ((void *)0) && PyErr_Occurred())) __PYX_ERR(9, 123, __pyx_L1_error)
  __pyx_v_arrow_array_ptr = ((struct ArrowArray *)__pyx_t_14);

  /* "amplpy/dataframe_arrow.pxi":131
 *         #    raise RuntimeError("Invalid arrow_array capsule")
 * 
 *         cdef DataFrameArrow obj = DataFrameArrow()             # <<<<<<<<<<<<<<
 *         obj._capsule_schema = c_schema_capsule
 *         obj._capsule_array = c_array_capsule
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow);
  __pyx_t_5 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow); 
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 131, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_obj = ((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/dataframe_arrow.pxi":132
 * 
 *         cdef DataFrameArrow obj = DataFrameArrow()
 *         obj._capsule_schema = c_schema_capsule             # <<<<<<<<<<<<<<
 *         obj._capsule_array = c_array_capsule
 * 
*/
  __Pyx_INCREF(__pyx_v_c_schema_capsule);
  __Pyx_GIVEREF(__pyx_v_c_schema_capsule);
  __Pyx_GOTREF(__pyx_v_obj->_capsule_schema);
  __Pyx_DECREF(__pyx_v_obj->_capsule_schema);
  __pyx_v_obj->_capsule_schema = __pyx_v_c_schema_capsule;

  /* "amplpy/dataframe_arrow.pxi":133
 *         cdef DataFrameArrow obj = DataFrameArrow()
 *         obj._capsule_schema = c_schema_capsule
 *         obj._capsule_array = c_array_capsule             # <<<<<<<<<<<<<<
 * 
 *         cdef int64_t nindices = df.index.nlevels if indexarity is None else indexarity
*/
  __Pyx_INCREF(__pyx_v_c_array_capsule);
  __Pyx_GIVEREF(__pyx_v_c_array_capsule);
  __Pyx_GOTREF(__pyx_v_obj->_capsule_array);
  __Pyx_DECREF(__pyx_v_obj->_capsule_array);
  __pyx_v_obj->_capsule_array = __pyx_v_c_array_capsule;

  /* "amplpy/dataframe_arrow.pxi":135
 *         obj._capsule_array = c_array_capsule
 * 
 *         cdef int64_t nindices = df.index.nlevels if indexarity is None else indexarity             # <<<<<<<<<<<<<<
 *         obj.init_from_arrow(arrow_schema_ptr, arrow_array_ptr, nindices)
 *         return obj
*/
  __pyx_t_1 = (__pyx_v_indexarity == Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nlevels); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_16 = __Pyx_PyLong_As_int64_t(__pyx_t_5); if (unlikely((__pyx_t_16 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 135, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_15 = __pyx_t_16;
  } else {
    __pyx_t_16 = __Pyx_PyLong_As_int64_t(__pyx_v_indexarity); if (unlikely((__pyx_t_16 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(9, 135, __pyx_L1_error)
    __pyx_t_15 = __pyx_t_16;
  }
  __pyx_v_nindices = __pyx_t_15;

  /* "amplpy/dataframe_arrow.pxi":136
 * 
 *         cdef int64_t nindices = df.index.nlevels if indexarity is None else indexarity
 *         obj.init_from_arrow(arrow_schema_ptr, arrow_array_ptr, nindices)             # <<<<<<<<<<<<<<
 *         return obj
*/
  ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow *)__pyx_v_obj->__pyx_vtab)->init_from_arrow(__pyx_v_obj, __pyx_v_arrow_schema_ptr, __pyx_v_arrow_array_ptr, __pyx_v_nindices); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 136, __pyx_L1_error)

  /* "amplpy/dataframe_arrow.pxi":137
 *         cdef int64_t nindices = df.index.nlevels if indexarity is None else indexarity
 *         obj.init_from_arrow(arrow_schema_ptr, arrow_array_ptr, nindices)
 *         return obj             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_obj);
  __pyx_r = ((PyObject *)__pyx_v_obj);
  goto __pyx_L0;

  /* "amplpy/dataframe_arrow.pxi":83
 *         return obj
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.from_pandas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_df_reset);
  __Pyx_XDECREF(__pyx_v_pa_df);
  __Pyx_XDECREF(__pyx_v_array_stream);
  __Pyx_XDECREF(__pyx_v_c_schema_capsule);
  __Pyx_XDECREF(__pyx_v_c_array_capsule);
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_df);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_14DataFrameArrow_8__reduce_cython__, "DataFrameArrow.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_14DataFrameArrow_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_8__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_14DataFrameArrow_8__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_14DataFrameArrow_10__setstate_cython__, "DataFrameArrow.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_14DataFrameArrow_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_10__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_14DataFrameArrow_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_14DataFrameArrow_10__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_14DataFrameArrow_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.DataFrameArrow.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":51
 *     cdef object _entity
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, object parent):
 *         entity = Entity()
*/

static PyObject *__pyx_f_6amplpy_4ampl_6Entity_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_entity = NULL;
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_ENTITYTYPE __pyx_v_entitytype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/entity.pxi":53
 *     @staticmethod
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, object parent):
 *         entity = Entity()             # <<<<<<<<<<<<<<
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 53, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_entity = ((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/entity.pxi":54
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, object parent):
 *         entity = Entity()
 *         entity._ampl = ampl             # <<<<<<<<<<<<<<
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_entity->_ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_entity->_ampl);
  __pyx_v_entity->_ampl = __pyx_v_ampl;

  /* "amplpy/entity.pxi":55
 *         entity = Entity()
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)             # <<<<<<<<<<<<<<
 *         entity._name = name
 *         entity._index = index
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_entity->_ampl);
  __Pyx_INCREF(__pyx_t_1);
  Py_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/entity.pxi":56
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
 *         entity._name = name             # <<<<<<<<<<<<<<
 *         entity._index = index
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/
  __pyx_v_entity->_name = __pyx_v_name;

  /* "amplpy/entity.pxi":57
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
 *         entity._index = index             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
*/
  __pyx_v_entity->_index = __pyx_v_index;

  /* "amplpy/entity.pxi":60
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         errorinfo = campl.AMPL_EntityGetType(entity._ampl._c_ampl, name, &entitytype)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             #free(name)
*/
  __pyx_v_errorinfo = AMPL_EntityGetType(__pyx_v_entity->_ampl->_c_ampl, __pyx_v_name, (&__pyx_v_entitytype));

  /* "amplpy/entity.pxi":61
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         errorinfo = campl.AMPL_EntityGetType(entity._ampl._c_ampl, name, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             #free(name)
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/entity.pxi":63
 *         if errorinfo:
 *             #free(name)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         entity.wrap_function = entitytype
 *         entity._entity = parent
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 63, __pyx_L1_error)

    /* "amplpy/entity.pxi":61
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         errorinfo = campl.AMPL_EntityGetType(entity._ampl._c_ampl, name, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             #free(name)
 *             PY_AMPL_CALL(errorinfo)
*/
  }

  /* "amplpy/entity.pxi":64
 *             #free(name)
 *             PY_AMPL_CALL(errorinfo)
 *         entity.wrap_function = entitytype             # <<<<<<<<<<<<<<
 *         entity._entity = parent
 *         if entity._entity is not None:
*/
  __pyx_v_entity->wrap_function = __pyx_v_entitytype;

  /* "amplpy/entity.pxi":65
 *             PY_AMPL_CALL(errorinfo)
 *         entity.wrap_function = entitytype
 *         entity._entity = parent             # <<<<<<<<<<<<<<
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_entity->_entity);
  __Pyx_DECREF(__pyx_v_entity->_entity);
  __pyx_v_entity->_entity = __pyx_v_parent;

  /* "amplpy/entity.pxi":66
 *         entity.wrap_function = entitytype
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  __pyx_t_5 = (__pyx_v_entity->_entity != Py_None);
  if (__pyx_t_5) {

    /* "amplpy/entity.pxi":67
 *         entity._entity = parent
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)             # <<<<<<<<<<<<<<
 *         return entity
 * 
*/
    __pyx_t_1 = __pyx_v_entity->_entity;
    __Pyx_INCREF(__pyx_t_1);
    Py_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/entity.pxi":66
 *         entity.wrap_function = entitytype
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  }

  /* "amplpy/entity.pxi":68
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_entity);
  __pyx_r = ((PyObject *)__pyx_v_entity);
  goto __pyx_L0;

  /* "amplpy/entity.pxi":51
 *     cdef object _entity
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, object parent):
 *         entity = Entity()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Entity.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entity);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":70
 *         return entity
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_6Entity_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_6Entity_1__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_6Entity___dealloc__(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_6Entity___dealloc__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "amplpy/entity.pxi":71
 * 
 *     def __dealloc__(self):
 *         if self._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_DECREF(self._entity)
 *         if self._index is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->_entity != Py_None);
  if (__pyx_t_1) {

    /* "amplpy/entity.pxi":72
 *     def __dealloc__(self):
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)             # <<<<<<<<<<<<<<
 *         if self._index is not NULL:
 *             campl.AMPL_TupleFree(&self._index)
*/
    __pyx_t_2 = __pyx_v_self->_entity;
    __Pyx_INCREF(__pyx_t_2);
    Py_DECREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/entity.pxi":71
 * 
 *     def __dealloc__(self):
 *         if self._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_DECREF(self._entity)
 *         if self._index is not NULL:
*/
  }

  /* "amplpy/entity.pxi":73
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)
 *         if self._index is not NULL:             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleFree(&self._index)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->_index != NULL);
  if (__pyx_t_1) {

    /* "amplpy/entity.pxi":74
 *             Py_DECREF(self._entity)
 *         if self._index is not NULL:
 *             campl.AMPL_TupleFree(&self._index)             # <<<<<<<<<<<<<<
 *         else:
 *             campl.AMPL_StringFree(&self._name)
*/
    (void)(AMPL_TupleFree((&__pyx_v_self->_index)));

    /* "amplpy/entity.pxi":73
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)
 *         if self._index is not NULL:             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleFree(&self._index)
 *         else:
*/
    goto __pyx_L4;
  }

  /* "amplpy/entity.pxi":76
 *             campl.AMPL_TupleFree(&self._index)
 *         else:
 *             campl.AMPL_StringFree(&self._name)             # <<<<<<<<<<<<<<
 *         Py_DECREF(self._ampl)
 * 
*/
  /*else*/ {
    (void)(AMPL_StringFree((&__pyx_v_self->_name)));
  }
  __pyx_L4:;

  /* "amplpy/entity.pxi":77
 *         else:
 *             campl.AMPL_StringFree(&self._name)
 *         Py_DECREF(self._ampl)             # <<<<<<<<<<<<<<
 * 
 *     def to_string(self):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_ampl);
  __Pyx_INCREF(__pyx_t_2);
  Py_DECREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/entity.pxi":70
 *         return entity
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)
*/

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "amplpy/entity.pxi":79
 *         Py_DECREF(self._ampl)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_3to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_2to_string, "Entity.to_string(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_3to_string = {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_3to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_2to_string};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_3to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_string", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_string", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_2to_string(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_2to_string(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_output_c;
  PyObject *__pyx_v_output = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_string", 0);

  /* "amplpy/entity.pxi":82
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_EntityGetDeclaration(self._ampl._c_ampl, self._name, &output_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_EntityGetDeclaration(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, (&__pyx_v_output_c));

  /* "amplpy/entity.pxi":83
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_EntityGetDeclaration(self._ampl._c_ampl, self._name, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/entity.pxi":84
 *         errorinfo = campl.AMPL_EntityGetDeclaration(self._ampl._c_ampl, self._name, &output_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 84, __pyx_L1_error)

    /* "amplpy/entity.pxi":83
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_EntityGetDeclaration(self._ampl._c_ampl, self._name, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  }

  /* "amplpy/entity.pxi":85
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&output_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_output_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(10, 85, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_output_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_output = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":86
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)             # <<<<<<<<<<<<<<
 * 
 *         return output
*/
  (void)(AMPL_StringFree((&__pyx_v_output_c)));

  /* "amplpy/entity.pxi":88
 *         campl.AMPL_StringFree(&output_c)
 * 
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":79
 *         Py_DECREF(self._ampl)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Entity.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":90
 *         return output
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_5__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_5__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_4__str__(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_4__str__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "amplpy/entity.pxi":91
 * 
 *     def __str__(self):
 *         return self.to_string()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_string, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":90
 *         return output
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Entity.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":93
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         assert self.wrap_function is not None
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_7__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_6__iter__(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_6__iter__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/entity.pxi":94
 * 
 *     def __iter__(self):
 *         assert self.wrap_function is not None             # <<<<<<<<<<<<<<
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __Pyx_PyLong_From_AMPL_ENTITYTYPE(__pyx_v_self->wrap_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (__pyx_t_1 != Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 94, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 94, __pyx_L1_error)
  #endif

  /* "amplpy/entity.pxi":95
 *     def __iter__(self):
 *         assert self.wrap_function is not None
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_ampl);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_6amplpy_4ampl_16InstanceIterator_create(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_1), __pyx_v_self->_name, __pyx_v_self->wrap_function, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":93
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         assert self.wrap_function is not None
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Entity.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":97
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if not isinstance(index, (tuple, list)):
 *             index = [index]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_8__getitem__(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_8__getitem__(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_index) {
  AMPL_TUPLE *__pyx_v_tuple_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  AMPL_TUPLE *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "amplpy/entity.pxi":98
 * 
 *     def __getitem__(self, index):
 *         if not isinstance(index, (tuple, list)):             # <<<<<<<<<<<<<<
 *             index = [index]
 *         cdef campl.AMPL_TUPLE* tuple_c =  to_c_tuple(index)
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_index); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyList_Check(__pyx_v_index); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "amplpy/entity.pxi":99
 *     def __getitem__(self, index):
 *         if not isinstance(index, (tuple, list)):
 *             index = [index]             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_TUPLE* tuple_c =  to_c_tuple(index)
 *         return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
*/
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(10, 99, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "amplpy/entity.pxi":98
 * 
 *     def __getitem__(self, index):
 *         if not isinstance(index, (tuple, list)):             # <<<<<<<<<<<<<<
 *             index = [index]
 *         cdef campl.AMPL_TUPLE* tuple_c =  to_c_tuple(index)
*/
  }

  /* "amplpy/entity.pxi":100
 *         if not isinstance(index, (tuple, list)):
 *             index = [index]
 *         cdef campl.AMPL_TUPLE* tuple_c =  to_c_tuple(index)             # <<<<<<<<<<<<<<
 *         return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
 * 
*/
  __pyx_t_4 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_index); if (unlikely(__pyx_t_4 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(10, 100, __pyx_L1_error)
  __pyx_v_tuple_c = __pyx_t_4;

  /* "amplpy/entity.pxi":101
 *             index = [index]
 *         cdef campl.AMPL_TUPLE* tuple_c =  to_c_tuple(index)
 *         return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, *index):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_self->_ampl);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->wrap_function, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_3), __pyx_v_self->_name, __pyx_v_tuple_c, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":97
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if not isinstance(index, (tuple, list)):
 *             index = [index]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.Entity.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":103
 *         return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
 * 
 *     def get(self, *index):             # <<<<<<<<<<<<<<
 *         """
 *         Get the instance with the specified index.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_11get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_10get, "Entity.get(self, *index)\nGet the instance with the specified index.\n\nReturns:\n    The corresponding instance.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_11get = {"get", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_11get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_10get};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_11get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_index = __pyx_args;
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_10get(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v_index);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_10get(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_index) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_TUPLE *__pyx_v_tuple_c;
  char *__pyx_v_name_c;
  PyObject *__pyx_v_entity = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  AMPL_TUPLE *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "amplpy/entity.pxi":111
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         assert self.wrap_function is not None             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_TUPLE* tuple_c
 *         cdef char* name_c
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __Pyx_PyLong_From_AMPL_ENTITYTYPE(__pyx_v_self->wrap_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (__pyx_t_1 != Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 111, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 111, __pyx_L1_error)
  #endif

  /* "amplpy/entity.pxi":114
 *         cdef campl.AMPL_TUPLE* tuple_c
 *         cdef char* name_c
 *         if len(index) == 1 and isinstance(index[0], (tuple, list)):             # <<<<<<<<<<<<<<
 *             index = index[0]
 *             index = list(index)
*/
  __pyx_t_3 = PyObject_Length(__pyx_v_index); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(10, 114, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 == 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_index, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_Check(__pyx_t_1); 
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = PyList_Check(__pyx_t_1); 
  __pyx_t_4 = __pyx_t_5;
  __pyx_L6_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "amplpy/entity.pxi":115
 *         cdef char* name_c
 *         if len(index) == 1 and isinstance(index[0], (tuple, list)):
 *             index = index[0]             # <<<<<<<<<<<<<<
 *             index = list(index)
 *         if len(index) == 0:
*/
    __pyx_t_1 = __Pyx_PyTuple_GET_ITEM(__pyx_v_index, 0);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/entity.pxi":116
 *         if len(index) == 1 and isinstance(index[0], (tuple, list)):
 *             index = index[0]
 *             index = list(index)             # <<<<<<<<<<<<<<
 *         if len(index) == 0:
 *             return create_entity(self.wrap_function, self._ampl, self._name, NULL, None)
*/
    __pyx_t_1 = PySequence_List(__pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/entity.pxi":114
 *         cdef campl.AMPL_TUPLE* tuple_c
 *         cdef char* name_c
 *         if len(index) == 1 and isinstance(index[0], (tuple, list)):             # <<<<<<<<<<<<<<
 *             index = index[0]
 *             index = list(index)
*/
  }

  /* "amplpy/entity.pxi":117
 *             index = index[0]
 *             index = list(index)
 *         if len(index) == 0:             # <<<<<<<<<<<<<<
 *             return create_entity(self.wrap_function, self._ampl, self._name, NULL, None)
 *         else:
*/
  __pyx_t_3 = PyObject_Length(__pyx_v_index); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(10, 117, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_3 == 0);
  if (__pyx_t_2) {

    /* "amplpy/entity.pxi":118
 *             index = list(index)
 *         if len(index) == 0:
 *             return create_entity(self.wrap_function, self._ampl, self._name, NULL, None)             # <<<<<<<<<<<<<<
 *         else:
 *             tuple_c =  to_c_tuple(index)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_v_self->_ampl);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->wrap_function, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_1), __pyx_v_self->_name, NULL, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "amplpy/entity.pxi":117
 *             index = index[0]
 *             index = list(index)
 *         if len(index) == 0:             # <<<<<<<<<<<<<<
 *             return create_entity(self.wrap_function, self._ampl, self._name, NULL, None)
 *         else:
*/
  }

  /* "amplpy/entity.pxi":120
 *             return create_entity(self.wrap_function, self._ampl, self._name, NULL, None)
 *         else:
 *             tuple_c =  to_c_tuple(index)             # <<<<<<<<<<<<<<
 *             if self.wrap_function == campl.AMPL_PARAMETER:
 *                 errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &name_c)
*/
  /*else*/ {
    __pyx_t_7 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_index); if (unlikely(__pyx_t_7 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(10, 120, __pyx_L1_error)
    __pyx_v_tuple_c = __pyx_t_7;

    /* "amplpy/entity.pxi":121
 *         else:
 *             tuple_c =  to_c_tuple(index)
 *             if self.wrap_function == campl.AMPL_PARAMETER:             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &name_c)
 *                 campl.AMPL_TupleFree(&tuple_c)
*/
    __pyx_t_2 = (__pyx_v_self->wrap_function == AMPL_PARAMETER);
    if (__pyx_t_2) {

      /* "amplpy/entity.pxi":122
 *             tuple_c =  to_c_tuple(index)
 *             if self.wrap_function == campl.AMPL_PARAMETER:
 *                 errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &name_c)             # <<<<<<<<<<<<<<
 *                 campl.AMPL_TupleFree(&tuple_c)
 *                 if errorinfo:
*/
      __pyx_v_errorinfo = AMPL_InstanceGetName(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, __pyx_v_tuple_c, (&__pyx_v_name_c));

      /* "amplpy/entity.pxi":123
 *             if self.wrap_function == campl.AMPL_PARAMETER:
 *                 errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &name_c)
 *                 campl.AMPL_TupleFree(&tuple_c)             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      (void)(AMPL_TupleFree((&__pyx_v_tuple_c)));

      /* "amplpy/entity.pxi":124
 *                 errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &name_c)
 *                 campl.AMPL_TupleFree(&tuple_c)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *                 entity = create_entity(self.wrap_function, self._ampl, name_c, NULL, None).value()
*/
      __pyx_t_2 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_2) {

        /* "amplpy/entity.pxi":125
 *                 campl.AMPL_TupleFree(&tuple_c)
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *                 entity = create_entity(self.wrap_function, self._ampl, name_c, NULL, None).value()
 *                 return entity
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 125, __pyx_L1_error)

        /* "amplpy/entity.pxi":124
 *                 errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &name_c)
 *                 campl.AMPL_TupleFree(&tuple_c)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *                 entity = create_entity(self.wrap_function, self._ampl, name_c, NULL, None).value()
*/
      }

      /* "amplpy/entity.pxi":126
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *                 entity = create_entity(self.wrap_function, self._ampl, name_c, NULL, None).value()             # <<<<<<<<<<<<<<
 *                 return entity
 *             else:
*/
      __pyx_t_8 = ((PyObject *)__pyx_v_self->_ampl);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_9 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->wrap_function, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_8), __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_1 = __pyx_t_9;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_10 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_value, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_v_entity = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "amplpy/entity.pxi":127
 *                     PY_AMPL_CALL(errorinfo)
 *                 entity = create_entity(self.wrap_function, self._ampl, name_c, NULL, None).value()
 *                 return entity             # <<<<<<<<<<<<<<
 *             else:
 *                 return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_entity);
      __pyx_r = __pyx_v_entity;
      goto __pyx_L0;

      /* "amplpy/entity.pxi":121
 *         else:
 *             tuple_c =  to_c_tuple(index)
 *             if self.wrap_function == campl.AMPL_PARAMETER:             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &name_c)
 *                 campl.AMPL_TupleFree(&tuple_c)
*/
    }

    /* "amplpy/entity.pxi":129
 *                 return entity
 *             else:
 *                 return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)             # <<<<<<<<<<<<<<
 * 
 *     def find(self, index):
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = ((PyObject *)__pyx_v_self->_ampl);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_9 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->wrap_function, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_6), __pyx_v_self->_name, __pyx_v_tuple_c, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;
    }
  }

  /* "amplpy/entity.pxi":103
 *         return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
 * 
 *     def get(self, *index):             # <<<<<<<<<<<<<<
 *         """
 *         Get the instance with the specified index.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("amplpy.ampl.Entity.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_entity);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":131
 *                 return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
 * 
 *     def find(self, index):             # <<<<<<<<<<<<<<
 *         """
 *         Searches the current entity for an instance with the specified index.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_13find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_12find, "Entity.find(self, index)\nSearches the current entity for an instance with the specified index.\n\nReturns:\n    The wanted instance if found, otherwise it returns `None`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_13find = {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_13find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_12find};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_13find(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_index = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_index,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 131, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 131, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "find", 0) < 0) __PYX_ERR(10, 131, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("find", 1, 1, 1, i); __PYX_ERR(10, 131, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 131, __pyx_L3_error)
    }
    __pyx_v_index = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("find", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 131, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Entity.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_12find(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v_index);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_12find(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_index) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  size_t __pyx_v_i;
  AMPL_TUPLE *__pyx_v_index_c;
  AMPL_TUPLE **__pyx_v_indices_c;
  size_t __pyx_v_size;
  size_t __pyx_v_j;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  AMPL_TUPLE *__pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  size_t __pyx_t_8;
  size_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find", 0);

  /* "amplpy/entity.pxi":138
 *             The wanted instance if found, otherwise it returns `None`.
 *         """
 *         assert self.wrap_function is not None             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef size_t i
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __Pyx_PyLong_From_AMPL_ENTITYTYPE(__pyx_v_self->wrap_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (__pyx_t_1 != Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(10, 138, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(10, 138, __pyx_L1_error)
  #endif

  /* "amplpy/entity.pxi":141
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef size_t i
 *         cdef campl.AMPL_TUPLE* index_c = to_c_tuple(index)             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_TUPLE** indices_c
 *         cdef size_t size
*/
  __pyx_t_3 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_index); if (unlikely(__pyx_t_3 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(10, 141, __pyx_L1_error)
  __pyx_v_index_c = __pyx_t_3;

  /* "amplpy/entity.pxi":144
 *         cdef campl.AMPL_TUPLE** indices_c
 *         cdef size_t size
 *         errorinfo = campl.AMPL_EntityGetTuples(self._ampl._c_ampl, self._name, &indices_c, &size)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_EntityGetTuples(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, (&__pyx_v_indices_c), (&__pyx_v_size));

  /* "amplpy/entity.pxi":145
 *         cdef size_t size
 *         errorinfo = campl.AMPL_EntityGetTuples(self._ampl._c_ampl, self._name, &indices_c, &size)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         for i in range(size):
*/
  __pyx_t_2 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_2) {

    /* "amplpy/entity.pxi":146
 *         errorinfo = campl.AMPL_EntityGetTuples(self._ampl._c_ampl, self._name, &indices_c, &size)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             if campl.AMPL_TupleCompare(index_c, indices_c[i]) == 0:
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 146, __pyx_L1_error)

    /* "amplpy/entity.pxi":145
 *         cdef size_t size
 *         errorinfo = campl.AMPL_EntityGetTuples(self._ampl._c_ampl, self._name, &indices_c, &size)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         for i in range(size):
*/
  }

  /* "amplpy/entity.pxi":147
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             if campl.AMPL_TupleCompare(index_c, indices_c[i]) == 0:
 *                 for j in range(size):
*/
  __pyx_t_4 = __pyx_v_size;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "amplpy/entity.pxi":148
 *             PY_AMPL_CALL(errorinfo)
 *         for i in range(size):
 *             if campl.AMPL_TupleCompare(index_c, indices_c[i]) == 0:             # <<<<<<<<<<<<<<
 *                 for j in range(size):
 *                     campl.AMPL_TupleFree(&indices_c[j])
*/
    __pyx_t_2 = (AMPL_TupleCompare(__pyx_v_index_c, (__pyx_v_indices_c[__pyx_v_i])) == 0);
    if (__pyx_t_2) {

      /* "amplpy/entity.pxi":149
 *         for i in range(size):
 *             if campl.AMPL_TupleCompare(index_c, indices_c[i]) == 0:
 *                 for j in range(size):             # <<<<<<<<<<<<<<
 *                     campl.AMPL_TupleFree(&indices_c[j])
 *                 free(indices_c)
*/
      __pyx_t_7 = __pyx_v_size;
      __pyx_t_8 = __pyx_t_7;
      for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
        __pyx_v_j = __pyx_t_9;

        /* "amplpy/entity.pxi":150
 *             if campl.AMPL_TupleCompare(index_c, indices_c[i]) == 0:
 *                 for j in range(size):
 *                     campl.AMPL_TupleFree(&indices_c[j])             # <<<<<<<<<<<<<<
 *                 free(indices_c)
 *                 return create_entity(self.wrap_function, self._ampl, self._name, index_c, self)
*/
        (void)(AMPL_TupleFree((&(__pyx_v_indices_c[__pyx_v_j]))));
      }

      /* "amplpy/entity.pxi":151
 *                 for j in range(size):
 *                     campl.AMPL_TupleFree(&indices_c[j])
 *                 free(indices_c)             # <<<<<<<<<<<<<<
 *                 return create_entity(self.wrap_function, self._ampl, self._name, index_c, self)
 *         for i in range(size):
*/
      free(__pyx_v_indices_c);

      /* "amplpy/entity.pxi":152
 *                     campl.AMPL_TupleFree(&indices_c[j])
 *                 free(indices_c)
 *                 return create_entity(self.wrap_function, self._ampl, self._name, index_c, self)             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)__pyx_v_self->_ampl);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_10 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->wrap_function, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_1), __pyx_v_self->_name, __pyx_v_index_c, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;

      /* "amplpy/entity.pxi":148
 *             PY_AMPL_CALL(errorinfo)
 *         for i in range(size):
 *             if campl.AMPL_TupleCompare(index_c, indices_c[i]) == 0:             # <<<<<<<<<<<<<<
 *                 for j in range(size):
 *                     campl.AMPL_TupleFree(&indices_c[j])
*/
    }
  }

  /* "amplpy/entity.pxi":153
 *                 free(indices_c)
 *                 return create_entity(self.wrap_function, self._ampl, self._name, index_c, self)
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)
*/
  __pyx_t_4 = __pyx_v_size;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "amplpy/entity.pxi":154
 *                 return create_entity(self.wrap_function, self._ampl, self._name, index_c, self)
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])             # <<<<<<<<<<<<<<
 *         free(indices_c)
 *         campl.AMPL_TupleFree(&index_c)
*/
    (void)(AMPL_TupleFree((&(__pyx_v_indices_c[__pyx_v_i]))));
  }

  /* "amplpy/entity.pxi":155
 *         for i in range(size):
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)             # <<<<<<<<<<<<<<
 *         campl.AMPL_TupleFree(&index_c)
 *         return None
*/
  free(__pyx_v_indices_c);

  /* "amplpy/entity.pxi":156
 *             campl.AMPL_TupleFree(&indices_c[i])
 *         free(indices_c)
 *         campl.AMPL_TupleFree(&index_c)             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  (void)(AMPL_TupleFree((&__pyx_v_index_c)));

  /* "amplpy/entity.pxi":157
 *         free(indices_c)
 *         campl.AMPL_TupleFree(&index_c)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def instances(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "amplpy/entity.pxi":131
 *                 return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
 * 
 *     def find(self, index):             # <<<<<<<<<<<<<<
 *         """
 *         Searches the current entity for an instance with the specified index.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("amplpy.ampl.Entity.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":159
 *         return None
 * 
 *     def instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the instances in this entity.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_15instances(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_14instances, "Entity.instances(self)\nGet all the instances in this entity.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_15instances = {"instances", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_15instances, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_14instances};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_15instances(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("instances (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("instances", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("instances", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_14instances(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_14instances(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("instances", 0);

  /* "amplpy/entity.pxi":163
 *         Get all the instances in this entity.
 *         """
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)             # <<<<<<<<<<<<<<
 * 
 *     def name(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_ampl);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6amplpy_4ampl_16InstanceIterator_create(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_1), __pyx_v_self->_name, __pyx_v_self->wrap_function, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":159
 *         return None
 * 
 *     def instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the instances in this entity.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Entity.instances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":165
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
 * 
 *     def name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of this entity.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_17name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_16name, "Entity.name(self)\nGet the name of this entity.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_17name = {"name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_17name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_16name};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_17name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("name (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("name", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("name", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_16name(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_16name(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("name", 0);

  /* "amplpy/entity.pxi":169
 *         Get the name of this entity.
 *         """
 *         return self._name.decode('utf-8')             # <<<<<<<<<<<<<<
 * 
 *     def indexarity(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_name;
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(10, 169, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_1, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":165
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
 * 
 *     def name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of this entity.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Entity.name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":171
 *         return self._name.decode('utf-8')
 * 
 *     def indexarity(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the indexarity of this entity (sum of the dimensions of the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_19indexarity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_18indexarity, "Entity.indexarity(self)\nGet the indexarity of this entity (sum of the dimensions of the\nindexing sets).\nThis value indicates the arity of the tuple to be passed to the method\n:func:`~amplpy.Entity.get` in order to access an instance of this\nentity. See the following AMPL examples:\n\n.. code-block:: ampl\n\n    var x;               # indexarity = 0\n    var y {1..2};        # indexarity = 1\n    var z {1..2,3..4};   # indexarity = 2\n    var zz {{(1, 2)}};   # indexarity = 2\n\nReturns:\n    The sum of the dimensions of the indexing sets or 0 if the\n    entity is not indexed.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_19indexarity = {"indexarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_19indexarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_18indexarity};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_19indexarity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("indexarity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("indexarity", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("indexarity", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_18indexarity(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_18indexarity(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  size_t __pyx_v_indexarity;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("indexarity", 0);

  /* "amplpy/entity.pxi":191
 *         """
 *         cdef size_t indexarity
 *         if self._index is not NULL:             # <<<<<<<<<<<<<<
 *             indexarity = 0
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->_index != NULL);
  if (__pyx_t_1) {

    /* "amplpy/entity.pxi":192
 *         cdef size_t indexarity
 *         if self._index is not NULL:
 *             indexarity = 0             # <<<<<<<<<<<<<<
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(self._ampl._c_ampl, self._name, &indexarity))
*/
    __pyx_v_indexarity = 0;

    /* "amplpy/entity.pxi":191
 *         """
 *         cdef size_t indexarity
 *         if self._index is not NULL:             # <<<<<<<<<<<<<<
 *             indexarity = 0
 *         else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/entity.pxi":194
 *             indexarity = 0
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(self._ampl._c_ampl, self._name, &indexarity))             # <<<<<<<<<<<<<<
 *         return indexarity
 * 
*/
  /*else*/ {
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityGetIndexarity(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, (&__pyx_v_indexarity))); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 194, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "amplpy/entity.pxi":195
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(self._ampl._c_ampl, self._name, &indexarity))
 *         return indexarity             # <<<<<<<<<<<<<<
 * 
 *     def is_scalar(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyLong_FromSize_t(__pyx_v_indexarity); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":171
 *         return self._name.decode('utf-8')
 * 
 *     def indexarity(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the indexarity of this entity (sum of the dimensions of the
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Entity.indexarity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":197
 *         return indexarity
 * 
 *     def is_scalar(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check whether this entity is scalar. Equivalent to testing whether
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_21is_scalar(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_20is_scalar, "Entity.is_scalar(self)\nCheck whether this entity is scalar. Equivalent to testing whether\n:func:`~amplpy.Entity.indexarity` is equal to zero.\n\nReturns:\n    True if the entity is scalar (not indexed over any set).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_21is_scalar = {"is_scalar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_21is_scalar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_20is_scalar};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_21is_scalar(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_scalar (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_scalar", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_scalar", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_20is_scalar(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_20is_scalar(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_scalar", 0);

  /* "amplpy/entity.pxi":205
 *             True if the entity is scalar (not indexed over any set).
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             return self.indexarity() == 0
 *         except:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "amplpy/entity.pxi":206
 *         """
 *         try:
 *             return self.indexarity() == 0             # <<<<<<<<<<<<<<
 *         except:
 *             return True
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_indexarity, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 206, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_5 = __Pyx_PyLong_EqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 206, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;

      /* "amplpy/entity.pxi":205
 *             True if the entity is scalar (not indexed over any set).
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             return self.indexarity() == 0
 *         except:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "amplpy/entity.pxi":207
 *         try:
 *             return self.indexarity() == 0
 *         except:             # <<<<<<<<<<<<<<
 *             return True
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);

      /* "amplpy/entity.pxi":208
 *             return self.indexarity() == 0
 *         except:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def num_instances(self):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L6_except_return;
    }

    /* "amplpy/entity.pxi":205
 *             True if the entity is scalar (not indexed over any set).
 *         """
 *         try:             # <<<<<<<<<<<<<<
 *             return self.indexarity() == 0
 *         except:
*/
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "amplpy/entity.pxi":197
 *         return indexarity
 * 
 *     def is_scalar(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check whether this entity is scalar. Equivalent to testing whether
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":210
 *             return True
 * 
 *     def num_instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of instances in this entity.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_23num_instances(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_22num_instances, "Entity.num_instances(self)\nGet the number of instances in this entity.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_23num_instances = {"num_instances", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_23num_instances, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_22num_instances};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_23num_instances(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("num_instances (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("num_instances", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("num_instances", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_22num_instances(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_22num_instances(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  size_t __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("num_instances", 0);

  /* "amplpy/entity.pxi":215
 *         """
 *         cdef size_t size
 *         PY_AMPL_CALL(campl.AMPL_EntityGetNumInstances(self._ampl._c_ampl, self._name, &size))             # <<<<<<<<<<<<<<
 *         return int(size)
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityGetNumInstances(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, (&__pyx_v_size))); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 215, __pyx_L1_error)

  /* "amplpy/entity.pxi":216
 *         cdef size_t size
 *         PY_AMPL_CALL(campl.AMPL_EntityGetNumInstances(self._ampl._c_ampl, self._name, &size))
 *         return int(size)             # <<<<<<<<<<<<<<
 * 
 *     def get_indexing_sets(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":210
 *             return True
 * 
 *     def num_instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of instances in this entity.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Entity.num_instances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":218
 *         return int(size)
 * 
 *     def get_indexing_sets(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL string representation of the sets on which this entity is
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_25get_indexing_sets(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_24get_indexing_sets, "Entity.get_indexing_sets(self)\nGet the AMPL string representation of the sets on which this entity is\nindexed. The obtained vector can be modified without any effect to the\nentity.\n\nReturns:\n    The string representation of the indexing sets for this entity or\n    an empty array if the entity is scalar.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_25get_indexing_sets = {"get_indexing_sets", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_25get_indexing_sets, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_24get_indexing_sets};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_25get_indexing_sets(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_indexing_sets (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_indexing_sets", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_indexing_sets", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_24get_indexing_sets(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_24get_indexing_sets(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  size_t __pyx_v_i;
  size_t __pyx_v_size;
  char **__pyx_v_sets;
  PyObject *__pyx_v_pylist = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_indexing_sets", 0);

  /* "amplpy/entity.pxi":231
 *         cdef size_t size
 *         cdef char** sets
 *         cdef list pylist = []             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexingSets(self._ampl._c_ampl, self._name, &sets, &size))
 *         for i in range(size):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylist = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/entity.pxi":232
 *         cdef char** sets
 *         cdef list pylist = []
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexingSets(self._ampl._c_ampl, self._name, &sets, &size))             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             if sets[i] != NULL:
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityGetIndexingSets(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, (&__pyx_v_sets), (&__pyx_v_size))); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 232, __pyx_L1_error)

  /* "amplpy/entity.pxi":233
 *         cdef list pylist = []
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexingSets(self._ampl._c_ampl, self._name, &sets, &size))
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             if sets[i] != NULL:
 *                 pylist.append(sets[i].decode('utf-8'))
*/
  __pyx_t_2 = __pyx_v_size;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "amplpy/entity.pxi":234
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexingSets(self._ampl._c_ampl, self._name, &sets, &size))
 *         for i in range(size):
 *             if sets[i] != NULL:             # <<<<<<<<<<<<<<
 *                 pylist.append(sets[i].decode('utf-8'))
 *             else:
*/
    __pyx_t_5 = ((__pyx_v_sets[__pyx_v_i]) != NULL);
    if (__pyx_t_5) {

      /* "amplpy/entity.pxi":235
 *         for i in range(size):
 *             if sets[i] != NULL:
 *                 pylist.append(sets[i].decode('utf-8'))             # <<<<<<<<<<<<<<
 *             else:
 *                 pylist.append(None)
*/
      __pyx_t_6 = (__pyx_v_sets[__pyx_v_i]);
      __pyx_t_7 = __Pyx_ssize_strlen(__pyx_t_6); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(10, 235, __pyx_L1_error)
      __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_6, 0, __pyx_t_7, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_pylist, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 235, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "amplpy/entity.pxi":234
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexingSets(self._ampl._c_ampl, self._name, &sets, &size))
 *         for i in range(size):
 *             if sets[i] != NULL:             # <<<<<<<<<<<<<<
 *                 pylist.append(sets[i].decode('utf-8'))
 *             else:
*/
      goto __pyx_L5;
    }

    /* "amplpy/entity.pxi":237
 *                 pylist.append(sets[i].decode('utf-8'))
 *             else:
 *                 pylist.append(None)             # <<<<<<<<<<<<<<
 *             campl.AMPL_StringFree(&sets[i])
 *         free(sets)
*/
    /*else*/ {
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_pylist, Py_None); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 237, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "amplpy/entity.pxi":238
 *             else:
 *                 pylist.append(None)
 *             campl.AMPL_StringFree(&sets[i])             # <<<<<<<<<<<<<<
 *         free(sets)
 * 
*/
    (void)(AMPL_StringFree((&(__pyx_v_sets[__pyx_v_i]))));
  }

  /* "amplpy/entity.pxi":239
 *                 pylist.append(None)
 *             campl.AMPL_StringFree(&sets[i])
 *         free(sets)             # <<<<<<<<<<<<<<
 * 
 *         return pylist
*/
  free(__pyx_v_sets);

  /* "amplpy/entity.pxi":241
 *         free(sets)
 * 
 *         return pylist             # <<<<<<<<<<<<<<
 * 
 *     def xref(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pylist);
  __pyx_r = __pyx_v_pylist;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":218
 *         return int(size)
 * 
 *     def get_indexing_sets(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL string representation of the sets on which this entity is
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Entity.get_indexing_sets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":243
 *         return pylist
 * 
 *     def xref(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the names of all entities which depend on this one.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_27xref(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_26xref, "Entity.xref(self)\nGet the names of all entities which depend on this one.\n\nReturns:\n    A list with the names of all entities which depend on this one.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_27xref = {"xref", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_27xref, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_26xref};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_27xref(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("xref (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("xref", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("xref", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_26xref(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_26xref(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  size_t __pyx_v_size;
  char **__pyx_v_xref;
  PyObject *__pyx_v_pylist = 0;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("xref", 0);

  /* "amplpy/entity.pxi":252
 *         cdef size_t size
 *         cdef char** xref
 *         cdef list pylist = []             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_EntityGetXref(self._ampl._c_ampl, self._name, &xref, &size))
 *         for i in range(size):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pylist = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/entity.pxi":253
 *         cdef char** xref
 *         cdef list pylist = []
 *         PY_AMPL_CALL(campl.AMPL_EntityGetXref(self._ampl._c_ampl, self._name, &xref, &size))             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             if xref[i] != NULL:
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityGetXref(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, (&__pyx_v_xref), (&__pyx_v_size))); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 253, __pyx_L1_error)

  /* "amplpy/entity.pxi":254
 *         cdef list pylist = []
 *         PY_AMPL_CALL(campl.AMPL_EntityGetXref(self._ampl._c_ampl, self._name, &xref, &size))
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             if xref[i] != NULL:
 *                 pylist.append(xref[i].decode('utf-8'))
*/
  __pyx_t_2 = __pyx_v_size;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "amplpy/entity.pxi":255
 *         PY_AMPL_CALL(campl.AMPL_EntityGetXref(self._ampl._c_ampl, self._name, &xref, &size))
 *         for i in range(size):
 *             if xref[i] != NULL:             # <<<<<<<<<<<<<<
 *                 pylist.append(xref[i].decode('utf-8'))
 *                 campl.AMPL_StringFree(&xref[i])
*/
    __pyx_t_5 = ((__pyx_v_xref[__pyx_v_i]) != NULL);
    if (__pyx_t_5) {

      /* "amplpy/entity.pxi":256
 *         for i in range(size):
 *             if xref[i] != NULL:
 *                 pylist.append(xref[i].decode('utf-8'))             # <<<<<<<<<<<<<<
 *                 campl.AMPL_StringFree(&xref[i])
 *             else:
*/
      __pyx_t_6 = (__pyx_v_xref[__pyx_v_i]);
      __pyx_t_7 = __Pyx_ssize_strlen(__pyx_t_6); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(10, 256, __pyx_L1_error)
      __pyx_t_1 = __Pyx_decode_c_string(__pyx_t_6, 0, __pyx_t_7, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 256, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_pylist, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 256, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "amplpy/entity.pxi":257
 *             if xref[i] != NULL:
 *                 pylist.append(xref[i].decode('utf-8'))
 *                 campl.AMPL_StringFree(&xref[i])             # <<<<<<<<<<<<<<
 *             else:
 *                 pylist.append(None)
*/
      (void)(AMPL_StringFree((&(__pyx_v_xref[__pyx_v_i]))));

      /* "amplpy/entity.pxi":255
 *         PY_AMPL_CALL(campl.AMPL_EntityGetXref(self._ampl._c_ampl, self._name, &xref, &size))
 *         for i in range(size):
 *             if xref[i] != NULL:             # <<<<<<<<<<<<<<
 *                 pylist.append(xref[i].decode('utf-8'))
 *                 campl.AMPL_StringFree(&xref[i])
*/
      goto __pyx_L5;
    }

    /* "amplpy/entity.pxi":259
 *                 campl.AMPL_StringFree(&xref[i])
 *             else:
 *                 pylist.append(None)             # <<<<<<<<<<<<<<
 *         free(xref)
 *         return pylist
*/
    /*else*/ {
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_pylist, Py_None); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(10, 259, __pyx_L1_error)
    }
    __pyx_L5:;
  }

  /* "amplpy/entity.pxi":260
 *             else:
 *                 pylist.append(None)
 *         free(xref)             # <<<<<<<<<<<<<<
 *         return pylist
 * 
*/
  free(__pyx_v_xref);

  /* "amplpy/entity.pxi":261
 *                 pylist.append(None)
 *         free(xref)
 *         return pylist             # <<<<<<<<<<<<<<
 * 
 *     def get_values(self, suffixes=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pylist);
  __pyx_r = __pyx_v_pylist;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":243
 *         return pylist
 * 
 *     def xref(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the names of all entities which depend on this one.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Entity.xref", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pylist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":263
 *         return pylist
 * 
 *     def get_values(self, suffixes=None):             # <<<<<<<<<<<<<<
 *         """
 *         If a list of suffixes is provided, get the specified suffixes value for
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_29get_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_28get_values, "Entity.get_values(self, suffixes=None)\nIf a list of suffixes is provided, get the specified suffixes value for\nall instances. Otherwise, get all the principal values of this entity.\nThe specific returned value depends on the type of entity (see list\nbelow). For:\n\n- Variables and Objectives it returns the suffix ``val``.\n- Parameters it returns their values.\n- Constraints it returns the suffix ``dual``.\n- Sets it returns all the members of the set. Note that it does not\n  apply to indexed sets. See :func:`~amplpy.Set.get_values`.\n\nRaises:\n    RuntimeError: if there are issues with the data.\n\nRetruns:\n    A :class:`~amplpy.DataFrame` containing the values for all\n    instances.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_29get_values = {"get_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_29get_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_28get_values};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_29get_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_suffixes = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_suffixes,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 263, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 263, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_values", 0) < 0) __PYX_ERR(10, 263, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 263, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_suffixes = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_values", 0, 0, 1, __pyx_nargs); __PYX_ERR(10, 263, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Entity.get_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_28get_values(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v_suffixes);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_28get_values(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_suffixes) {
  AMPL_DATAFRAME *__pyx_v_df_c;
  char **__pyx_v_suffixes_c;
  size_t __pyx_v_n;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_values", 0);
  __Pyx_INCREF(__pyx_v_suffixes);

  /* "amplpy/entity.pxi":286
 *         cdef char** suffixes_c
 *         cdef size_t n
 *         if suffixes is None:             # <<<<<<<<<<<<<<
 *             n = 0
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, NULL, n, &df_c))
*/
  __pyx_t_1 = (__pyx_v_suffixes == Py_None);
  if (__pyx_t_1) {

    /* "amplpy/entity.pxi":287
 *         cdef size_t n
 *         if suffixes is None:
 *             n = 0             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, NULL, n, &df_c))
 *         else:
*/
    __pyx_v_n = 0;

    /* "amplpy/entity.pxi":288
 *         if suffixes is None:
 *             n = 0
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, NULL, n, &df_c))             # <<<<<<<<<<<<<<
 *         else:
 *             if isinstance(suffixes, str):
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityGetValues(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, NULL, __pyx_v_n, (&__pyx_v_df_c))); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 288, __pyx_L1_error)

    /* "amplpy/entity.pxi":286
 *         cdef char** suffixes_c
 *         cdef size_t n
 *         if suffixes is None:             # <<<<<<<<<<<<<<
 *             n = 0
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, NULL, n, &df_c))
*/
    goto __pyx_L3;
  }

  /* "amplpy/entity.pxi":290
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, NULL, n, &df_c))
 *         else:
 *             if isinstance(suffixes, str):             # <<<<<<<<<<<<<<
 *                 suffixes = [suffixes]
 *             else:
*/
  /*else*/ {
    __pyx_t_1 = PyUnicode_Check(__pyx_v_suffixes); 
    if (__pyx_t_1) {

      /* "amplpy/entity.pxi":291
 *         else:
 *             if isinstance(suffixes, str):
 *                 suffixes = [suffixes]             # <<<<<<<<<<<<<<
 *             else:
 *                 suffixes = list(map(str, suffixes))
*/
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_suffixes);
      __Pyx_GIVEREF(__pyx_v_suffixes);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_suffixes) != (0)) __PYX_ERR(10, 291, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_suffixes, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "amplpy/entity.pxi":290
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, NULL, n, &df_c))
 *         else:
 *             if isinstance(suffixes, str):             # <<<<<<<<<<<<<<
 *                 suffixes = [suffixes]
 *             else:
*/
      goto __pyx_L4;
    }

    /* "amplpy/entity.pxi":293
 *                 suffixes = [suffixes]
 *             else:
 *                 suffixes = list(map(str, suffixes))             # <<<<<<<<<<<<<<
 *             suffixes_c = <char**> malloc(len(suffixes) * sizeof(char*))
 *             for i in range(len(suffixes)):
*/
    /*else*/ {
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_map);
      __pyx_t_4 = __pyx_builtin_map; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)(&PyUnicode_Type)), __pyx_v_suffixes};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_4 = __Pyx_PySequence_ListKeepNew(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_suffixes, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L4:;

    /* "amplpy/entity.pxi":294
 *             else:
 *                 suffixes = list(map(str, suffixes))
 *             suffixes_c = <char**> malloc(len(suffixes) * sizeof(char*))             # <<<<<<<<<<<<<<
 *             for i in range(len(suffixes)):
 *                 suffixes_c[i] = strdup(suffixes[i].encode('utf-8'))
*/
    __pyx_t_6 = PyObject_Length(__pyx_v_suffixes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(10, 294, __pyx_L1_error)
    __pyx_v_suffixes_c = ((char **)malloc((__pyx_t_6 * (sizeof(char *)))));

    /* "amplpy/entity.pxi":295
 *                 suffixes = list(map(str, suffixes))
 *             suffixes_c = <char**> malloc(len(suffixes) * sizeof(char*))
 *             for i in range(len(suffixes)):             # <<<<<<<<<<<<<<
 *                 suffixes_c[i] = strdup(suffixes[i].encode('utf-8'))
 *             n = len(suffixes)
*/
    __pyx_t_6 = PyObject_Length(__pyx_v_suffixes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(10, 295, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "amplpy/entity.pxi":296
 *             suffixes_c = <char**> malloc(len(suffixes) * sizeof(char*))
 *             for i in range(len(suffixes)):
 *                 suffixes_c[i] = strdup(suffixes[i].encode('utf-8'))             # <<<<<<<<<<<<<<
 *             n = len(suffixes)
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, suffixes_c, n, &df_c))
*/
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_suffixes, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __pyx_t_3;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 296, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(10, 296, __pyx_L1_error)
      (__pyx_v_suffixes_c[__pyx_v_i]) = strdup(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }

    /* "amplpy/entity.pxi":297
 *             for i in range(len(suffixes)):
 *                 suffixes_c[i] = strdup(suffixes[i].encode('utf-8'))
 *             n = len(suffixes)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, suffixes_c, n, &df_c))
 *             for i in range(len(suffixes)):
*/
    __pyx_t_6 = PyObject_Length(__pyx_v_suffixes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(10, 297, __pyx_L1_error)
    __pyx_v_n = __pyx_t_6;

    /* "amplpy/entity.pxi":298
 *                 suffixes_c[i] = strdup(suffixes[i].encode('utf-8'))
 *             n = len(suffixes)
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, suffixes_c, n, &df_c))             # <<<<<<<<<<<<<<
 *             for i in range(len(suffixes)):
 *                 free(suffixes_c[i])
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityGetValues(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, __pyx_v_suffixes_c, __pyx_v_n, (&__pyx_v_df_c))); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 298, __pyx_L1_error)

    /* "amplpy/entity.pxi":299
 *             n = len(suffixes)
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, suffixes_c, n, &df_c))
 *             for i in range(len(suffixes)):             # <<<<<<<<<<<<<<
 *                 free(suffixes_c[i])
 *             free(suffixes_c)
*/
    __pyx_t_6 = PyObject_Length(__pyx_v_suffixes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(10, 299, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_i = __pyx_t_8;

      /* "amplpy/entity.pxi":300
 *             PY_AMPL_CALL(campl.AMPL_EntityGetValues(self._ampl._c_ampl, self._name, suffixes_c, n, &df_c))
 *             for i in range(len(suffixes)):
 *                 free(suffixes_c[i])             # <<<<<<<<<<<<<<
 *             free(suffixes_c)
 * 
*/
      free((__pyx_v_suffixes_c[__pyx_v_i]));
    }

    /* "amplpy/entity.pxi":301
 *             for i in range(len(suffixes)):
 *                 free(suffixes_c[i])
 *             free(suffixes_c)             # <<<<<<<<<<<<<<
 * 
 *         return DataFrame.create(df_c)
*/
    free(__pyx_v_suffixes_c);
  }
  __pyx_L3:;

  /* "amplpy/entity.pxi":303
 *             free(suffixes_c)
 * 
 *         return DataFrame.create(df_c)             # <<<<<<<<<<<<<<
 * 
 *     def to_pandas(self, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_6amplpy_4ampl_9DataFrame_create(__pyx_v_df_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":263
 *         return pylist
 * 
 *     def get_values(self, suffixes=None):             # <<<<<<<<<<<<<<
 *         """
 *         If a list of suffixes is provided, get the specified suffixes value for
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Entity.get_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_suffixes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":305
 *         return DataFrame.create(df_c)
 * 
 *     def to_pandas(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_pandas`.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_31to_pandas(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_30to_pandas, "Entity.to_pandas(self, **kwargs)\nEquivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_pandas`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_31to_pandas = {"to_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_31to_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_30to_pandas};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_31to_pandas(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_pandas (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_pandas", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("to_pandas", __pyx_kwds) == -1)) return NULL;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_30to_pandas(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v_kwargs);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_30to_pandas(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_pandas", 0);

  /* "amplpy/entity.pxi":309
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_pandas`.
 *         """
 *         return self.get_values().to_pandas(**kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def to_dict(self, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_values, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_to_pandas); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":305
 *         return DataFrame.create(df_c)
 * 
 *     def to_pandas(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_pandas`.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Entity.to_pandas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":311
 *         return self.get_values().to_pandas(**kwargs)
 * 
 *     def to_dict(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_dict`.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_33to_dict(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_32to_dict, "Entity.to_dict(self, **kwargs)\nEquivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_dict`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_33to_dict = {"to_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_33to_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_32to_dict};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_33to_dict(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_dict (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_dict", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("to_dict", __pyx_kwds) == -1)) return NULL;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_32to_dict(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v_kwargs);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_32to_dict(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_dict", 0);

  /* "amplpy/entity.pxi":315
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_dict`.
 *         """
 *         return self.get_values().to_dict(**kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def to_list(self, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_values, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_to_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":311
 *         return self.get_values().to_pandas(**kwargs)
 * 
 *     def to_dict(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_dict`.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Entity.to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":317
 *         return self.get_values().to_dict(**kwargs)
 * 
 *     def to_list(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_list`.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_35to_list(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_34to_list, "Entity.to_list(self, **kwargs)\nEquivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_list`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_35to_list = {"to_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_35to_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_34to_list};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_35to_list(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_list (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_list", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("to_list", __pyx_kwds) == -1)) return NULL;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_34to_list(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v_kwargs);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_34to_list(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_list", 0);

  /* "amplpy/entity.pxi":321
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_list`.
 *         """
 *         return self.get_values().to_list(**kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def set_values(self, data):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_values, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_to_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "amplpy/entity.pxi":317
 *         return self.get_values().to_dict(**kwargs)
 * 
 *     def to_list(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_list`.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Entity.to_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/entity.pxi":323
 *         return self.get_values().to_list(**kwargs)
 * 
 *     def set_values(self, data):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of this entiy to the correponding values of a
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_37set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_36set_values, "Entity.set_values(self, data)\nSet the values of this entiy to the correponding values of a\nDataFrame indexed over the same sets (or a subset).\nThis function assigns the values in the first data column of\nthe passed dataframe to the entity the function is called from.\nIn particular, the statement:\n\n.. code-block:: python\n\n    x.set_values(y.get_values())\n\nis semantically equivalent to the AMPL statement:\n\n.. code-block:: ampl\n\n    let {s in S} x[s] := y[s];\n\nArgs:\n    data: The data to set the entity to.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_37set_values = {"set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_37set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_36set_values};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_37set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(10, 323, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 323, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_values", 0) < 0) __PYX_ERR(10, 323, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_values", 1, 1, 1, i); __PYX_ERR(10, 323, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(10, 323, __pyx_L3_error)
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_values", 1, 1, 1, __pyx_nargs); __PYX_ERR(10, 323, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Entity.set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_36set_values(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_36set_values(struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, PyObject *__pyx_v_data) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_df = 0;
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_data_frame = 0;
  AMPL_DATAFRAME *__pyx_v_df_c;
  char *__pyx_v__name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  AMPL_DATAFRAME *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  struct AMPL_DATAFRAMEARROW *__pyx_t_10;
  PyObject *__pyx_t_11[3];
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_values", 0);

  /* "amplpy/entity.pxi":349
 *         cdef campl.AMPL_DATAFRAME* df_c
 *         cdef char* _name_c
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, self._index, &_name_c))             # <<<<<<<<<<<<<<
 *         if isinstance(data, DataFrame):
 *             df = data
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetName(__pyx_v_self->_ampl->_c_ampl, __pyx_v_self->_name, __pyx_v_self->_index, (&__pyx_v__name_c))); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 349, __pyx_L1_error)

  /* "amplpy/entity.pxi":350
 *         cdef char* _name_c
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, self._index, &_name_c))
 *         if isinstance(data, DataFrame):             # <<<<<<<<<<<<<<
 *             df = data
 *             df_c = df.get_ptr()
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_data, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame); 
  if (__pyx_t_1) {

    /* "amplpy/entity.pxi":351
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, self._index, &_name_c))
 *         if isinstance(data, DataFrame):
 *             df = data             # <<<<<<<<<<<<<<
 *             df_c = df.get_ptr()
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
*/
    __pyx_t_2 = __pyx_v_data;
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame))))) __PYX_ERR(10, 351, __pyx_L1_error)
    __pyx_v_df = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "amplpy/entity.pxi":352
 *         if isinstance(data, DataFrame):
 *             df = data
 *             df_c = df.get_ptr()             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame *)__pyx_v_df->__pyx_vtab)->get_ptr(__pyx_v_df); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 352, __pyx_L1_error)
    __pyx_v_df_c = __pyx_t_3;

    /* "amplpy/entity.pxi":353
 *             df = data
 *             df_c = df.get_ptr()
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)             # <<<<<<<<<<<<<<
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:
*/
    __pyx_v_errorinfo = AMPL_EntitySetValues(__pyx_v_self->_ampl->_c_ampl, __pyx_v__name_c, __pyx_v_df_c);

    /* "amplpy/entity.pxi":354
 *             df_c = df.get_ptr()
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)             # <<<<<<<<<<<<<<
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
*/
    (void)(AMPL_StringFree((&__pyx_v__name_c)));

    /* "amplpy/entity.pxi":355
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(data, dict):
*/
    __pyx_t_1 = (__pyx_v_errorinfo != 0);
    if (__pyx_t_1) {

      /* "amplpy/entity.pxi":356
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         elif isinstance(data, dict):
 *             df = DataFrame.from_dict(data)
*/
      __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 356, __pyx_L1_error)

      /* "amplpy/entity.pxi":355
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(data, dict):
*/
    }

    /* "amplpy/entity.pxi":350
 *         cdef char* _name_c
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, self._index, &_name_c))
 *         if isinstance(data, DataFrame):             # <<<<<<<<<<<<<<
 *             df = data
 *             df_c = df.get_ptr()
*/
    goto __pyx_L3;
  }

  /* "amplpy/entity.pxi":357
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(data, dict):             # <<<<<<<<<<<<<<
 *             df = DataFrame.from_dict(data)
 *             df_c = df.get_ptr()
*/
  __pyx_t_1 = PyDict_Check(__pyx_v_data); 
  if (__pyx_t_1) {

    /* "amplpy/entity.pxi":358
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(data, dict):
 *             df = DataFrame.from_dict(data)             # <<<<<<<<<<<<<<
 *             df_c = df.get_ptr()
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
*/
    __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_data};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_from_dict, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame))))) __PYX_ERR(10, 358, __pyx_L1_error)
    __pyx_v_df = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "amplpy/entity.pxi":359
 *         elif isinstance(data, dict):
 *             df = DataFrame.from_dict(data)
 *             df_c = df.get_ptr()             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame *)__pyx_v_df->__pyx_vtab)->get_ptr(__pyx_v_df); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 359, __pyx_L1_error)
    __pyx_v_df_c = __pyx_t_3;

    /* "amplpy/entity.pxi":360
 *             df = DataFrame.from_dict(data)
 *             df_c = df.get_ptr()
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)             # <<<<<<<<<<<<<<
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:
*/
    __pyx_v_errorinfo = AMPL_EntitySetValues(__pyx_v_self->_ampl->_c_ampl, __pyx_v__name_c, __pyx_v_df_c);

    /* "amplpy/entity.pxi":361
 *             df_c = df.get_ptr()
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)             # <<<<<<<<<<<<<<
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
*/
    (void)(AMPL_StringFree((&__pyx_v__name_c)));

    /* "amplpy/entity.pxi":362
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         else:
*/
    __pyx_t_1 = (__pyx_v_errorinfo != 0);
    if (__pyx_t_1) {

      /* "amplpy/entity.pxi":363
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         else:
 *             if None not in (pd, pa, na) and isinstance(data, (pd.DataFrame, pd.Series)):
*/
      __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 363, __pyx_L1_error)

      /* "amplpy/entity.pxi":362
 *             errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 *             campl.AMPL_StringFree(&_name_c)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         else:
*/
    }

    /* "amplpy/entity.pxi":357
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(data, dict):             # <<<<<<<<<<<<<<
 *             df = DataFrame.from_dict(data)
 *             df_c = df.get_ptr()
*/
    goto __pyx_L3;
  }

  /* "amplpy/entity.pxi":365
 *                 PY_AMPL_CALL(errorinfo)
 *         else:
 *             if None not in (pd, pa, na) and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 data_frame = DataFrameArrow.from_pandas(data, indexarity=self.indexarity())
 *                 errorinfo = campl.AMPL_EntitySetValuesArrow(self._ampl._c_ampl, _name_c, data_frame.get_ptr())
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_8) {
    } else {
      __pyx_t_6 = __pyx_t_8;
      goto __pyx_L9_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_pa); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_8) {
    } else {
      __pyx_t_6 = __pyx_t_8;
      goto __pyx_L9_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_na); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = __pyx_t_8;
    __pyx_L9_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_t_6;
    if (__pyx_t_8) {
    } else {
      __pyx_t_1 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_7); 
    if (!__pyx_t_6) {
    } else {
      __pyx_t_8 = __pyx_t_6;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_4); 
    __pyx_t_8 = __pyx_t_6;
    __pyx_L12_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "amplpy/entity.pxi":366
 *         else:
 *             if None not in (pd, pa, na) and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data_frame = DataFrameArrow.from_pandas(data, indexarity=self.indexarity())             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_EntitySetValuesArrow(self._ampl._c_ampl, _name_c, data_frame.get_ptr())
 * 
*/
      __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_9 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_indexarity, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 366, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_data};
        __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 366, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_indexarity, __pyx_t_2, __pyx_t_9, __pyx_callargs+2, 0) < 0) __PYX_ERR(10, 366, __pyx_L1_error)
        __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 366, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow))))) __PYX_ERR(10, 366, __pyx_L1_error)
      __pyx_v_data_frame = ((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "amplpy/entity.pxi":367
 *             if None not in (pd, pa, na) and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data_frame = DataFrameArrow.from_pandas(data, indexarity=self.indexarity())
 *                 errorinfo = campl.AMPL_EntitySetValuesArrow(self._ampl._c_ampl, _name_c, data_frame.get_ptr())             # <<<<<<<<<<<<<<
 * 
 *                 campl.AMPL_StringFree(&_name_c)
*/
      __pyx_t_10 = ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow *)__pyx_v_data_frame->__pyx_vtab)->get_ptr(__pyx_v_data_frame); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 367, __pyx_L1_error)
      __pyx_v_errorinfo = AMPL_EntitySetValuesArrow(__pyx_v_self->_ampl->_c_ampl, __pyx_v__name_c, __pyx_t_10);

      /* "amplpy/entity.pxi":369
 *                 errorinfo = campl.AMPL_EntitySetValuesArrow(self._ampl._c_ampl, _name_c, data_frame.get_ptr())
 * 
 *                 campl.AMPL_StringFree(&_name_c)             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      (void)(AMPL_StringFree((&__pyx_v__name_c)));

      /* "amplpy/entity.pxi":370
 * 
 *                 campl.AMPL_StringFree(&_name_c)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *                 return
*/
      __pyx_t_1 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_1) {

        /* "amplpy/entity.pxi":371
 *                 campl.AMPL_StringFree(&_name_c)
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *                 return
 *             elif pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 371, __pyx_L1_error)

        /* "amplpy/entity.pxi":370
 * 
 *                 campl.AMPL_StringFree(&_name_c)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *                 return
*/
      }

      /* "amplpy/entity.pxi":372
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *                 return             # <<<<<<<<<<<<<<
 *             elif pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 df = DataFrame.from_pandas(data, indexarity=self.indexarity())
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "amplpy/entity.pxi":365
 *                 PY_AMPL_CALL(errorinfo)
 *         else:
 *             if None not in (pd, pa, na) and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 data_frame = DataFrameArrow.from_pandas(data, indexarity=self.indexarity())
 *                 errorinfo = campl.AMPL_EntitySetValuesArrow(self._ampl._c_ampl, _name_c, data_frame.get_ptr())
*/
    }

    /* "amplpy/entity.pxi":373
 *                     PY_AMPL_CALL(errorinfo)
 *                 return
 *             elif pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 df = DataFrame.from_pandas(data, indexarity=self.indexarity())
 *                 df_c = df.get_ptr()
*/
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = (__pyx_t_7 != Py_None);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_8) {
    } else {
      __pyx_t_1 = __pyx_t_8;
      goto __pyx_L15_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_9); 
    if (!__pyx_t_6) {
    } else {
      __pyx_t_8 = __pyx_t_6;
      goto __pyx_L17_bool_binop_done;
    }
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_2); 
    __pyx_t_8 = __pyx_t_6;
    __pyx_L17_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_1 = __pyx_t_8;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_1) {

      /* "amplpy/entity.pxi":374
 *                 return
 *             elif pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 df = DataFrame.from_pandas(data, indexarity=self.indexarity())             # <<<<<<<<<<<<<<
 *                 df_c = df.get_ptr()
 *                 errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
*/
      __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_indexarity, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 374, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_data};
        __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 374, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_indexarity, __pyx_t_7, __pyx_t_4, __pyx_callargs+2, 0) < 0) __PYX_ERR(10, 374, __pyx_L1_error)
        __pyx_t_9 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 374, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame))))) __PYX_ERR(10, 374, __pyx_L1_error)
      __pyx_v_df = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_t_9);
      __pyx_t_9 = 0;

      /* "amplpy/entity.pxi":375
 *             elif pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 df = DataFrame.from_pandas(data, indexarity=self.indexarity())
 *                 df_c = df.get_ptr()             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 * 
*/
      __pyx_t_3 = ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame *)__pyx_v_df->__pyx_vtab)->get_ptr(__pyx_v_df); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 375, __pyx_L1_error)
      __pyx_v_df_c = __pyx_t_3;

      /* "amplpy/entity.pxi":376
 *                 df = DataFrame.from_pandas(data, indexarity=self.indexarity())
 *                 df_c = df.get_ptr()
 *                 errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)             # <<<<<<<<<<<<<<
 * 
 *                 campl.AMPL_StringFree(&_name_c)
*/
      __pyx_v_errorinfo = AMPL_EntitySetValues(__pyx_v_self->_ampl->_c_ampl, __pyx_v__name_c, __pyx_v_df_c);

      /* "amplpy/entity.pxi":378
 *                 errorinfo = campl.AMPL_EntitySetValues(self._ampl._c_ampl, _name_c, df_c)
 * 
 *                 campl.AMPL_StringFree(&_name_c)             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      (void)(AMPL_StringFree((&__pyx_v__name_c)));

      /* "amplpy/entity.pxi":379
 * 
 *                 campl.AMPL_StringFree(&_name_c)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *                 return
*/
      __pyx_t_1 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_1) {

        /* "amplpy/entity.pxi":380
 *                 campl.AMPL_StringFree(&_name_c)
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *                 return
 *             raise TypeError(f"Unexpected data type: {type(data)}.")
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 380, __pyx_L1_error)

        /* "amplpy/entity.pxi":379
 * 
 *                 campl.AMPL_StringFree(&_name_c)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *                 return
*/
      }

      /* "amplpy/entity.pxi":381
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *                 return             # <<<<<<<<<<<<<<
 *             raise TypeError(f"Unexpected data type: {type(data)}.")
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "amplpy/entity.pxi":373
 *                     PY_AMPL_CALL(errorinfo)
 *                 return
 *             elif pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 df = DataFrame.from_pandas(data, indexarity=self.indexarity())
 *                 df_c = df.get_ptr()
*/
    }

    /* "amplpy/entity.pxi":382
 *                     PY_AMPL_CALL(errorinfo)
 *                 return
 *             raise TypeError(f"Unexpected data type: {type(data)}.")             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_TypeError);
    __pyx_t_7 = __pyx_builtin_TypeError; 
    __pyx_t_2 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_data)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Unexpected_data_type;
    __pyx_t_11[1] = __pyx_t_2;
    __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u__2;
    __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
    if (unlikely(!__pyx_t_12)) __PYX_ERR(10, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_12};
      __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(10, 382, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "amplpy/entity.pxi":323
 *         return self.get_values().to_list(**kwargs)
 * 
 *     def set_values(self, data):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of this entiy to the correponding values of a
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("amplpy.ampl.Entity.set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_df);
  __Pyx_XDECREF((PyObject *)__pyx_v_data_frame);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_39__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_38__reduce_cython__, "Entity.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_39__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_39__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_38__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_39__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_38__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_38__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Entity.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_41__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6Entity_40__setstate_cython__, "Entity.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_6Entity_41__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_41__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_40__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_6Entity_41__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Entity.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_6Entity_40__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Entity *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6Entity_40__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Entity *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Entity.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":12
 *     cdef campl.AMPL_ENVIRONMENT* _c_env
 * 
 *     def __cinit__(self, binary_directory=None, binary_name=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor with ability to select the location of the AMPL binary.
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_11Environment_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6amplpy_4ampl_11Environment_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_binary_directory = 0;
  PyObject *__pyx_v_binary_name = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_binary_directory,&__pyx_mstate_global->__pyx_n_u_binary_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 12, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(11, 12, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 12, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < 0) __PYX_ERR(11, 12, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(11, 12, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 12, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_binary_directory = values[0];
    __pyx_v_binary_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, __pyx_nargs); __PYX_ERR(11, 12, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Environment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment___cinit__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self), __pyx_v_binary_directory, __pyx_v_binary_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_11Environment___cinit__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_binary_directory, PyObject *__pyx_v_binary_name) {
  PyObject *__pyx_v_option_name = NULL;
  PyObject *__pyx_v_option_value = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  char const *__pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  char const *__pyx_t_11;
  char const *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_binary_directory);
  __Pyx_INCREF(__pyx_v_binary_name);

  /* "amplpy/environment.pxi":22
 *             binary_name: The name of the AMPL executable.
 *         """
 *         if binary_directory is None:             # <<<<<<<<<<<<<<
 *             binary_directory = ""
 *         if binary_name is None:
*/
  __pyx_t_1 = (__pyx_v_binary_directory == Py_None);
  if (__pyx_t_1) {

    /* "amplpy/environment.pxi":23
 *         """
 *         if binary_directory is None:
 *             binary_directory = ""             # <<<<<<<<<<<<<<
 *         if binary_name is None:
 *             binary_name = ""
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__3);
    __Pyx_DECREF_SET(__pyx_v_binary_directory, __pyx_mstate_global->__pyx_kp_u__3);

    /* "amplpy/environment.pxi":22
 *             binary_name: The name of the AMPL executable.
 *         """
 *         if binary_directory is None:             # <<<<<<<<<<<<<<
 *             binary_directory = ""
 *         if binary_name is None:
*/
  }

  /* "amplpy/environment.pxi":24
 *         if binary_directory is None:
 *             binary_directory = ""
 *         if binary_name is None:             # <<<<<<<<<<<<<<
 *             binary_name = ""
 *         campl.AMPL_EnvironmentCreate(&self._c_env, binary_directory.encode('utf-8'), binary_name.encode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_binary_name == Py_None);
  if (__pyx_t_1) {

    /* "amplpy/environment.pxi":25
 *             binary_directory = ""
 *         if binary_name is None:
 *             binary_name = ""             # <<<<<<<<<<<<<<
 *         campl.AMPL_EnvironmentCreate(&self._c_env, binary_directory.encode('utf-8'), binary_name.encode('utf-8'))
 *         if os.name == "nt":
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__3);
    __Pyx_DECREF_SET(__pyx_v_binary_name, __pyx_mstate_global->__pyx_kp_u__3);

    /* "amplpy/environment.pxi":24
 *         if binary_directory is None:
 *             binary_directory = ""
 *         if binary_name is None:             # <<<<<<<<<<<<<<
 *             binary_name = ""
 *         campl.AMPL_EnvironmentCreate(&self._c_env, binary_directory.encode('utf-8'), binary_name.encode('utf-8'))
*/
  }

  /* "amplpy/environment.pxi":26
 *         if binary_name is None:
 *             binary_name = ""
 *         campl.AMPL_EnvironmentCreate(&self._c_env, binary_directory.encode('utf-8'), binary_name.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         if os.name == "nt":
 *             # Workaround for Windows issue with environment variables
*/
  __pyx_t_3 = __pyx_v_binary_directory;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(11, 26, __pyx_L1_error)
  __pyx_t_6 = __pyx_v_binary_name;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(11, 26, __pyx_L1_error)
  (void)(AMPL_EnvironmentCreate((&__pyx_v_self->_c_env), __pyx_t_5, __pyx_t_7));
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":27
 *             binary_name = ""
 *         campl.AMPL_EnvironmentCreate(&self._c_env, binary_directory.encode('utf-8'), binary_name.encode('utf-8'))
 *         if os.name == "nt":             # <<<<<<<<<<<<<<
 *             # Workaround for Windows issue with environment variables
 *             for option_name in ["ampl_libpath", "solver"]:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nt, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(11, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "amplpy/environment.pxi":29
 *         if os.name == "nt":
 *             # Workaround for Windows issue with environment variables
 *             for option_name in ["ampl_libpath", "solver"]:             # <<<<<<<<<<<<<<
 *                 option_value = os.environ.get(option_name, "")
 *                 if option_value:
*/
    __pyx_t_2 = __pyx_mstate_global->__pyx_tuple[1]; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = 0;
    for (;;) {
      if (__pyx_t_8 >= 2) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8));
      #else
      __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8);
      #endif
      ++__pyx_t_8;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_option_name, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "amplpy/environment.pxi":30
 *             # Workaround for Windows issue with environment variables
 *             for option_name in ["ampl_libpath", "solver"]:
 *                 option_value = os.environ.get(option_name, "")             # <<<<<<<<<<<<<<
 *                 if option_value:
 *                     campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, option_name.encode('utf-8'), option_value.encode('utf-8'))
*/
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(11, 30, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_environ); if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 30, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = __pyx_t_10;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_option_name, __pyx_mstate_global->__pyx_kp_u__3};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 30, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_option_value, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "amplpy/environment.pxi":31
 *             for option_name in ["ampl_libpath", "solver"]:
 *                 option_value = os.environ.get(option_name, "")
 *                 if option_value:             # <<<<<<<<<<<<<<
 *                     campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, option_name.encode('utf-8'), option_value.encode('utf-8'))
 * 
*/
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_option_value); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(11, 31, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "amplpy/environment.pxi":32
 *                 option_value = os.environ.get(option_name, "")
 *                 if option_value:
 *                     campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, option_name.encode('utf-8'), option_value.encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 *     cdef campl.AMPL_ENVIRONMENT* get_c_pointer(self):
*/
        if (unlikely(__pyx_v_option_name == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
          __PYX_ERR(11, 32, __pyx_L1_error)
        }
        __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_option_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 32, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = __Pyx_PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(11, 32, __pyx_L1_error)
        __pyx_t_6 = __pyx_v_option_value;
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
          __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(11, 32, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
        }
        __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_10); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(11, 32, __pyx_L1_error)
        (void)(AMPL_EnvironmentAddEnvironmentVariable(__pyx_v_self->_c_env, __pyx_t_11, __pyx_t_12));
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "amplpy/environment.pxi":31
 *             for option_name in ["ampl_libpath", "solver"]:
 *                 option_value = os.environ.get(option_name, "")
 *                 if option_value:             # <<<<<<<<<<<<<<
 *                     campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, option_name.encode('utf-8'), option_value.encode('utf-8'))
 * 
*/
      }

      /* "amplpy/environment.pxi":29
 *         if os.name == "nt":
 *             # Workaround for Windows issue with environment variables
 *             for option_name in ["ampl_libpath", "solver"]:             # <<<<<<<<<<<<<<
 *                 option_value = os.environ.get(option_name, "")
 *                 if option_value:
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/environment.pxi":27
 *             binary_name = ""
 *         campl.AMPL_EnvironmentCreate(&self._c_env, binary_directory.encode('utf-8'), binary_name.encode('utf-8'))
 *         if os.name == "nt":             # <<<<<<<<<<<<<<
 *             # Workaround for Windows issue with environment variables
 *             for option_name in ["ampl_libpath", "solver"]:
*/
  }

  /* "amplpy/environment.pxi":12
 *     cdef campl.AMPL_ENVIRONMENT* _c_env
 * 
 *     def __cinit__(self, binary_directory=None, binary_name=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor with ability to select the location of the AMPL binary.
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("amplpy.ampl.Environment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_option_name);
  __Pyx_XDECREF(__pyx_v_option_value);
  __Pyx_XDECREF(__pyx_v_binary_directory);
  __Pyx_XDECREF(__pyx_v_binary_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":34
 *                     campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, option_name.encode('utf-8'), option_value.encode('utf-8'))
 * 
 *     cdef campl.AMPL_ENVIRONMENT* get_c_pointer(self):             # <<<<<<<<<<<<<<
 *         return self._c_env
 * 
*/

static AMPL_ENVIRONMENT *__pyx_f_6amplpy_4ampl_11Environment_get_c_pointer(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {
  AMPL_ENVIRONMENT *__pyx_r;

  /* "amplpy/environment.pxi":35
 * 
 *     cdef campl.AMPL_ENVIRONMENT* get_c_pointer(self):
 *         return self._c_env             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_r = __pyx_v_self->_c_env;
  goto __pyx_L0;

  /* "amplpy/environment.pxi":34
 *                     campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, option_name.encode('utf-8'), option_value.encode('utf-8'))
 * 
 *     cdef campl.AMPL_ENVIRONMENT* get_c_pointer(self):             # <<<<<<<<<<<<<<
 *         return self._c_env
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "amplpy/environment.pxi":37
 *         return self._c_env
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         campl.AMPL_EnvironmentFree(&self._c_env)
 * 
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_11Environment_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_11Environment_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_11Environment_2__dealloc__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_11Environment_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {

  /* "amplpy/environment.pxi":38
 * 
 *     def __dealloc__(self):
 *         campl.AMPL_EnvironmentFree(&self._c_env)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  (void)(AMPL_EnvironmentFree((&__pyx_v_self->_c_env)));

  /* "amplpy/environment.pxi":37
 *         return self._c_env
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         campl.AMPL_EnvironmentFree(&self._c_env)
 * 
*/

  /* function exit code */
}

/* "amplpy/environment.pxi":40
 *         campl.AMPL_EnvironmentFree(&self._c_env)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_5__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_5__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_4__str__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_4__str__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "amplpy/environment.pxi":41
 * 
 *     def __str__(self):
 *         return self.to_string()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_string, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/environment.pxi":40
 *         campl.AMPL_EnvironmentFree(&self._c_env)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Environment.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":43
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return EnvIterator.create(self._c_env)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_7__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_6__iter__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_6__iter__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/environment.pxi":44
 * 
 *     def __iter__(self):
 *         return EnvIterator.create(self._c_env)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, name, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_11EnvIterator_create(__pyx_v_self->_c_env); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/environment.pxi":43
 *         return self.to_string()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return EnvIterator.create(self._c_env)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Environment.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":46
 *         return EnvIterator.create(self._c_env)
 * 
 *     def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Add an environment variable to the environment, or change its value if
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_11Environment_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_8__setitem__, "Environment.__setitem__(self, name, value)\nAdd an environment variable to the environment, or change its value if\nalready defined.\n\nArgs:\n    name: Name of the environment variable.\n\n    value: Value to be assigned.");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_6amplpy_4ampl_11Environment_8__setitem__;
#endif
static int __pyx_pw_6amplpy_4ampl_11Environment_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_8__setitem__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_11Environment_8__setitem__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  char const *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/environment.pxi":56
 *             value: Value to be assigned.
 *         """
 *         campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, name.encode('utf-8'), value.encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, name):
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(11, 56, __pyx_L1_error)
  __pyx_t_5 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(11, 56, __pyx_L1_error)
  (void)(AMPL_EnvironmentAddEnvironmentVariable(__pyx_v_self->_c_env, __pyx_t_4, __pyx_t_6));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/environment.pxi":46
 *         return EnvIterator.create(self._c_env)
 * 
 *     def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Add an environment variable to the environment, or change its value if
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.Environment.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":58
 *         campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, name.encode('utf-8'), value.encode('utf-8'))
 * 
 *     def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Searches the current object for an environment variable called name and
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_10__getitem__, "Environment.__getitem__(self, name)\nSearches the current object for an environment variable called name and\nreturns an iterator to it if found, otherwise it returns `None`.");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_6amplpy_4ampl_11Environment_10__getitem__;
#endif
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_10__getitem__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_10__getitem__(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_name) {
  AMPL_ENVIRONMENTVAR *__pyx_v_iterator;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/environment.pxi":65
 *         cdef campl.AMPL_ENVIRONMENTVAR* iterator
 *         cdef char* value_c
 *         if not campl.AMPL_EnvironmentFindEnvironmentVar(self._c_env, name.encode('utf-8'), &iterator):             # <<<<<<<<<<<<<<
 *             campl.AMPL_EnvironmentVarGetValue(iterator, &value_c)
 *             value = str(value_c.decode('utf-8'))
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(11, 65, __pyx_L1_error)
  __pyx_t_5 = (!(AMPL_EnvironmentFindEnvironmentVar(__pyx_v_self->_c_env, __pyx_t_4, (&__pyx_v_iterator)) != 0));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "amplpy/environment.pxi":66
 *         cdef char* value_c
 *         if not campl.AMPL_EnvironmentFindEnvironmentVar(self._c_env, name.encode('utf-8'), &iterator):
 *             campl.AMPL_EnvironmentVarGetValue(iterator, &value_c)             # <<<<<<<<<<<<<<
 *             value = str(value_c.decode('utf-8'))
 *             return value
*/
    (void)(AMPL_EnvironmentVarGetValue(__pyx_v_iterator, (&__pyx_v_value_c)));

    /* "amplpy/environment.pxi":67
 *         if not campl.AMPL_EnvironmentFindEnvironmentVar(self._c_env, name.encode('utf-8'), &iterator):
 *             campl.AMPL_EnvironmentVarGetValue(iterator, &value_c)
 *             value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *             return value
 *         else:
*/
    __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(11, 67, __pyx_L1_error)
    __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 67, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_value = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/environment.pxi":68
 *             campl.AMPL_EnvironmentVarGetValue(iterator, &value_c)
 *             value = str(value_c.decode('utf-8'))
 *             return value             # <<<<<<<<<<<<<<
 *         else:
 *             return None
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;

    /* "amplpy/environment.pxi":65
 *         cdef campl.AMPL_ENVIRONMENTVAR* iterator
 *         cdef char* value_c
 *         if not campl.AMPL_EnvironmentFindEnvironmentVar(self._c_env, name.encode('utf-8'), &iterator):             # <<<<<<<<<<<<<<
 *             campl.AMPL_EnvironmentVarGetValue(iterator, &value_c)
 *             value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/environment.pxi":70
 *             return value
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def to_string(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "amplpy/environment.pxi":58
 *         campl.AMPL_EnvironmentAddEnvironmentVariable(self._c_env, name.encode('utf-8'), value.encode('utf-8'))
 * 
 *     def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Searches the current object for an environment variable called name and
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Environment.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":72
 *             return None
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef char* to_string_c
 *         campl.AMPL_EnvironmentToString(self._c_env, &to_string_c)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_13to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_12to_string, "Environment.to_string(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11Environment_13to_string = {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_13to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_12to_string};
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_13to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_string", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_string", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_12to_string(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_12to_string(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {
  char *__pyx_v_to_string_c;
  PyObject *__pyx_v_to_string = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_string", 0);

  /* "amplpy/environment.pxi":74
 *     def to_string(self):
 *         cdef char* to_string_c
 *         campl.AMPL_EnvironmentToString(self._c_env, &to_string_c)             # <<<<<<<<<<<<<<
 *         to_string = str(to_string_c.decode('utf-8'))
 *         return to_string
*/
  (void)(AMPL_EnvironmentToString(__pyx_v_self->_c_env, (&__pyx_v_to_string_c)));

  /* "amplpy/environment.pxi":75
 *         cdef char* to_string_c
 *         campl.AMPL_EnvironmentToString(self._c_env, &to_string_c)
 *         to_string = str(to_string_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         return to_string
 * 
*/
  __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_to_string_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(11, 75, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_to_string_c, 0, __pyx_t_1, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_to_string = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/environment.pxi":76
 *         campl.AMPL_EnvironmentToString(self._c_env, &to_string_c)
 *         to_string = str(to_string_c.decode('utf-8'))
 *         return to_string             # <<<<<<<<<<<<<<
 * 
 *     def set_bin_dir(self, binary_directory):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_to_string);
  __pyx_r = __pyx_v_to_string;
  goto __pyx_L0;

  /* "amplpy/environment.pxi":72
 *             return None
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef char* to_string_c
 *         campl.AMPL_EnvironmentToString(self._c_env, &to_string_c)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Environment.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_to_string);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":78
 *         return to_string
 * 
 *     def set_bin_dir(self, binary_directory):             # <<<<<<<<<<<<<<
 *         """
 *         Set the location where AMPL API will search for the AMPL executable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_15set_bin_dir(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_14set_bin_dir, "Environment.set_bin_dir(self, binary_directory)\nSet the location where AMPL API will search for the AMPL executable.\n\nArgs:\n    binary_directory: The directory in which look for the AMPL executable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11Environment_15set_bin_dir = {"set_bin_dir", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_15set_bin_dir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_14set_bin_dir};
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_15set_bin_dir(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_binary_directory = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_bin_dir (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_binary_directory,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 78, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 78, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_bin_dir", 0) < 0) __PYX_ERR(11, 78, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_bin_dir", 1, 1, 1, i); __PYX_ERR(11, 78, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 78, __pyx_L3_error)
    }
    __pyx_v_binary_directory = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_bin_dir", 1, 1, 1, __pyx_nargs); __PYX_ERR(11, 78, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Environment.set_bin_dir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_14set_bin_dir(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self), __pyx_v_binary_directory);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_14set_bin_dir(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_binary_directory) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_bin_dir", 0);

  /* "amplpy/environment.pxi":85
 *             binary_directory: The directory in which look for the AMPL executable.
 *         """
 *         campl.AMPL_EnvironmentSetBinaryDirectory(self._c_env, binary_directory.encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 *     def get_bin_dir(self):
*/
  __pyx_t_2 = __pyx_v_binary_directory;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(11, 85, __pyx_L1_error)
  (void)(AMPL_EnvironmentSetBinaryDirectory(__pyx_v_self->_c_env, __pyx_t_4));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/environment.pxi":78
 *         return to_string
 * 
 *     def set_bin_dir(self, binary_directory):             # <<<<<<<<<<<<<<
 *         """
 *         Set the location where AMPL API will search for the AMPL executable.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Environment.set_bin_dir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":87
 *         campl.AMPL_EnvironmentSetBinaryDirectory(self._c_env, binary_directory.encode('utf-8'))
 * 
 *     def get_bin_dir(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the location where AMPL API will search for the AMPL executable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_17get_bin_dir(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_16get_bin_dir, "Environment.get_bin_dir(self)\nGet the location where AMPL API will search for the AMPL executable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11Environment_17get_bin_dir = {"get_bin_dir", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_17get_bin_dir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_16get_bin_dir};
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_17get_bin_dir(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_bin_dir (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_bin_dir", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_bin_dir", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_16get_bin_dir(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_16get_bin_dir(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {
  char *__pyx_v_bin_dir_c;
  PyObject *__pyx_v_bin_dir = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_bin_dir", 0);

  /* "amplpy/environment.pxi":92
 *         """
 *         cdef char* bin_dir_c
 *         campl.AMPL_EnvironmentGetBinaryDirectory(self._c_env, &bin_dir_c)             # <<<<<<<<<<<<<<
 *         bin_dir = str(bin_dir_c.decode('utf-8'))
 *         return bin_dir
*/
  (void)(AMPL_EnvironmentGetBinaryDirectory(__pyx_v_self->_c_env, (&__pyx_v_bin_dir_c)));

  /* "amplpy/environment.pxi":93
 *         cdef char* bin_dir_c
 *         campl.AMPL_EnvironmentGetBinaryDirectory(self._c_env, &bin_dir_c)
 *         bin_dir = str(bin_dir_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         return bin_dir
 * 
*/
  __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_bin_dir_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(11, 93, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_bin_dir_c, 0, __pyx_t_1, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bin_dir = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/environment.pxi":94
 *         campl.AMPL_EnvironmentGetBinaryDirectory(self._c_env, &bin_dir_c)
 *         bin_dir = str(bin_dir_c.decode('utf-8'))
 *         return bin_dir             # <<<<<<<<<<<<<<
 * 
 *     def set_bin_name(self, binary_name):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_bin_dir);
  __pyx_r = __pyx_v_bin_dir;
  goto __pyx_L0;

  /* "amplpy/environment.pxi":87
 *         campl.AMPL_EnvironmentSetBinaryDirectory(self._c_env, binary_directory.encode('utf-8'))
 * 
 *     def get_bin_dir(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the location where AMPL API will search for the AMPL executable.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Environment.get_bin_dir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bin_dir);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":96
 *         return bin_dir
 * 
 *     def set_bin_name(self, binary_name):             # <<<<<<<<<<<<<<
 *         """
 *         Set the name of the AMPL executable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_19set_bin_name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_18set_bin_name, "Environment.set_bin_name(self, binary_name)\nSet the name of the AMPL executable.\n\nArgs:\n    binary_name: The name of the AMPL executable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11Environment_19set_bin_name = {"set_bin_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_19set_bin_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_18set_bin_name};
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_19set_bin_name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_binary_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_bin_name (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_binary_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(11, 96, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 96, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_bin_name", 0) < 0) __PYX_ERR(11, 96, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_bin_name", 1, 1, 1, i); __PYX_ERR(11, 96, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(11, 96, __pyx_L3_error)
    }
    __pyx_v_binary_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_bin_name", 1, 1, 1, __pyx_nargs); __PYX_ERR(11, 96, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Environment.set_bin_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_18set_bin_name(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self), __pyx_v_binary_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_18set_bin_name(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, PyObject *__pyx_v_binary_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_bin_name", 0);

  /* "amplpy/environment.pxi":103
 *             binary_name: The name of the AMPL executable.
 *         """
 *         campl.AMPL_EnvironmentSetBinaryName(self._c_env, binary_name.encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 *     def get_bin_name(self):
*/
  __pyx_t_2 = __pyx_v_binary_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(11, 103, __pyx_L1_error)
  (void)(AMPL_EnvironmentSetBinaryName(__pyx_v_self->_c_env, __pyx_t_4));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/environment.pxi":96
 *         return bin_dir
 * 
 *     def set_bin_name(self, binary_name):             # <<<<<<<<<<<<<<
 *         """
 *         Set the name of the AMPL executable.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Environment.set_bin_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/environment.pxi":105
 *         campl.AMPL_EnvironmentSetBinaryName(self._c_env, binary_name.encode('utf-8'))
 * 
 *     def get_bin_name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of the AMPL executable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_21get_bin_name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_20get_bin_name, "Environment.get_bin_name(self)\nGet the name of the AMPL executable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11Environment_21get_bin_name = {"get_bin_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_21get_bin_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_20get_bin_name};
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_21get_bin_name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_bin_name (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_bin_name", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_bin_name", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_20get_bin_name(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_20get_bin_name(struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {
  char *__pyx_v_bin_name_c;
  PyObject *__pyx_v_bin_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_bin_name", 0);

  /* "amplpy/environment.pxi":110
 *         """
 *         cdef char* bin_name_c
 *         campl.AMPL_EnvironmentGetBinaryName(self._c_env, &bin_name_c)             # <<<<<<<<<<<<<<
 *         bin_name = str(bin_name_c.decode('utf-8'))
 *         return bin_name
*/
  (void)(AMPL_EnvironmentGetBinaryName(__pyx_v_self->_c_env, (&__pyx_v_bin_name_c)));

  /* "amplpy/environment.pxi":111
 *         cdef char* bin_name_c
 *         campl.AMPL_EnvironmentGetBinaryName(self._c_env, &bin_name_c)
 *         bin_name = str(bin_name_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         return bin_name
 * 
*/
  __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_bin_name_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(11, 111, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_bin_name_c, 0, __pyx_t_1, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bin_name = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/environment.pxi":112
 *         campl.AMPL_EnvironmentGetBinaryName(self._c_env, &bin_name_c)
 *         bin_name = str(bin_name_c.decode('utf-8'))
 *         return bin_name             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_bin_name);
  __pyx_r = __pyx_v_bin_name;
  goto __pyx_L0;

  /* "amplpy/environment.pxi":105
 *         campl.AMPL_EnvironmentSetBinaryName(self._c_env, binary_name.encode('utf-8'))
 * 
 *     def get_bin_name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of the AMPL executable.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Environment.get_bin_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bin_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_23__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_22__reduce_cython__, "Environment.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11Environment_23__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_23__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_22__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_23__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_22__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Environment.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_25__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11Environment_24__setstate_cython__, "Environment.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11Environment_25__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_25__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_24__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11Environment_25__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Environment.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_11Environment_24__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11Environment_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Environment.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/errorhandler.pxi":19
 *     logger.propagate = False
 * 
 * def display_error_message(exception, error=True):             # <<<<<<<<<<<<<<
 *     logger.setLevel(logging.WARNING)
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_1display_error_message(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_display_error_message, "display_error_message(exception, error=True)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_1display_error_message = {"display_error_message", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_1display_error_message, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_display_error_message};
static PyObject *__pyx_pw_6amplpy_4ampl_1display_error_message(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_exception = 0;
  PyObject *__pyx_v_error = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("display_error_message (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exception,&__pyx_mstate_global->__pyx_n_u_error,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 19, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 19, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 19, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "display_error_message", 0) < 0) __PYX_ERR(12, 19, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject *)Py_True)));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("display_error_message", 0, 1, 2, i); __PYX_ERR(12, 19, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(12, 19, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 19, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)((PyObject *)Py_True)));
    }
    __pyx_v_exception = values[0];
    __pyx_v_error = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("display_error_message", 0, 1, 2, __pyx_nargs); __PYX_ERR(12, 19, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.display_error_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_display_error_message(__pyx_self, __pyx_v_exception, __pyx_v_error);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_display_error_message(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_exception, PyObject *__pyx_v_error) {
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("display_error_message", 0);

  /* "amplpy/errorhandler.pxi":20
 * 
 * def display_error_message(exception, error=True):
 *     logger.setLevel(logging.WARNING)             # <<<<<<<<<<<<<<
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")
 *     if error:
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setLevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_WARNING); if (unlikely(!__pyx_t_5)) __PYX_ERR(12, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/errorhandler.pxi":21
 * def display_error_message(exception, error=True):
 *     logger.setLevel(logging.WARNING)
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")             # <<<<<<<<<<<<<<
 *     if error:
 *         logger.error(f"\n{msg}")
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_SUPPORT_MESSAGE); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyUnicode_Replace(((PyObject*)__pyx_t_1), __pyx_t_4, __pyx_mstate_global->__pyx_kp_u__3, -1L); if (unlikely(!__pyx_t_5)) __PYX_ERR(12, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyUnicode_Replace(((PyObject*)__pyx_t_5), __pyx_mstate_global->__pyx_kp_u__5, __pyx_mstate_global->__pyx_kp_u__6, -1L); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u__4, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(12, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_msg = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "amplpy/errorhandler.pxi":22
 *     logger.setLevel(logging.WARNING)
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")
 *     if error:             # <<<<<<<<<<<<<<
 *         logger.error(f"\n{msg}")
 *     else:
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_error); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(12, 22, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "amplpy/errorhandler.pxi":23
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")
 *     if error:
 *         logger.error(f"\n{msg}")             # <<<<<<<<<<<<<<
 *     else:
 *         logger.warning(f"\n{msg}")
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u__5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 23, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(12, 23, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "amplpy/errorhandler.pxi":22
 *     logger.setLevel(logging.WARNING)
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")
 *     if error:             # <<<<<<<<<<<<<<
 *         logger.error(f"\n{msg}")
 *     else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/errorhandler.pxi":25
 *         logger.error(f"\n{msg}")
 *     else:
 *         logger.warning(f"\n{msg}")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_warning); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u__5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(12, 25, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "amplpy/errorhandler.pxi":19
 *     logger.propagate = False
 * 
 * def display_error_message(exception, error=True):             # <<<<<<<<<<<<<<
 *     logger.setLevel(logging.WARNING)
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.display_error_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/errorhandler.pxi":38
 *     """
 * 
 *     def error(self, exception):             # <<<<<<<<<<<<<<
 *         """
 *         Receives notification of an error.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_1error(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_12ErrorHandler_error, "ErrorHandler.error(self, exception)\nReceives notification of an error.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_12ErrorHandler_1error = {"error", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_1error, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_error};
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_1error(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_exception = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("error (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exception,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 38, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 38, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "error", 0) < 0) __PYX_ERR(12, 38, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("error", 1, 1, 1, i); __PYX_ERR(12, 38, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 38, __pyx_L3_error)
    }
    __pyx_v_exception = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("error", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 38, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.ErrorHandler.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_12ErrorHandler_error(((struct __pyx_obj_6amplpy_4ampl_ErrorHandler *)__pyx_v_self), __pyx_v_exception);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_error(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("error", 0);

  /* "amplpy/errorhandler.pxi":42
 *         Receives notification of an error.
 *         """
 *         display_error_message(exception)             # <<<<<<<<<<<<<<
 *         raise exception
 * 
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_display_error_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_exception};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/errorhandler.pxi":43
 *         """
 *         display_error_message(exception)
 *         raise exception             # <<<<<<<<<<<<<<
 * 
 *     def warning(self, exception):
*/
  __Pyx_Raise(__pyx_v_exception, 0, 0, 0);
  __PYX_ERR(12, 43, __pyx_L1_error)

  /* "amplpy/errorhandler.pxi":38
 *     """
 * 
 *     def error(self, exception):             # <<<<<<<<<<<<<<
 *         """
 *         Receives notification of an error.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.ErrorHandler.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/errorhandler.pxi":45
 *         raise exception
 * 
 *     def warning(self, exception):             # <<<<<<<<<<<<<<
 *         """
 *         Receives notification of a warning.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_3warning(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_12ErrorHandler_2warning, "ErrorHandler.warning(self, exception)\nReceives notification of a warning.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_12ErrorHandler_3warning = {"warning", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_3warning, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_2warning};
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_3warning(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_exception = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("warning (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exception,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(12, 45, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 45, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "warning", 0) < 0) __PYX_ERR(12, 45, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("warning", 1, 1, 1, i); __PYX_ERR(12, 45, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(12, 45, __pyx_L3_error)
    }
    __pyx_v_exception = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("warning", 1, 1, 1, __pyx_nargs); __PYX_ERR(12, 45, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.ErrorHandler.warning", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_12ErrorHandler_2warning(((struct __pyx_obj_6amplpy_4ampl_ErrorHandler *)__pyx_v_self), __pyx_v_exception);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_2warning(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("warning", 0);

  /* "amplpy/errorhandler.pxi":49
 *         Receives notification of a warning.
 *         """
 *         display_error_message(exception, error=False)             # <<<<<<<<<<<<<<
 *         raise exception
 * 
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_display_error_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_exception};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(12, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_error, Py_False, __pyx_t_5, __pyx_callargs+2, 0) < 0) __PYX_ERR(12, 49, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/errorhandler.pxi":50
 *         """
 *         display_error_message(exception, error=False)
 *         raise exception             # <<<<<<<<<<<<<<
 * 
 * cdef void PyError(bool_c isWarning, const char* filename, int row, int offset, const char* message, void* errorHandler) except * with gil:
*/
  __Pyx_Raise(__pyx_v_exception, 0, 0, 0);
  __PYX_ERR(12, 50, __pyx_L1_error)

  /* "amplpy/errorhandler.pxi":45
 *         raise exception
 * 
 *     def warning(self, exception):             # <<<<<<<<<<<<<<
 *         """
 *         Receives notification of a warning.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.ErrorHandler.warning", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_12ErrorHandler_4__reduce_cython__, "ErrorHandler.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_12ErrorHandler_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_4__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_12ErrorHandler_4__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_ErrorHandler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_4__reduce_cython__(struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
  __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(8, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, None), state
*/
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ErrorHandler); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, None), state
 *     else:
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ErrorHandler__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ErrorHandler); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.ErrorHandler.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ErrorHandler__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_12ErrorHandler_6__setstate_cython__, "ErrorHandler.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_12ErrorHandler_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_6__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_12ErrorHandler_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.ErrorHandler.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_12ErrorHandler_6__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_ErrorHandler *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_12ErrorHandler_6__setstate_cython__(struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ErrorHandler__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(8, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6amplpy_4ampl___pyx_unpickle_ErrorHandler__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ErrorHandler__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.ErrorHandler.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/errorhandler.pxi":52
 *         raise exception
 * 
 * cdef void PyError(bool_c isWarning, const char* filename, int row, int offset, const char* message, void* errorHandler) except * with gil:             # <<<<<<<<<<<<<<
 *     handler = <ErrorHandler>errorHandler
 *     if isWarning:
*/

static void __pyx_f_6amplpy_4ampl_PyError(bool __pyx_v_isWarning, char const *__pyx_v_filename, int __pyx_v_row, int __pyx_v_offset, char const *__pyx_v_message, void *__pyx_v_errorHandler) {
  struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v_handler = NULL;
  struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_exception = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("PyError", 0);

  /* "amplpy/errorhandler.pxi":53
 * 
 * cdef void PyError(bool_c isWarning, const char* filename, int row, int offset, const char* message, void* errorHandler) except * with gil:
 *     handler = <ErrorHandler>errorHandler             # <<<<<<<<<<<<<<
 *     if isWarning:
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, message.decode('utf-8'))
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_errorHandler);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_handler = ((struct __pyx_obj_6amplpy_4ampl_ErrorHandler *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/errorhandler.pxi":54
 * cdef void PyError(bool_c isWarning, const char* filename, int row, int offset, const char* message, void* errorHandler) except * with gil:
 *     handler = <ErrorHandler>errorHandler
 *     if isWarning:             # <<<<<<<<<<<<<<
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, message.decode('utf-8'))
 *         handler.warning(exception)
*/
  __pyx_t_2 = (__pyx_v_isWarning != 0);
  if (__pyx_t_2) {

    /* "amplpy/errorhandler.pxi":55
 *     handler = <ErrorHandler>errorHandler
 *     if isWarning:
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, message.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         handler.warning(exception)
 *     else:
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException);
    __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException); 
    __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_filename); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(12, 55, __pyx_L1_error)
    __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_filename, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(12, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_row); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_8)) __PYX_ERR(12, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(12, 55, __pyx_L1_error)
    __pyx_t_9 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_9)) __PYX_ERR(12, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_10, (5-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 55, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __pyx_v_exception = ((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/errorhandler.pxi":56
 *     if isWarning:
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, message.decode('utf-8'))
 *         handler.warning(exception)             # <<<<<<<<<<<<<<
 *     else:
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, f"{message.decode('utf-8')}{_SUPPORT_MESSAGE}")
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_handler);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_10 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_exception)};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_warning, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 56, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/errorhandler.pxi":54
 * cdef void PyError(bool_c isWarning, const char* filename, int row, int offset, const char* message, void* errorHandler) except * with gil:
 *     handler = <ErrorHandler>errorHandler
 *     if isWarning:             # <<<<<<<<<<<<<<
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, message.decode('utf-8'))
 *         handler.warning(exception)
*/
    goto __pyx_L3;
  }

  /* "amplpy/errorhandler.pxi":58
 *         handler.warning(exception)
 *     else:
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, f"{message.decode('utf-8')}{_SUPPORT_MESSAGE}")             # <<<<<<<<<<<<<<
 *         handler.error(exception)
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException);
    __pyx_t_9 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException); 
    __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_filename); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(12, 58, __pyx_L1_error)
    __pyx_t_8 = __Pyx_decode_c_string(__pyx_v_filename, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_8)) __PYX_ERR(12, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_row); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_6)) __PYX_ERR(12, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_ssize_strlen(__pyx_v_message); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(12, 58, __pyx_L1_error)
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_message, 0, __pyx_t_5, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_SUPPORT_MESSAGE); if (unlikely(!__pyx_t_11)) __PYX_ERR(12, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(12, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(12, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_4, __pyx_t_8, __pyx_t_7, __pyx_t_6, __pyx_t_11};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_10, (5-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 58, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __pyx_v_exception = ((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/errorhandler.pxi":59
 *     else:
 *         exception = AMPLException(filename.decode('utf-8'), row, offset, f"{message.decode('utf-8')}{_SUPPORT_MESSAGE}")
 *         handler.error(exception)             # <<<<<<<<<<<<<<
*/
    __pyx_t_9 = ((PyObject *)__pyx_v_handler);
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_10 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, ((PyObject *)__pyx_v_exception)};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_error, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 59, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "amplpy/errorhandler.pxi":52
 *         raise exception
 * 
 * cdef void PyError(bool_c isWarning, const char* filename, int row, int offset, const char* message, void* errorHandler) except * with gil:             # <<<<<<<<<<<<<<
 *     handler = <ErrorHandler>errorHandler
 *     if isWarning:
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("amplpy.ampl.PyError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_handler);
  __Pyx_XDECREF((PyObject *)__pyx_v_exception);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "amplpy/exceptions.pxi":9
 *     """
 * 
 *     def __init__(self, source_name, line_number, offset, message):             # <<<<<<<<<<<<<<
 *         super(AMPLException, self).__init__()
 *         self.source_name = source_name
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_13AMPLException_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6amplpy_4ampl_13AMPLException_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source_name = 0;
  PyObject *__pyx_v_line_number = 0;
  PyObject *__pyx_v_offset = 0;
  PyObject *__pyx_v_message = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_source_name,&__pyx_mstate_global->__pyx_n_u_line_number,&__pyx_mstate_global->__pyx_n_u_offset,&__pyx_mstate_global->__pyx_n_u_message,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(2, 9, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 9, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 9, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 9, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 9, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(2, 9, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, i); __PYX_ERR(2, 9, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(2, 9, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(2, 9, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(2, 9, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(2, 9, __pyx_L3_error)
    }
    __pyx_v_source_name = values[0];
    __pyx_v_line_number = values[1];
    __pyx_v_offset = values[2];
    __pyx_v_message = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, __pyx_nargs); __PYX_ERR(2, 9, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException___init__(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self), __pyx_v_source_name, __pyx_v_line_number, __pyx_v_offset, __pyx_v_message);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_13AMPLException___init__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self, PyObject *__pyx_v_source_name, PyObject *__pyx_v_line_number, PyObject *__pyx_v_offset, PyObject *__pyx_v_message) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/exceptions.pxi":10
 * 
 *     def __init__(self, source_name, line_number, offset, message):
 *         super(AMPLException, self).__init__()             # <<<<<<<<<<<<<<
 *         self.source_name = source_name
 *         self.line_number = line_number
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF(__pyx_builtin_super);
  __pyx_t_5 = __pyx_builtin_super; 
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException), ((PyObject *)__pyx_v_self)};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/exceptions.pxi":11
 *     def __init__(self, source_name, line_number, offset, message):
 *         super(AMPLException, self).__init__()
 *         self.source_name = source_name             # <<<<<<<<<<<<<<
 *         self.line_number = line_number
 *         self.offset = offset
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_source_name, __pyx_v_source_name) < 0) __PYX_ERR(2, 11, __pyx_L1_error)

  /* "amplpy/exceptions.pxi":12
 *         super(AMPLException, self).__init__()
 *         self.source_name = source_name
 *         self.line_number = line_number             # <<<<<<<<<<<<<<
 *         self.offset = offset
 *         self.message = message
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_line_number, __pyx_v_line_number) < 0) __PYX_ERR(2, 12, __pyx_L1_error)

  /* "amplpy/exceptions.pxi":13
 *         self.source_name = source_name
 *         self.line_number = line_number
 *         self.offset = offset             # <<<<<<<<<<<<<<
 *         self.message = message
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_offset, __pyx_v_offset) < 0) __PYX_ERR(2, 13, __pyx_L1_error)

  /* "amplpy/exceptions.pxi":14
 *         self.line_number = line_number
 *         self.offset = offset
 *         self.message = message             # <<<<<<<<<<<<<<
 * 
 *     def get_source_name(self):
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_message, __pyx_v_message) < 0) __PYX_ERR(2, 14, __pyx_L1_error)

  /* "amplpy/exceptions.pxi":9
 *     """
 * 
 *     def __init__(self, source_name, line_number, offset, message):             # <<<<<<<<<<<<<<
 *         super(AMPLException, self).__init__()
 *         self.source_name = source_name
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/exceptions.pxi":16
 *         self.message = message
 * 
 *     def get_source_name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of the file where the error was detected.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_3get_source_name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13AMPLException_2get_source_name, "AMPLException.get_source_name(self)\nGet the name of the file where the error was detected.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13AMPLException_3get_source_name = {"get_source_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_3get_source_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_2get_source_name};
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_3get_source_name(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_source_name (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_source_name", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_source_name", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException_2get_source_name(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_2get_source_name(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_source_name", 0);

  /* "amplpy/exceptions.pxi":20
 *         Get the name of the file where the error was detected.
 *         """
 *         return self.source_name             # <<<<<<<<<<<<<<
 * 
 *     def get_line_number(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_source_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/exceptions.pxi":16
 *         self.message = message
 * 
 *     def get_source_name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of the file where the error was detected.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.get_source_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/exceptions.pxi":22
 *         return self.source_name
 * 
 *     def get_line_number(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the row where the error is located.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_5get_line_number(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13AMPLException_4get_line_number, "AMPLException.get_line_number(self)\nGet the row where the error is located.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13AMPLException_5get_line_number = {"get_line_number", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_5get_line_number, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_4get_line_number};
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_5get_line_number(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_line_number (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_line_number", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_line_number", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException_4get_line_number(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_4get_line_number(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_line_number", 0);

  /* "amplpy/exceptions.pxi":26
 *         Get the row where the error is located.
 *         """
 *         return self.line_number             # <<<<<<<<<<<<<<
 * 
 *     def get_offset(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_line_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/exceptions.pxi":22
 *         return self.source_name
 * 
 *     def get_line_number(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the row where the error is located.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.get_line_number", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/exceptions.pxi":28
 *         return self.line_number
 * 
 *     def get_offset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the offset where the error is located.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_7get_offset(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13AMPLException_6get_offset, "AMPLException.get_offset(self)\nGet the offset where the error is located.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13AMPLException_7get_offset = {"get_offset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_7get_offset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_6get_offset};
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_7get_offset(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_offset (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_offset", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_offset", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException_6get_offset(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_6get_offset(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_offset", 0);

  /* "amplpy/exceptions.pxi":32
 *         Get the offset where the error is located.
 *         """
 *         return self.offset             # <<<<<<<<<<<<<<
 * 
 *     def get_message(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/exceptions.pxi":28
 *         return self.line_number
 * 
 *     def get_offset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the offset where the error is located.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.get_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/exceptions.pxi":34
 *         return self.offset
 * 
 *     def get_message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the error message.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_9get_message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13AMPLException_8get_message, "AMPLException.get_message(self)\nGet the error message.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13AMPLException_9get_message = {"get_message", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_9get_message, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_8get_message};
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_9get_message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_message (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_message", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_message", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException_8get_message(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_8get_message(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_message", 0);

  /* "amplpy/exceptions.pxi":38
 *         Get the error message.
 *         """
 *         return self.message             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/exceptions.pxi":34
 *         return self.offset
 * 
 *     def get_message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the error message.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.get_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/exceptions.pxi":40
 *         return self.message
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         if self.offset == -1:
 *             return self.message
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_11__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_11__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException_10__str__(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_10__str__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "amplpy/exceptions.pxi":41
 * 
 *     def __str__(self):
 *         if self.offset == -1:             # <<<<<<<<<<<<<<
 *             return self.message
 *         elif self.source_name == "-":
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_neg_1, -1L, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "amplpy/exceptions.pxi":42
 *     def __str__(self):
 *         if self.offset == -1:
 *             return self.message             # <<<<<<<<<<<<<<
 *         elif self.source_name == "-":
 *             return "line " + str(self.line_number) + " offset " + str(self.offset) + "\n" + self.message
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/exceptions.pxi":41
 * 
 *     def __str__(self):
 *         if self.offset == -1:             # <<<<<<<<<<<<<<
 *             return self.message
 *         elif self.source_name == "-":
*/
  }

  /* "amplpy/exceptions.pxi":43
 *         if self.offset == -1:
 *             return self.message
 *         elif self.source_name == "-":             # <<<<<<<<<<<<<<
 *             return "line " + str(self.line_number) + " offset " + str(self.offset) + "\n" + self.message
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_source_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u__7, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(2, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "amplpy/exceptions.pxi":44
 *             return self.message
 *         elif self.source_name == "-":
 *             return "line " + str(self.line_number) + " offset " + str(self.offset) + "\n" + self.message             # <<<<<<<<<<<<<<
 *         else:
 *             return self.source_name + "\nline " + str(self.line_number) + " offset " + str(self.offset) + "\n" + self.message
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_line_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_line, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_offset_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u__5); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "amplpy/exceptions.pxi":43
 *         if self.offset == -1:
 *             return self.message
 *         elif self.source_name == "-":             # <<<<<<<<<<<<<<
 *             return "line " + str(self.line_number) + " offset " + str(self.offset) + "\n" + self.message
 *         else:
*/
  }

  /* "amplpy/exceptions.pxi":46
 *             return "line " + str(self.line_number) + " offset " + str(self.offset) + "\n" + self.message
 *         else:
 *             return self.source_name + "\nline " + str(self.line_number) + " offset " + str(self.offset) + "\n" + self.message             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_source_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_line_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_line_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_offset_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "amplpy/exceptions.pxi":40
 *         return self.message
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         if self.offset == -1:
 *             return self.message
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13AMPLException_12__reduce_cython__, "AMPLException.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13AMPLException_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_12__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException_12__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_12__reduce_cython__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
  __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(8, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, None), state
*/
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_AMPLException); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, None), state
 *     else:
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_AMPLException__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_AMPLException); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_AMPLException__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13AMPLException_14__setstate_cython__, "AMPLException.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13AMPLException_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_14__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_13AMPLException_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_13AMPLException_14__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13AMPLException_14__setstate_cython__(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_AMPLException__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(8, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6amplpy_4ampl___pyx_unpickle_AMPLException__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_AMPLException__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPLException.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":7
 *     cdef campl.AMPL_ENVIRONMENTVAR* iterator
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_ENVIRONMENT* env_c):
 *         envit = EnvIterator()
*/

static PyObject *__pyx_f_6amplpy_4ampl_11EnvIterator_create(AMPL_ENVIRONMENT *__pyx_v_env_c) {
  struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_envit = NULL;
  size_t __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  AMPL_ENVIRONMENTVAR *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/iterators.pxi":9
 *     @staticmethod
 *     cdef create(campl.AMPL_ENVIRONMENT* env_c):
 *         envit = EnvIterator()             # <<<<<<<<<<<<<<
 *         envit.env_c = env_c
 *         envit.begin = NULL
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_EnvIterator);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_EnvIterator); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 9, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_envit = ((struct __pyx_obj_6amplpy_4ampl_EnvIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/iterators.pxi":10
 *     cdef create(campl.AMPL_ENVIRONMENT* env_c):
 *         envit = EnvIterator()
 *         envit.env_c = env_c             # <<<<<<<<<<<<<<
 *         envit.begin = NULL
 *         envit.end = NULL
*/
  __pyx_v_envit->env_c = __pyx_v_env_c;

  /* "amplpy/iterators.pxi":11
 *         envit = EnvIterator()
 *         envit.env_c = env_c
 *         envit.begin = NULL             # <<<<<<<<<<<<<<
 *         envit.end = NULL
 *         envit.iterator = NULL
*/
  __pyx_v_envit->begin = NULL;

  /* "amplpy/iterators.pxi":12
 *         envit.env_c = env_c
 *         envit.begin = NULL
 *         envit.end = NULL             # <<<<<<<<<<<<<<
 *         envit.iterator = NULL
 *         campl.AMPL_EnvironmentGetEnvironmentVar(envit.env_c, &envit.begin)
*/
  __pyx_v_envit->end = NULL;

  /* "amplpy/iterators.pxi":13
 *         envit.begin = NULL
 *         envit.end = NULL
 *         envit.iterator = NULL             # <<<<<<<<<<<<<<
 *         campl.AMPL_EnvironmentGetEnvironmentVar(envit.env_c, &envit.begin)
 *         cdef size_t size
*/
  __pyx_v_envit->iterator = NULL;

  /* "amplpy/iterators.pxi":14
 *         envit.end = NULL
 *         envit.iterator = NULL
 *         campl.AMPL_EnvironmentGetEnvironmentVar(envit.env_c, &envit.begin)             # <<<<<<<<<<<<<<
 *         cdef size_t size
 *         campl.AMPL_EnvironmentGetSize(envit.env_c, &size)
*/
  (void)(AMPL_EnvironmentGetEnvironmentVar(__pyx_v_envit->env_c, (&__pyx_v_envit->begin)));

  /* "amplpy/iterators.pxi":16
 *         campl.AMPL_EnvironmentGetEnvironmentVar(envit.env_c, &envit.begin)
 *         cdef size_t size
 *         campl.AMPL_EnvironmentGetSize(envit.env_c, &size)             # <<<<<<<<<<<<<<
 *         envit.end = envit.begin + size
 *         envit.iterator = envit.begin
*/
  (void)(AMPL_EnvironmentGetSize(__pyx_v_envit->env_c, (&__pyx_v_size)));

  /* "amplpy/iterators.pxi":17
 *         cdef size_t size
 *         campl.AMPL_EnvironmentGetSize(envit.env_c, &size)
 *         envit.end = envit.begin + size             # <<<<<<<<<<<<<<
 *         envit.iterator = envit.begin
 *         return envit
*/
  __pyx_v_envit->end = (__pyx_v_envit->begin + __pyx_v_size);

  /* "amplpy/iterators.pxi":18
 *         campl.AMPL_EnvironmentGetSize(envit.env_c, &size)
 *         envit.end = envit.begin + size
 *         envit.iterator = envit.begin             # <<<<<<<<<<<<<<
 *         return envit
 * 
*/
  __pyx_t_5 = __pyx_v_envit->begin;
  __pyx_v_envit->iterator = __pyx_t_5;

  /* "amplpy/iterators.pxi":19
 *         envit.end = envit.begin + size
 *         envit.iterator = envit.begin
 *         return envit             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_envit);
  __pyx_r = ((PyObject *)__pyx_v_envit);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":7
 *     cdef campl.AMPL_ENVIRONMENTVAR* iterator
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_ENVIRONMENT* env_c):
 *         envit = EnvIterator()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.EnvIterator.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_envit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":21
 *         return envit
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_1__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11EnvIterator___iter__(((struct __pyx_obj_6amplpy_4ampl_EnvIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator___iter__(struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/iterators.pxi":22
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":21
 *         return envit
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":24
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self.end:
 *             raise StopIteration
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_3__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11EnvIterator_2__next__(((struct __pyx_obj_6amplpy_4ampl_EnvIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator_2__next__(struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self) {
  AMPL_ENVIRONMENTVAR *__pyx_v_it;
  char *__pyx_v_name_c;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  AMPL_ENVIRONMENTVAR *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "amplpy/iterators.pxi":25
 * 
 *     def __next__(self):
 *         if self.iterator >= self.end:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         cdef campl.AMPL_ENVIRONMENTVAR* it = self.iterator
*/
  __pyx_t_1 = (__pyx_v_self->iterator >= __pyx_v_self->end);
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/iterators.pxi":26
 *     def __next__(self):
 *         if self.iterator >= self.end:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ENVIRONMENTVAR* it = self.iterator
 *         self.iterator += 1
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "amplpy/iterators.pxi":25
 * 
 *     def __next__(self):
 *         if self.iterator >= self.end:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         cdef campl.AMPL_ENVIRONMENTVAR* it = self.iterator
*/
  }

  /* "amplpy/iterators.pxi":27
 *         if self.iterator >= self.end:
 *             raise StopIteration
 *         cdef campl.AMPL_ENVIRONMENTVAR* it = self.iterator             # <<<<<<<<<<<<<<
 *         self.iterator += 1
 *         cdef char* name_c
*/
  __pyx_t_2 = __pyx_v_self->iterator;
  __pyx_v_it = __pyx_t_2;

  /* "amplpy/iterators.pxi":28
 *             raise StopIteration
 *         cdef campl.AMPL_ENVIRONMENTVAR* it = self.iterator
 *         self.iterator += 1             # <<<<<<<<<<<<<<
 *         cdef char* name_c
 *         cdef char* value_c
*/
  __pyx_v_self->iterator = (__pyx_v_self->iterator + 1);

  /* "amplpy/iterators.pxi":31
 *         cdef char* name_c
 *         cdef char* value_c
 *         campl.AMPL_EnvironmentVarGetName(it, &name_c)             # <<<<<<<<<<<<<<
 *         campl.AMPL_EnvironmentVarGetValue(it, &value_c)
 *         name = name_c.decode('utf-8', errors='replace')
*/
  (void)(AMPL_EnvironmentVarGetName(__pyx_v_it, (&__pyx_v_name_c)));

  /* "amplpy/iterators.pxi":32
 *         cdef char* value_c
 *         campl.AMPL_EnvironmentVarGetName(it, &name_c)
 *         campl.AMPL_EnvironmentVarGetValue(it, &value_c)             # <<<<<<<<<<<<<<
 *         name = name_c.decode('utf-8', errors='replace')
 *         value = value_c.decode('utf-8', errors='replace')
*/
  (void)(AMPL_EnvironmentVarGetValue(__pyx_v_it, (&__pyx_v_value_c)));

  /* "amplpy/iterators.pxi":33
 *         campl.AMPL_EnvironmentVarGetName(it, &name_c)
 *         campl.AMPL_EnvironmentVarGetValue(it, &value_c)
 *         name = name_c.decode('utf-8', errors='replace')             # <<<<<<<<<<<<<<
 *         value = value_c.decode('utf-8', errors='replace')
 * 
*/
  __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_name_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_errors, __pyx_mstate_global->__pyx_n_u_replace, __pyx_t_7, __pyx_callargs+2, 0) < 0) __PYX_ERR(6, 33, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_decode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_v_name = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "amplpy/iterators.pxi":34
 *         campl.AMPL_EnvironmentVarGetValue(it, &value_c)
 *         name = name_c.decode('utf-8', errors='replace')
 *         value = value_c.decode('utf-8', errors='replace')             # <<<<<<<<<<<<<<
 * 
 *         return (name, value)
*/
  __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_value_c); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __pyx_t_7;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_errors, __pyx_mstate_global->__pyx_n_u_replace, __pyx_t_4, __pyx_callargs+2, 0) < 0) __PYX_ERR(6, 34, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_decode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_v_value = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "amplpy/iterators.pxi":36
 *         value = value_c.decode('utf-8', errors='replace')
 * 
 *         return (name, value)             # <<<<<<<<<<<<<<
 * 
 * cdef class EntityMap(object):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_name) != (0)) __PYX_ERR(6, 36, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value) != (0)) __PYX_ERR(6, 36, __pyx_L1_error);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":24
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self.end:
 *             raise StopIteration
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("amplpy.ampl.EnvIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11EnvIterator_4__reduce_cython__, "EnvIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11EnvIterator_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11EnvIterator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11EnvIterator_4__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_11EnvIterator_4__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_EnvIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_begin_self_end_self_env_c_s, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.EnvIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11EnvIterator_6__setstate_cython__, "EnvIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11EnvIterator_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11EnvIterator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11EnvIterator_6__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11EnvIterator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.EnvIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_11EnvIterator_6__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_EnvIterator *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11EnvIterator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EnvIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_begin_self_end_self_env_c_s, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.EnvIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":45
 *     cdef size_t _size
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, campl.AMPL_ENTITYTYPE entity_class):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

static PyObject *__pyx_f_6amplpy_4ampl_9EntityMap_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, AMPL_ENTITYTYPE __pyx_v_entity_class) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_entityit = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/iterators.pxi":48
 *     cdef create(AMPL ampl, campl.AMPL_ENTITYTYPE entity_class):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         entityit = EntityMap()             # <<<<<<<<<<<<<<
 *         entityit._ampl = ampl
 *         entityit.entity_class = entity_class
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_EntityMap);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_EntityMap); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 48, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_entityit = ((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/iterators.pxi":49
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         entityit = EntityMap()
 *         entityit._ampl = ampl             # <<<<<<<<<<<<<<
 *         entityit.entity_class = entity_class
 *         if entity_class == campl.AMPL_VARIABLE:
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_entityit->_ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_entityit->_ampl);
  __pyx_v_entityit->_ampl = __pyx_v_ampl;

  /* "amplpy/iterators.pxi":50
 *         entityit = EntityMap()
 *         entityit._ampl = ampl
 *         entityit.entity_class = entity_class             # <<<<<<<<<<<<<<
 *         if entity_class == campl.AMPL_VARIABLE:
 *             errorinfo = campl.AMPL_GetVariables(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
*/
  __pyx_v_entityit->entity_class = __pyx_v_entity_class;

  /* "amplpy/iterators.pxi":51
 *         entityit._ampl = ampl
 *         entityit.entity_class = entity_class
 *         if entity_class == campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_GetVariables(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_CONSTRAINT:
*/
  switch (__pyx_v_entity_class) {
    case AMPL_VARIABLE:

    /* "amplpy/iterators.pxi":52
 *         entityit.entity_class = entity_class
 *         if entity_class == campl.AMPL_VARIABLE:
 *             errorinfo = campl.AMPL_GetVariables(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)             # <<<<<<<<<<<<<<
 *         elif entity_class == campl.AMPL_CONSTRAINT:
 *             errorinfo = campl.AMPL_GetConstraints(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
*/
    __pyx_v_errorinfo = AMPL_GetVariables(__pyx_v_entityit->_ampl->_c_ampl, (&__pyx_v_entityit->_size), (&__pyx_v_entityit->begin));

    /* "amplpy/iterators.pxi":51
 *         entityit._ampl = ampl
 *         entityit.entity_class = entity_class
 *         if entity_class == campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_GetVariables(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_CONSTRAINT:
*/
    break;
    case AMPL_CONSTRAINT:

    /* "amplpy/iterators.pxi":54
 *             errorinfo = campl.AMPL_GetVariables(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_CONSTRAINT:
 *             errorinfo = campl.AMPL_GetConstraints(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)             # <<<<<<<<<<<<<<
 *         elif entity_class == campl.AMPL_OBJECTIVE:
 *             errorinfo = campl.AMPL_GetObjectives(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
*/
    __pyx_v_errorinfo = AMPL_GetConstraints(__pyx_v_entityit->_ampl->_c_ampl, (&__pyx_v_entityit->_size), (&__pyx_v_entityit->begin));

    /* "amplpy/iterators.pxi":53
 *         if entity_class == campl.AMPL_VARIABLE:
 *             errorinfo = campl.AMPL_GetVariables(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_CONSTRAINT:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_GetConstraints(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_OBJECTIVE:
*/
    break;
    case AMPL_OBJECTIVE:

    /* "amplpy/iterators.pxi":56
 *             errorinfo = campl.AMPL_GetConstraints(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_OBJECTIVE:
 *             errorinfo = campl.AMPL_GetObjectives(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)             # <<<<<<<<<<<<<<
 *         elif entity_class == campl.AMPL_SET:
 *             errorinfo = campl.AMPL_GetSets(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
*/
    __pyx_v_errorinfo = AMPL_GetObjectives(__pyx_v_entityit->_ampl->_c_ampl, (&__pyx_v_entityit->_size), (&__pyx_v_entityit->begin));

    /* "amplpy/iterators.pxi":55
 *         elif entity_class == campl.AMPL_CONSTRAINT:
 *             errorinfo = campl.AMPL_GetConstraints(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_OBJECTIVE:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_GetObjectives(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_SET:
*/
    break;
    case AMPL_SET:

    /* "amplpy/iterators.pxi":58
 *             errorinfo = campl.AMPL_GetObjectives(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_SET:
 *             errorinfo = campl.AMPL_GetSets(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)             # <<<<<<<<<<<<<<
 *         elif entity_class == campl.AMPL_PARAMETER:
 *             errorinfo = campl.AMPL_GetParameters(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
*/
    __pyx_v_errorinfo = AMPL_GetSets(__pyx_v_entityit->_ampl->_c_ampl, (&__pyx_v_entityit->_size), (&__pyx_v_entityit->begin));

    /* "amplpy/iterators.pxi":57
 *         elif entity_class == campl.AMPL_OBJECTIVE:
 *             errorinfo = campl.AMPL_GetObjectives(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_SET:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_GetSets(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_PARAMETER:
*/
    break;
    case AMPL_PARAMETER:

    /* "amplpy/iterators.pxi":60
 *             errorinfo = campl.AMPL_GetSets(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_PARAMETER:
 *             errorinfo = campl.AMPL_GetParameters(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(f"Unknown entity class.")
*/
    __pyx_v_errorinfo = AMPL_GetParameters(__pyx_v_entityit->_ampl->_c_ampl, (&__pyx_v_entityit->_size), (&__pyx_v_entityit->begin));

    /* "amplpy/iterators.pxi":59
 *         elif entity_class == campl.AMPL_SET:
 *             errorinfo = campl.AMPL_GetSets(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         elif entity_class == campl.AMPL_PARAMETER:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_GetParameters(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         else:
*/
    break;
    default:

    /* "amplpy/iterators.pxi":62
 *             errorinfo = campl.AMPL_GetParameters(entityit._ampl._c_ampl, &entityit._size, &entityit.begin)
 *         else:
 *             raise ValueError(f"Unknown entity class.")             # <<<<<<<<<<<<<<
 * 
 *         if errorinfo:
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_2 = __pyx_builtin_ValueError; 
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unknown_entity_class};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(6, 62, __pyx_L1_error)
    break;
  }

  /* "amplpy/iterators.pxi":64
 *             raise ValueError(f"Unknown entity class.")
 * 
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             for i in range(entityit._size):
 *                 campl.AMPL_StringFree(&entityit.begin[i])
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/iterators.pxi":65
 * 
 *         if errorinfo:
 *             for i in range(entityit._size):             # <<<<<<<<<<<<<<
 *                 campl.AMPL_StringFree(&entityit.begin[i])
 *             free(entityit.begin)
*/
    __pyx_t_4 = __pyx_v_entityit->_size;
    __pyx_t_6 = __pyx_t_4;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_i = __pyx_t_7;

      /* "amplpy/iterators.pxi":66
 *         if errorinfo:
 *             for i in range(entityit._size):
 *                 campl.AMPL_StringFree(&entityit.begin[i])             # <<<<<<<<<<<<<<
 *             free(entityit.begin)
 *             PY_AMPL_CALL(errorinfo)
*/
      (void)(AMPL_StringFree((&(__pyx_v_entityit->begin[__pyx_v_i]))));
    }

    /* "amplpy/iterators.pxi":67
 *             for i in range(entityit._size):
 *                 campl.AMPL_StringFree(&entityit.begin[i])
 *             free(entityit.begin)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
    free(__pyx_v_entityit->begin);

    /* "amplpy/iterators.pxi":68
 *                 campl.AMPL_StringFree(&entityit.begin[i])
 *             free(entityit.begin)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *         entityit.iterator = 0
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 68, __pyx_L1_error)

    /* "amplpy/iterators.pxi":64
 *             raise ValueError(f"Unknown entity class.")
 * 
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             for i in range(entityit._size):
 *                 campl.AMPL_StringFree(&entityit.begin[i])
*/
  }

  /* "amplpy/iterators.pxi":70
 *             PY_AMPL_CALL(errorinfo)
 * 
 *         entityit.iterator = 0             # <<<<<<<<<<<<<<
 *         return entityit
 * 
*/
  __pyx_v_entityit->iterator = 0;

  /* "amplpy/iterators.pxi":71
 * 
 *         entityit.iterator = 0
 *         return entityit             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_entityit);
  __pyx_r = ((PyObject *)__pyx_v_entityit);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":45
 *     cdef size_t _size
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, campl.AMPL_ENTITYTYPE entity_class):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.EntityMap.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entityit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":73
 *         return entityit
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator < self._size:
 *             for i in range(self.iterator, self._size):
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_9EntityMap_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_9EntityMap_1__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_9EntityMap___dealloc__(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_9EntityMap___dealloc__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self) {
  size_t __pyx_v_i;
  int __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;

  /* "amplpy/iterators.pxi":74
 * 
 *     def __dealloc__(self):
 *         if self.iterator < self._size:             # <<<<<<<<<<<<<<
 *             for i in range(self.iterator, self._size):
 *                 campl.AMPL_StringFree(&self.begin[i])
*/
  __pyx_t_1 = (__pyx_v_self->iterator < __pyx_v_self->_size);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":75
 *     def __dealloc__(self):
 *         if self.iterator < self._size:
 *             for i in range(self.iterator, self._size):             # <<<<<<<<<<<<<<
 *                 campl.AMPL_StringFree(&self.begin[i])
 *         if self.begin != NULL:
*/
    __pyx_t_2 = __pyx_v_self->_size;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = __pyx_v_self->iterator; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "amplpy/iterators.pxi":76
 *         if self.iterator < self._size:
 *             for i in range(self.iterator, self._size):
 *                 campl.AMPL_StringFree(&self.begin[i])             # <<<<<<<<<<<<<<
 *         if self.begin != NULL:
 *             free(self.begin)
*/
      (void)(AMPL_StringFree((&(__pyx_v_self->begin[__pyx_v_i]))));
    }

    /* "amplpy/iterators.pxi":74
 * 
 *     def __dealloc__(self):
 *         if self.iterator < self._size:             # <<<<<<<<<<<<<<
 *             for i in range(self.iterator, self._size):
 *                 campl.AMPL_StringFree(&self.begin[i])
*/
  }

  /* "amplpy/iterators.pxi":77
 *             for i in range(self.iterator, self._size):
 *                 campl.AMPL_StringFree(&self.begin[i])
 *         if self.begin != NULL:             # <<<<<<<<<<<<<<
 *             free(self.begin)
 *             self.begin = NULL
*/
  __pyx_t_1 = (__pyx_v_self->begin != NULL);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":78
 *                 campl.AMPL_StringFree(&self.begin[i])
 *         if self.begin != NULL:
 *             free(self.begin)             # <<<<<<<<<<<<<<
 *             self.begin = NULL
 * 
*/
    free(__pyx_v_self->begin);

    /* "amplpy/iterators.pxi":79
 *         if self.begin != NULL:
 *             free(self.begin)
 *             self.begin = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
    __pyx_v_self->begin = NULL;

    /* "amplpy/iterators.pxi":77
 *             for i in range(self.iterator, self._size):
 *                 campl.AMPL_StringFree(&self.begin[i])
 *         if self.begin != NULL:             # <<<<<<<<<<<<<<
 *             free(self.begin)
 *             self.begin = NULL
*/
  }

  /* "amplpy/iterators.pxi":73
 *         return entityit
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator < self._size:
 *             for i in range(self.iterator, self._size):
*/

  /* function exit code */
}

/* "amplpy/iterators.pxi":81
 *             self.begin = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9EntityMap_2__iter__(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_2__iter__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/iterators.pxi":82
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":81
 *             self.begin = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":84
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self._size:
 *             raise StopIteration
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_5__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9EntityMap_4__next__(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_4__next__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self) {
  PyObject *__pyx_v_tuple = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  char *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "amplpy/iterators.pxi":85
 * 
 *     def __next__(self):
 *         if self.iterator >= self._size:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         tuple = (self.begin[self.iterator].decode('utf-8'), create_entity(self.entity_class, self._ampl, self.begin[self.iterator], NULL, None))
*/
  __pyx_t_1 = (__pyx_v_self->iterator >= __pyx_v_self->_size);
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/iterators.pxi":86
 *     def __next__(self):
 *         if self.iterator >= self._size:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         tuple = (self.begin[self.iterator].decode('utf-8'), create_entity(self.entity_class, self._ampl, self.begin[self.iterator], NULL, None))
 *         self.iterator += 1
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "amplpy/iterators.pxi":85
 * 
 *     def __next__(self):
 *         if self.iterator >= self._size:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         tuple = (self.begin[self.iterator].decode('utf-8'), create_entity(self.entity_class, self._ampl, self.begin[self.iterator], NULL, None))
*/
  }

  /* "amplpy/iterators.pxi":87
 *         if self.iterator >= self._size:
 *             raise StopIteration
 *         tuple = (self.begin[self.iterator].decode('utf-8'), create_entity(self.entity_class, self._ampl, self.begin[self.iterator], NULL, None))             # <<<<<<<<<<<<<<
 *         self.iterator += 1
 *         return tuple
*/
  __pyx_t_2 = (__pyx_v_self->begin[__pyx_v_self->iterator]);
  __pyx_t_3 = __Pyx_ssize_strlen(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(6, 87, __pyx_L1_error)
  __pyx_t_4 = __Pyx_decode_c_string(__pyx_t_2, 0, __pyx_t_3, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((PyObject *)__pyx_v_self->_ampl);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->entity_class, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_5), (__pyx_v_self->begin[__pyx_v_self->iterator]), NULL, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(6, 87, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6) != (0)) __PYX_ERR(6, 87, __pyx_L1_error);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_v_tuple = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "amplpy/iterators.pxi":88
 *             raise StopIteration
 *         tuple = (self.begin[self.iterator].decode('utf-8'), create_entity(self.entity_class, self._ampl, self.begin[self.iterator], NULL, None))
 *         self.iterator += 1             # <<<<<<<<<<<<<<
 *         return tuple
 * 
*/
  __pyx_v_self->iterator = (__pyx_v_self->iterator + 1);

  /* "amplpy/iterators.pxi":89
 *         tuple = (self.begin[self.iterator].decode('utf-8'), create_entity(self.entity_class, self._ampl, self.begin[self.iterator], NULL, None))
 *         self.iterator += 1
 *         return tuple             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_tuple);
  __pyx_r = __pyx_v_tuple;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":84
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self._size:
 *             raise StopIteration
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("amplpy.ampl.EntityMap.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tuple);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":91
 *         return tuple
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         assert isinstance(key, str)
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9EntityMap_6__getitem__(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_6__getitem__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self, PyObject *__pyx_v_key) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_ENTITYTYPE __pyx_v_entitytype;
  char *__pyx_v_name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  char const *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/iterators.pxi":92
 * 
 *     def __getitem__(self, key):
 *         assert isinstance(key, str)             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = PyUnicode_Check(__pyx_v_key); 
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(6, 92, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 92, __pyx_L1_error)
  #endif

  /* "amplpy/iterators.pxi":95
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(key.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_EntityGetType(self._ampl._c_ampl, name_c, &entitytype)
 *         if errorinfo:
*/
  __pyx_t_3 = __pyx_v_key;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 95, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(6, 95, __pyx_L1_error)
  __pyx_v_name_c = strdup(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/iterators.pxi":96
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(key.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._ampl._c_ampl, name_c, &entitytype)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             free(name_c)
*/
  __pyx_v_errorinfo = AMPL_EntityGetType(__pyx_v_self->_ampl->_c_ampl, __pyx_v_name_c, (&__pyx_v_entitytype));

  /* "amplpy/iterators.pxi":97
 *         cdef char* name_c = strdup(key.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._ampl._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":98
 *         errorinfo = campl.AMPL_EntityGetType(self._ampl._c_ampl, name_c, &entitytype)
 *         if errorinfo:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != self.entity_class:
*/
    free(__pyx_v_name_c);

    /* "amplpy/iterators.pxi":99
 *         if errorinfo:
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         if entitytype != self.entity_class:
 *             free(name_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 99, __pyx_L1_error)

    /* "amplpy/iterators.pxi":97
 *         cdef char* name_c = strdup(key.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._ampl._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  }

  /* "amplpy/iterators.pxi":100
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != self.entity_class:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(self.entity_class, key)
*/
  __pyx_t_1 = (__pyx_v_entitytype != __pyx_v_self->entity_class);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":101
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != self.entity_class:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             raiseKeyError(self.entity_class, key)
 *         return create_entity(self.entity_class, self._ampl, name_c, NULL, None)
*/
    free(__pyx_v_name_c);

    /* "amplpy/iterators.pxi":102
 *         if entitytype != self.entity_class:
 *             free(name_c)
 *             raiseKeyError(self.entity_class, key)             # <<<<<<<<<<<<<<
 *         return create_entity(self.entity_class, self._ampl, name_c, NULL, None)
 * 
*/
    if (!(likely(PyUnicode_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_key))) __PYX_ERR(6, 102, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_raiseKeyError(__pyx_v_self->entity_class, ((PyObject*)__pyx_v_key)); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 102, __pyx_L1_error)

    /* "amplpy/iterators.pxi":100
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != self.entity_class:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(self.entity_class, key)
*/
  }

  /* "amplpy/iterators.pxi":103
 *             free(name_c)
 *             raiseKeyError(self.entity_class, key)
 *         return create_entity(self.entity_class, self._ampl, name_c, NULL, None)             # <<<<<<<<<<<<<<
 * 
 *     def size(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_ampl);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->entity_class, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_2), __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":91
 *         return tuple
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         assert isinstance(key, str)
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.EntityMap.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":105
 *         return create_entity(self.entity_class, self._ampl, name_c, NULL, None)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_9size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9EntityMap_8size, "EntityMap.size(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9EntityMap_9size = {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9EntityMap_9size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9EntityMap_8size};
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_9size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("size", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("size", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9EntityMap_8size(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_8size(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("size", 0);

  /* "amplpy/iterators.pxi":106
 * 
 *     def size(self):
 *         return int(self._size)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":105
 *         return create_entity(self.entity_class, self._ampl, name_c, NULL, None)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.EntityMap.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":108
 *         return int(self._size)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_6amplpy_4ampl_9EntityMap_11__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_6amplpy_4ampl_9EntityMap_11__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9EntityMap_10__len__(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_6amplpy_4ampl_9EntityMap_10__len__(struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "amplpy/iterators.pxi":109
 * 
 *     def __len__(self):
 *         return self.size()             # <<<<<<<<<<<<<<
 * 
 * cdef class InstanceIterator(object):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_size, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":108
 *         return int(self._size)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.EntityMap.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9EntityMap_12__reduce_cython__, "EntityMap.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9EntityMap_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9EntityMap_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9EntityMap_12__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9EntityMap_12__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_begin_cannot_be_converted_t, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.EntityMap.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9EntityMap_14__setstate_cython__, "EntityMap.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9EntityMap_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9EntityMap_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9EntityMap_14__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9EntityMap_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.EntityMap.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9EntityMap_14__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_EntityMap *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9EntityMap_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_EntityMap *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_begin_cannot_be_converted_t, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.EntityMap.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":120
 *     cdef object _entity
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_ENTITYTYPE entity_class, parent):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

static PyObject *__pyx_f_6amplpy_4ampl_16InstanceIterator_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_ENTITYTYPE __pyx_v_entity_class, PyObject *__pyx_v_parent) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_instanceit = NULL;
  size_t __pyx_v_arity;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/iterators.pxi":123
 *     cdef create(AMPL ampl, char* name, campl.AMPL_ENTITYTYPE entity_class, parent):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         instanceit = InstanceIterator()             # <<<<<<<<<<<<<<
 *         cdef size_t arity
 *         instanceit._ampl = ampl
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_InstanceIterator);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_InstanceIterator); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 123, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_instanceit = ((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/iterators.pxi":125
 *         instanceit = InstanceIterator()
 *         cdef size_t arity
 *         instanceit._ampl = ampl             # <<<<<<<<<<<<<<
 *         instanceit._name = name
 *         instanceit.entity_class = entity_class
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_instanceit->_ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_instanceit->_ampl);
  __pyx_v_instanceit->_ampl = __pyx_v_ampl;

  /* "amplpy/iterators.pxi":126
 *         cdef size_t arity
 *         instanceit._ampl = ampl
 *         instanceit._name = name             # <<<<<<<<<<<<<<
 *         instanceit.entity_class = entity_class
 *         instanceit._entity = parent
*/
  __pyx_v_instanceit->_name = __pyx_v_name;

  /* "amplpy/iterators.pxi":127
 *         instanceit._ampl = ampl
 *         instanceit._name = name
 *         instanceit.entity_class = entity_class             # <<<<<<<<<<<<<<
 *         instanceit._entity = parent
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(instanceit._ampl._c_ampl, instanceit._name, &arity))
*/
  __pyx_v_instanceit->entity_class = __pyx_v_entity_class;

  /* "amplpy/iterators.pxi":128
 *         instanceit._name = name
 *         instanceit.entity_class = entity_class
 *         instanceit._entity = parent             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(instanceit._ampl._c_ampl, instanceit._name, &arity))
 *         if arity == 0:
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_instanceit->_entity);
  __Pyx_DECREF(__pyx_v_instanceit->_entity);
  __pyx_v_instanceit->_entity = __pyx_v_parent;

  /* "amplpy/iterators.pxi":129
 *         instanceit.entity_class = entity_class
 *         instanceit._entity = parent
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(instanceit._ampl._c_ampl, instanceit._name, &arity))             # <<<<<<<<<<<<<<
 *         if arity == 0:
 *             instanceit._size = 1
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityGetIndexarity(__pyx_v_instanceit->_ampl->_c_ampl, __pyx_v_instanceit->_name, (&__pyx_v_arity))); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 129, __pyx_L1_error)

  /* "amplpy/iterators.pxi":130
 *         instanceit._entity = parent
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(instanceit._ampl._c_ampl, instanceit._name, &arity))
 *         if arity == 0:             # <<<<<<<<<<<<<<
 *             instanceit._size = 1
 *             instanceit.begin = NULL
*/
  __pyx_t_5 = (__pyx_v_arity == 0);
  if (__pyx_t_5) {

    /* "amplpy/iterators.pxi":131
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(instanceit._ampl._c_ampl, instanceit._name, &arity))
 *         if arity == 0:
 *             instanceit._size = 1             # <<<<<<<<<<<<<<
 *             instanceit.begin = NULL
 *             instanceit.iterator = 0
*/
    __pyx_v_instanceit->_size = 1;

    /* "amplpy/iterators.pxi":132
 *         if arity == 0:
 *             instanceit._size = 1
 *             instanceit.begin = NULL             # <<<<<<<<<<<<<<
 *             instanceit.iterator = 0
 *             return instanceit
*/
    __pyx_v_instanceit->begin = NULL;

    /* "amplpy/iterators.pxi":133
 *             instanceit._size = 1
 *             instanceit.begin = NULL
 *             instanceit.iterator = 0             # <<<<<<<<<<<<<<
 *             return instanceit
 *         errorinfo = campl.AMPL_EntityGetTuples(instanceit._ampl._c_ampl, instanceit._name, &instanceit.begin, &instanceit._size)
*/
    __pyx_v_instanceit->iterator = 0;

    /* "amplpy/iterators.pxi":134
 *             instanceit.begin = NULL
 *             instanceit.iterator = 0
 *             return instanceit             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_EntityGetTuples(instanceit._ampl._c_ampl, instanceit._name, &instanceit.begin, &instanceit._size)
 *         if errorinfo:
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_instanceit);
    __pyx_r = ((PyObject *)__pyx_v_instanceit);
    goto __pyx_L0;

    /* "amplpy/iterators.pxi":130
 *         instanceit._entity = parent
 *         PY_AMPL_CALL(campl.AMPL_EntityGetIndexarity(instanceit._ampl._c_ampl, instanceit._name, &arity))
 *         if arity == 0:             # <<<<<<<<<<<<<<
 *             instanceit._size = 1
 *             instanceit.begin = NULL
*/
  }

  /* "amplpy/iterators.pxi":135
 *             instanceit.iterator = 0
 *             return instanceit
 *         errorinfo = campl.AMPL_EntityGetTuples(instanceit._ampl._c_ampl, instanceit._name, &instanceit.begin, &instanceit._size)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             for i in range(instanceit._size):
*/
  __pyx_v_errorinfo = AMPL_EntityGetTuples(__pyx_v_instanceit->_ampl->_c_ampl, __pyx_v_instanceit->_name, (&__pyx_v_instanceit->begin), (&__pyx_v_instanceit->_size));

  /* "amplpy/iterators.pxi":136
 *             return instanceit
 *         errorinfo = campl.AMPL_EntityGetTuples(instanceit._ampl._c_ampl, instanceit._name, &instanceit.begin, &instanceit._size)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/iterators.pxi":137
 *         errorinfo = campl.AMPL_EntityGetTuples(instanceit._ampl._c_ampl, instanceit._name, &instanceit.begin, &instanceit._size)
 *         if errorinfo:
 *             for i in range(instanceit._size):             # <<<<<<<<<<<<<<
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
 *             free(instanceit.begin)
*/
    __pyx_t_4 = __pyx_v_instanceit->_size;
    __pyx_t_6 = __pyx_t_4;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_i = __pyx_t_7;

      /* "amplpy/iterators.pxi":138
 *         if errorinfo:
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])             # <<<<<<<<<<<<<<
 *             free(instanceit.begin)
 *             PY_AMPL_CALL(errorinfo)
*/
      (void)(AMPL_TupleFree((&(__pyx_v_instanceit->begin[__pyx_v_i]))));
    }

    /* "amplpy/iterators.pxi":139
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
 *             free(instanceit.begin)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         if instanceit._size == 0:
*/
    free(__pyx_v_instanceit->begin);

    /* "amplpy/iterators.pxi":140
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
 *             free(instanceit.begin)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         if instanceit._size == 0:
 *             instanceit.iterator = 0
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 140, __pyx_L1_error)

    /* "amplpy/iterators.pxi":136
 *             return instanceit
 *         errorinfo = campl.AMPL_EntityGetTuples(instanceit._ampl._c_ampl, instanceit._name, &instanceit.begin, &instanceit._size)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
*/
  }

  /* "amplpy/iterators.pxi":141
 *             free(instanceit.begin)
 *             PY_AMPL_CALL(errorinfo)
 *         if instanceit._size == 0:             # <<<<<<<<<<<<<<
 *             instanceit.iterator = 0
 *         else:
*/
  __pyx_t_5 = (__pyx_v_instanceit->_size == 0);
  if (__pyx_t_5) {

    /* "amplpy/iterators.pxi":142
 *             PY_AMPL_CALL(errorinfo)
 *         if instanceit._size == 0:
 *             instanceit.iterator = 0             # <<<<<<<<<<<<<<
 *         else:
 *             instanceit.iterator = 0
*/
    __pyx_v_instanceit->iterator = 0;

    /* "amplpy/iterators.pxi":141
 *             free(instanceit.begin)
 *             PY_AMPL_CALL(errorinfo)
 *         if instanceit._size == 0:             # <<<<<<<<<<<<<<
 *             instanceit.iterator = 0
 *         else:
*/
    goto __pyx_L7;
  }

  /* "amplpy/iterators.pxi":144
 *             instanceit.iterator = 0
 *         else:
 *             instanceit.iterator = 0             # <<<<<<<<<<<<<<
 *         return instanceit
 * 
*/
  /*else*/ {
    __pyx_v_instanceit->iterator = 0;
  }
  __pyx_L7:;

  /* "amplpy/iterators.pxi":145
 *         else:
 *             instanceit.iterator = 0
 *         return instanceit             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_instanceit);
  __pyx_r = ((PyObject *)__pyx_v_instanceit);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":120
 *     cdef object _entity
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_ENTITYTYPE entity_class, parent):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instanceit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":147
 *         return instanceit
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator+1 < self._size:
 *             for i in range(self.iterator+1, self._size):
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_16InstanceIterator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_16InstanceIterator_1__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_16InstanceIterator___dealloc__(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_16InstanceIterator___dealloc__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self) {
  size_t __pyx_v_i;
  int __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;

  /* "amplpy/iterators.pxi":148
 * 
 *     def __dealloc__(self):
 *         if self.iterator+1 < self._size:             # <<<<<<<<<<<<<<
 *             for i in range(self.iterator+1, self._size):
 *                 campl.AMPL_TupleFree(&self.begin[i])
*/
  __pyx_t_1 = ((__pyx_v_self->iterator + 1) < __pyx_v_self->_size);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":149
 *     def __dealloc__(self):
 *         if self.iterator+1 < self._size:
 *             for i in range(self.iterator+1, self._size):             # <<<<<<<<<<<<<<
 *                 campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:
*/
    __pyx_t_2 = __pyx_v_self->_size;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = (__pyx_v_self->iterator + 1); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "amplpy/iterators.pxi":150
 *         if self.iterator+1 < self._size:
 *             for i in range(self.iterator+1, self._size):
 *                 campl.AMPL_TupleFree(&self.begin[i])             # <<<<<<<<<<<<<<
 *         if self.begin != NULL:
 *             free(self.begin)
*/
      (void)(AMPL_TupleFree((&(__pyx_v_self->begin[__pyx_v_i]))));
    }

    /* "amplpy/iterators.pxi":148
 * 
 *     def __dealloc__(self):
 *         if self.iterator+1 < self._size:             # <<<<<<<<<<<<<<
 *             for i in range(self.iterator+1, self._size):
 *                 campl.AMPL_TupleFree(&self.begin[i])
*/
  }

  /* "amplpy/iterators.pxi":151
 *             for i in range(self.iterator+1, self._size):
 *                 campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:             # <<<<<<<<<<<<<<
 *             free(self.begin)
 *             self.begin = NULL
*/
  __pyx_t_1 = (__pyx_v_self->begin != NULL);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":152
 *                 campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:
 *             free(self.begin)             # <<<<<<<<<<<<<<
 *             self.begin = NULL
 * 
*/
    free(__pyx_v_self->begin);

    /* "amplpy/iterators.pxi":153
 *         if self.begin != NULL:
 *             free(self.begin)
 *             self.begin = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
    __pyx_v_self->begin = NULL;

    /* "amplpy/iterators.pxi":151
 *             for i in range(self.iterator+1, self._size):
 *                 campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:             # <<<<<<<<<<<<<<
 *             free(self.begin)
 *             self.begin = NULL
*/
  }

  /* "amplpy/iterators.pxi":147
 *         return instanceit
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator+1 < self._size:
 *             for i in range(self.iterator+1, self._size):
*/

  /* function exit code */
}

/* "amplpy/iterators.pxi":155
 *             self.begin = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_16InstanceIterator_2__iter__(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_2__iter__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/iterators.pxi":156
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":155
 *             self.begin = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":158
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self._size:
 *             raise StopIteration
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_5__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_16InstanceIterator_4__next__(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_4__next__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "amplpy/iterators.pxi":159
 * 
 *     def __next__(self):
 *         if self.iterator >= self._size:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         self.iterator += 1
*/
  __pyx_t_1 = (__pyx_v_self->iterator >= __pyx_v_self->_size);
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/iterators.pxi":160
 *     def __next__(self):
 *         if self.iterator >= self._size:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         self.iterator += 1
 *         if self.begin == NULL:
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "amplpy/iterators.pxi":159
 * 
 *     def __next__(self):
 *         if self.iterator >= self._size:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         self.iterator += 1
*/
  }

  /* "amplpy/iterators.pxi":161
 *         if self.iterator >= self._size:
 *             raise StopIteration
 *         self.iterator += 1             # <<<<<<<<<<<<<<
 *         if self.begin == NULL:
 *             return (None, self._entity)
*/
  __pyx_v_self->iterator = (__pyx_v_self->iterator + 1);

  /* "amplpy/iterators.pxi":162
 *             raise StopIteration
 *         self.iterator += 1
 *         if self.begin == NULL:             # <<<<<<<<<<<<<<
 *             return (None, self._entity)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->begin == NULL);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":163
 *         self.iterator += 1
 *         if self.begin == NULL:
 *             return (None, self._entity)             # <<<<<<<<<<<<<<
 *         else:
 *             return (to_py_tuple(self.begin[self.iterator-1]), create_entity(self.entity_class, self._ampl, self._name, self.begin[self.iterator-1], self._entity))
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, Py_None) != (0)) __PYX_ERR(6, 163, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_self->_entity);
    __Pyx_GIVEREF(__pyx_v_self->_entity);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->_entity) != (0)) __PYX_ERR(6, 163, __pyx_L1_error);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "amplpy/iterators.pxi":162
 *             raise StopIteration
 *         self.iterator += 1
 *         if self.begin == NULL:             # <<<<<<<<<<<<<<
 *             return (None, self._entity)
 *         else:
*/
  }

  /* "amplpy/iterators.pxi":165
 *             return (None, self._entity)
 *         else:
 *             return (to_py_tuple(self.begin[self.iterator-1]), create_entity(self.entity_class, self._ampl, self._name, self.begin[self.iterator-1], self._entity))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_6amplpy_4ampl_to_py_tuple((__pyx_v_self->begin[(__pyx_v_self->iterator - 1)])); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = ((PyObject *)__pyx_v_self->_ampl);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_v_self->_entity;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->entity_class, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_3), __pyx_v_self->_name, (__pyx_v_self->begin[(__pyx_v_self->iterator - 1)]), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(6, 165, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5) != (0)) __PYX_ERR(6, 165, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "amplpy/iterators.pxi":158
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self._size:
 *             raise StopIteration
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":167
 *             return (to_py_tuple(self.begin[self.iterator-1]), create_entity(self.entity_class, self._ampl, self._name, self.begin[self.iterator-1], self._entity))
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         assert isinstance(key, str)
 *         key = tuple(key)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_16InstanceIterator_6__getitem__(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_6__getitem__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self, PyObject *__pyx_v_key) {
  AMPL_TUPLE *__pyx_v_tuple_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  AMPL_TUPLE *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_key);

  /* "amplpy/iterators.pxi":168
 * 
 *     def __getitem__(self, key):
 *         assert isinstance(key, str)             # <<<<<<<<<<<<<<
 *         key = tuple(key)
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(key)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = PyUnicode_Check(__pyx_v_key); 
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(6, 168, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(6, 168, __pyx_L1_error)
  #endif

  /* "amplpy/iterators.pxi":169
 *     def __getitem__(self, key):
 *         assert isinstance(key, str)
 *         key = tuple(key)             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(key)
 *         return create_entity(self.entity_class, self._ampl, self._name, tuple_c, self._entity)
*/
  __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/iterators.pxi":170
 *         assert isinstance(key, str)
 *         key = tuple(key)
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(key)             # <<<<<<<<<<<<<<
 *         return create_entity(self.entity_class, self._ampl, self._name, tuple_c, self._entity)
 * 
*/
  __pyx_t_3 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_key); if (unlikely(__pyx_t_3 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(6, 170, __pyx_L1_error)
  __pyx_v_tuple_c = __pyx_t_3;

  /* "amplpy/iterators.pxi":171
 *         key = tuple(key)
 *         cdef campl.AMPL_TUPLE* tuple_c = to_c_tuple(key)
 *         return create_entity(self.entity_class, self._ampl, self._name, tuple_c, self._entity)             # <<<<<<<<<<<<<<
 * 
 *     def size(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->_ampl);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = __pyx_v_self->_entity;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_6amplpy_4ampl_create_entity(__pyx_v_self->entity_class, ((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_t_2), __pyx_v_self->_name, __pyx_v_tuple_c, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":167
 *             return (to_py_tuple(self.begin[self.iterator-1]), create_entity(self.entity_class, self._ampl, self._name, self.begin[self.iterator-1], self._entity))
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         assert isinstance(key, str)
 *         key = tuple(key)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":173
 *         return create_entity(self.entity_class, self._ampl, self._name, tuple_c, self._entity)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_9size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_16InstanceIterator_8size, "InstanceIterator.size(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_16InstanceIterator_9size = {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_16InstanceIterator_9size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_16InstanceIterator_8size};
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_9size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("size", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("size", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_16InstanceIterator_8size(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_8size(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("size", 0);

  /* "amplpy/iterators.pxi":174
 * 
 *     def size(self):
 *         return int(self._size)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":173
 *         return create_entity(self.entity_class, self._ampl, self._name, tuple_c, self._entity)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":176
 *         return int(self._size)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_6amplpy_4ampl_16InstanceIterator_11__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_6amplpy_4ampl_16InstanceIterator_11__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_16InstanceIterator_10__len__(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_6amplpy_4ampl_16InstanceIterator_10__len__(struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "amplpy/iterators.pxi":177
 * 
 *     def __len__(self):
 *         return self.size()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_size, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 177, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":176
 *         return int(self._size)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_16InstanceIterator_12__reduce_cython__, "InstanceIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_16InstanceIterator_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_16InstanceIterator_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_16InstanceIterator_12__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_13__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_16InstanceIterator_12__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_begin_cannot_be_converted_t, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_16InstanceIterator_14__setstate_cython__, "InstanceIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_16InstanceIterator_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_16InstanceIterator_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_16InstanceIterator_14__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_16InstanceIterator_15__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_16InstanceIterator_14__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_16InstanceIterator_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_InstanceIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_begin_cannot_be_converted_t, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.InstanceIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":190
 *     cdef object _entity
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL* ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

static PyObject *__pyx_f_6amplpy_4ampl_19MemberRangeIterator_create(AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_instanceit = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/iterators.pxi":193
 *     cdef create(campl.AMPL* ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         instanceit = MemberRangeIterator()             # <<<<<<<<<<<<<<
 *         instanceit._c_ampl = ampl
 *         instanceit._name = name
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 193, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_instanceit = ((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/iterators.pxi":194
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         instanceit = MemberRangeIterator()
 *         instanceit._c_ampl = ampl             # <<<<<<<<<<<<<<
 *         instanceit._name = name
 *         instanceit._index = index
*/
  __pyx_v_instanceit->_c_ampl = __pyx_v_ampl;

  /* "amplpy/iterators.pxi":195
 *         instanceit = MemberRangeIterator()
 *         instanceit._c_ampl = ampl
 *         instanceit._name = name             # <<<<<<<<<<<<<<
 *         instanceit._index = index
 *         instanceit._entity = parent
*/
  __pyx_v_instanceit->_name = __pyx_v_name;

  /* "amplpy/iterators.pxi":196
 *         instanceit._c_ampl = ampl
 *         instanceit._name = name
 *         instanceit._index = index             # <<<<<<<<<<<<<<
 *         instanceit._entity = parent
 *         if instanceit._entity is not None:
*/
  __pyx_v_instanceit->_index = __pyx_v_index;

  /* "amplpy/iterators.pxi":197
 *         instanceit._name = name
 *         instanceit._index = index
 *         instanceit._entity = parent             # <<<<<<<<<<<<<<
 *         if instanceit._entity is not None:
 *             Py_INCREF(instanceit._entity)
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_instanceit->_entity);
  __Pyx_DECREF(__pyx_v_instanceit->_entity);
  __pyx_v_instanceit->_entity = __pyx_v_parent;

  /* "amplpy/iterators.pxi":198
 *         instanceit._index = index
 *         instanceit._entity = parent
 *         if instanceit._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(instanceit._entity)
 *         errorinfo = campl.AMPL_SetInstanceGetValues(instanceit._c_ampl, instanceit._name, instanceit._index, &instanceit.begin, &instanceit._size)
*/
  __pyx_t_5 = (__pyx_v_instanceit->_entity != Py_None);
  if (__pyx_t_5) {

    /* "amplpy/iterators.pxi":199
 *         instanceit._entity = parent
 *         if instanceit._entity is not None:
 *             Py_INCREF(instanceit._entity)             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_SetInstanceGetValues(instanceit._c_ampl, instanceit._name, instanceit._index, &instanceit.begin, &instanceit._size)
 *         if errorinfo:
*/
    __pyx_t_1 = __pyx_v_instanceit->_entity;
    __Pyx_INCREF(__pyx_t_1);
    Py_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/iterators.pxi":198
 *         instanceit._index = index
 *         instanceit._entity = parent
 *         if instanceit._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(instanceit._entity)
 *         errorinfo = campl.AMPL_SetInstanceGetValues(instanceit._c_ampl, instanceit._name, instanceit._index, &instanceit.begin, &instanceit._size)
*/
  }

  /* "amplpy/iterators.pxi":200
 *         if instanceit._entity is not None:
 *             Py_INCREF(instanceit._entity)
 *         errorinfo = campl.AMPL_SetInstanceGetValues(instanceit._c_ampl, instanceit._name, instanceit._index, &instanceit.begin, &instanceit._size)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             for i in range(instanceit._size):
*/
  __pyx_v_errorinfo = AMPL_SetInstanceGetValues(__pyx_v_instanceit->_c_ampl, __pyx_v_instanceit->_name, __pyx_v_instanceit->_index, (&__pyx_v_instanceit->begin), (&__pyx_v_instanceit->_size));

  /* "amplpy/iterators.pxi":201
 *             Py_INCREF(instanceit._entity)
 *         errorinfo = campl.AMPL_SetInstanceGetValues(instanceit._c_ampl, instanceit._name, instanceit._index, &instanceit.begin, &instanceit._size)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/iterators.pxi":202
 *         errorinfo = campl.AMPL_SetInstanceGetValues(instanceit._c_ampl, instanceit._name, instanceit._index, &instanceit.begin, &instanceit._size)
 *         if errorinfo:
 *             for i in range(instanceit._size):             # <<<<<<<<<<<<<<
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
 *             free(instanceit.begin)
*/
    __pyx_t_4 = __pyx_v_instanceit->_size;
    __pyx_t_6 = __pyx_t_4;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_i = __pyx_t_7;

      /* "amplpy/iterators.pxi":203
 *         if errorinfo:
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])             # <<<<<<<<<<<<<<
 *             free(instanceit.begin)
 *             PY_AMPL_CALL(errorinfo)
*/
      (void)(AMPL_TupleFree((&(__pyx_v_instanceit->begin[__pyx_v_i]))));
    }

    /* "amplpy/iterators.pxi":204
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
 *             free(instanceit.begin)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         instanceit.iterator = 0
*/
    free(__pyx_v_instanceit->begin);

    /* "amplpy/iterators.pxi":205
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
 *             free(instanceit.begin)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         instanceit.iterator = 0
 *         return instanceit
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 205, __pyx_L1_error)

    /* "amplpy/iterators.pxi":201
 *             Py_INCREF(instanceit._entity)
 *         errorinfo = campl.AMPL_SetInstanceGetValues(instanceit._c_ampl, instanceit._name, instanceit._index, &instanceit.begin, &instanceit._size)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             for i in range(instanceit._size):
 *                 campl.AMPL_TupleFree(&instanceit.begin[i])
*/
  }

  /* "amplpy/iterators.pxi":206
 *             free(instanceit.begin)
 *             PY_AMPL_CALL(errorinfo)
 *         instanceit.iterator = 0             # <<<<<<<<<<<<<<
 *         return instanceit
 * 
*/
  __pyx_v_instanceit->iterator = 0;

  /* "amplpy/iterators.pxi":207
 *             PY_AMPL_CALL(errorinfo)
 *         instanceit.iterator = 0
 *         return instanceit             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_instanceit);
  __pyx_r = ((PyObject *)__pyx_v_instanceit);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":190
 *     cdef object _entity
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL* ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.MemberRangeIterator.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instanceit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":209
 *         return instanceit
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_1__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_19MemberRangeIterator___dealloc__(((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_19MemberRangeIterator___dealloc__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self) {
  size_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "amplpy/iterators.pxi":210
 * 
 *     def __dealloc__(self):
 *         if self._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_DECREF(self._entity)
 *         for i in range(self._size):
*/
  __pyx_t_1 = (__pyx_v_self->_entity != Py_None);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":211
 *     def __dealloc__(self):
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)             # <<<<<<<<<<<<<<
 *         for i in range(self._size):
 *             campl.AMPL_TupleFree(&self.begin[i])
*/
    __pyx_t_2 = __pyx_v_self->_entity;
    __Pyx_INCREF(__pyx_t_2);
    Py_DECREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/iterators.pxi":210
 * 
 *     def __dealloc__(self):
 *         if self._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_DECREF(self._entity)
 *         for i in range(self._size):
*/
  }

  /* "amplpy/iterators.pxi":212
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)
 *         for i in range(self._size):             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:
*/
  __pyx_t_3 = __pyx_v_self->_size;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "amplpy/iterators.pxi":213
 *             Py_DECREF(self._entity)
 *         for i in range(self._size):
 *             campl.AMPL_TupleFree(&self.begin[i])             # <<<<<<<<<<<<<<
 *         if self.begin != NULL:
 *             free(self.begin)
*/
    (void)(AMPL_TupleFree((&(__pyx_v_self->begin[__pyx_v_i]))));
  }

  /* "amplpy/iterators.pxi":214
 *         for i in range(self._size):
 *             campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:             # <<<<<<<<<<<<<<
 *             free(self.begin)
 *             self.begin = NULL
*/
  __pyx_t_1 = (__pyx_v_self->begin != NULL);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":215
 *             campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:
 *             free(self.begin)             # <<<<<<<<<<<<<<
 *             self.begin = NULL
 * 
*/
    free(__pyx_v_self->begin);

    /* "amplpy/iterators.pxi":216
 *         if self.begin != NULL:
 *             free(self.begin)
 *             self.begin = NULL             # <<<<<<<<<<<<<<
 * 
 *     def size(self):
*/
    __pyx_v_self->begin = NULL;

    /* "amplpy/iterators.pxi":214
 *         for i in range(self._size):
 *             campl.AMPL_TupleFree(&self.begin[i])
 *         if self.begin != NULL:             # <<<<<<<<<<<<<<
 *             free(self.begin)
 *             self.begin = NULL
*/
  }

  /* "amplpy/iterators.pxi":209
 *         return instanceit
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._entity is not None:
 *             Py_DECREF(self._entity)
*/

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "amplpy/iterators.pxi":218
 *             self.begin = NULL
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_3size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_19MemberRangeIterator_2size, "MemberRangeIterator.size(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_19MemberRangeIterator_3size = {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_3size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_19MemberRangeIterator_2size};
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_3size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("size", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("size", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_2size(((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_2size(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("size", 0);

  /* "amplpy/iterators.pxi":219
 * 
 *     def size(self):
 *         return int(self._size)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_self->_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":218
 *             self.begin = NULL
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.MemberRangeIterator.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":221
 *         return int(self._size)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
*/

/* Python wrapper */
static Py_ssize_t __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_5__len__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_4__len__(((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_4__len__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "amplpy/iterators.pxi":222
 * 
 *     def __len__(self):
 *         return self.size()             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_size, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 222, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":221
 *         return int(self._size)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.MemberRangeIterator.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":224
 *         return self.size()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_7__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_6__iter__(((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_6__iter__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/iterators.pxi":225
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":224
 *         return self.size()
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":227
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self._size:
 *             raise StopIteration
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_9__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_9__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_8__next__(((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_8__next__(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self) {
  AMPL_TUPLE *__pyx_v_it;
  size_t __pyx_v_size;
  AMPL_VARIANT *__pyx_v_variant;
  PyObject *__pyx_v_py_variant = NULL;
  PyObject *__pyx_v_py_tuple = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "amplpy/iterators.pxi":228
 * 
 *     def __next__(self):
 *         if self.iterator >= self._size:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         cdef campl.AMPL_TUPLE* it = self.begin[self.iterator]
*/
  __pyx_t_1 = (__pyx_v_self->iterator >= __pyx_v_self->_size);
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/iterators.pxi":229
 *     def __next__(self):
 *         if self.iterator >= self._size:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_TUPLE* it = self.begin[self.iterator]
 *         cdef size_t size
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "amplpy/iterators.pxi":228
 * 
 *     def __next__(self):
 *         if self.iterator >= self._size:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         cdef campl.AMPL_TUPLE* it = self.begin[self.iterator]
*/
  }

  /* "amplpy/iterators.pxi":230
 *         if self.iterator >= self._size:
 *             raise StopIteration
 *         cdef campl.AMPL_TUPLE* it = self.begin[self.iterator]             # <<<<<<<<<<<<<<
 *         cdef size_t size
 *         cdef campl.AMPL_VARIANT* variant
*/
  __pyx_v_it = (__pyx_v_self->begin[__pyx_v_self->iterator]);

  /* "amplpy/iterators.pxi":233
 *         cdef size_t size
 *         cdef campl.AMPL_VARIANT* variant
 *         campl.AMPL_TupleGetSize(it, &size)             # <<<<<<<<<<<<<<
 *         if size == 1:
 *             campl.AMPL_TupleGetVariant(it, 0, &variant)
*/
  (void)(AMPL_TupleGetSize(__pyx_v_it, (&__pyx_v_size)));

  /* "amplpy/iterators.pxi":234
 *         cdef campl.AMPL_VARIANT* variant
 *         campl.AMPL_TupleGetSize(it, &size)
 *         if size == 1:             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleGetVariant(it, 0, &variant)
 *             py_variant = to_py_variant(variant)
*/
  __pyx_t_1 = (__pyx_v_size == 1);
  if (__pyx_t_1) {

    /* "amplpy/iterators.pxi":235
 *         campl.AMPL_TupleGetSize(it, &size)
 *         if size == 1:
 *             campl.AMPL_TupleGetVariant(it, 0, &variant)             # <<<<<<<<<<<<<<
 *             py_variant = to_py_variant(variant)
 *             self.iterator += 1
*/
    (void)(AMPL_TupleGetVariant(__pyx_v_it, 0, (&__pyx_v_variant)));

    /* "amplpy/iterators.pxi":236
 *         if size == 1:
 *             campl.AMPL_TupleGetVariant(it, 0, &variant)
 *             py_variant = to_py_variant(variant)             # <<<<<<<<<<<<<<
 *             self.iterator += 1
 *             return py_variant
*/
    __pyx_t_2 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_variant); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_py_variant = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "amplpy/iterators.pxi":237
 *             campl.AMPL_TupleGetVariant(it, 0, &variant)
 *             py_variant = to_py_variant(variant)
 *             self.iterator += 1             # <<<<<<<<<<<<<<
 *             return py_variant
 *         else:
*/
    __pyx_v_self->iterator = (__pyx_v_self->iterator + 1);

    /* "amplpy/iterators.pxi":238
 *             py_variant = to_py_variant(variant)
 *             self.iterator += 1
 *             return py_variant             # <<<<<<<<<<<<<<
 *         else:
 *             py_tuple = to_py_tuple(it)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_py_variant);
    __pyx_r = __pyx_v_py_variant;
    goto __pyx_L0;

    /* "amplpy/iterators.pxi":234
 *         cdef campl.AMPL_VARIANT* variant
 *         campl.AMPL_TupleGetSize(it, &size)
 *         if size == 1:             # <<<<<<<<<<<<<<
 *             campl.AMPL_TupleGetVariant(it, 0, &variant)
 *             py_variant = to_py_variant(variant)
*/
  }

  /* "amplpy/iterators.pxi":240
 *             return py_variant
 *         else:
 *             py_tuple = to_py_tuple(it)             # <<<<<<<<<<<<<<
 *             self.iterator += 1
 *             return py_tuple
*/
  /*else*/ {
    __pyx_t_2 = __pyx_f_6amplpy_4ampl_to_py_tuple(__pyx_v_it); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_py_tuple = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "amplpy/iterators.pxi":241
 *         else:
 *             py_tuple = to_py_tuple(it)
 *             self.iterator += 1             # <<<<<<<<<<<<<<
 *             return py_tuple
 * 
*/
    __pyx_v_self->iterator = (__pyx_v_self->iterator + 1);

    /* "amplpy/iterators.pxi":242
 *             py_tuple = to_py_tuple(it)
 *             self.iterator += 1
 *             return py_tuple             # <<<<<<<<<<<<<<
 * 
 * cdef class ColIterator(object):
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_py_tuple);
    __pyx_r = __pyx_v_py_tuple;
    goto __pyx_L0;
  }

  /* "amplpy/iterators.pxi":227
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.iterator >= self._size:
 *             raise StopIteration
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("amplpy.ampl.MemberRangeIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_variant);
  __Pyx_XDECREF(__pyx_v_py_tuple);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_11__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_19MemberRangeIterator_10__reduce_cython__, "MemberRangeIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_19MemberRangeIterator_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_19MemberRangeIterator_10__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_11__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_10__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__c_ampl_self__index_self_be, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.MemberRangeIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_13__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_19MemberRangeIterator_12__setstate_cython__, "MemberRangeIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_19MemberRangeIterator_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_19MemberRangeIterator_12__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_13__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.MemberRangeIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_19MemberRangeIterator_12__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_19MemberRangeIterator_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__c_ampl_self__index_self_be, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.MemberRangeIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":250
 *     cdef size_t _rowit
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         colit = ColIterator()
*/

static PyObject *__pyx_f_6amplpy_4ampl_11ColIterator_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index) {
  struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_colit = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/iterators.pxi":252
 *     @staticmethod
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         colit = ColIterator()             # <<<<<<<<<<<<<<
 *         colit._df = df
 *         colit._index = index
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ColIterator);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ColIterator); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 252, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_colit = ((struct __pyx_obj_6amplpy_4ampl_ColIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/iterators.pxi":253
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         colit = ColIterator()
 *         colit._df = df             # <<<<<<<<<<<<<<
 *         colit._index = index
 *         colit._rowit = 0
*/
  __pyx_v_colit->_df = __pyx_v_df;

  /* "amplpy/iterators.pxi":254
 *         colit = ColIterator()
 *         colit._df = df
 *         colit._index = index             # <<<<<<<<<<<<<<
 *         colit._rowit = 0
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(colit._df, &colit._rowsize))
*/
  __pyx_v_colit->_index = __pyx_v_index;

  /* "amplpy/iterators.pxi":255
 *         colit._df = df
 *         colit._index = index
 *         colit._rowit = 0             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(colit._df, &colit._rowsize))
 *         return colit
*/
  __pyx_v_colit->_rowit = 0;

  /* "amplpy/iterators.pxi":256
 *         colit._index = index
 *         colit._rowit = 0
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(colit._df, &colit._rowsize))             # <<<<<<<<<<<<<<
 *         return colit
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameGetNumRows(__pyx_v_colit->_df, (&__pyx_v_colit->_rowsize))); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 256, __pyx_L1_error)

  /* "amplpy/iterators.pxi":257
 *         colit._rowit = 0
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumRows(colit._df, &colit._rowsize))
 *         return colit             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_colit);
  __pyx_r = ((PyObject *)__pyx_v_colit);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":250
 *     cdef size_t _rowit
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         colit = ColIterator()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.ColIterator.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_colit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":259
 *         return colit
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_1__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11ColIterator___iter__(((struct __pyx_obj_6amplpy_4ampl_ColIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator___iter__(struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/iterators.pxi":260
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":259
 *         return colit
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":262
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_VARIANT* v
 *         if self._rowit >= self._rowsize:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_3__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11ColIterator_2__next__(((struct __pyx_obj_6amplpy_4ampl_ColIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator_2__next__(struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self) {
  AMPL_VARIANT *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "amplpy/iterators.pxi":264
 *     def __next__(self):
 *         cdef campl.AMPL_VARIANT* v
 *         if self._rowit >= self._rowsize:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._rowit, self._index, &v))
*/
  __pyx_t_1 = (__pyx_v_self->_rowit >= __pyx_v_self->_rowsize);
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/iterators.pxi":265
 *         cdef campl.AMPL_VARIANT* v
 *         if self._rowit >= self._rowsize:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._rowit, self._index, &v))
 *         self._rowit += 1
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "amplpy/iterators.pxi":264
 *     def __next__(self):
 *         cdef campl.AMPL_VARIANT* v
 *         if self._rowit >= self._rowsize:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._rowit, self._index, &v))
*/
  }

  /* "amplpy/iterators.pxi":266
 *         if self._rowit >= self._rowsize:
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._rowit, self._index, &v))             # <<<<<<<<<<<<<<
 *         self._rowit += 1
 *         return to_py_variant(v)
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameElement(__pyx_v_self->_df, __pyx_v_self->_rowit, __pyx_v_self->_index, (&__pyx_v_v))); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 266, __pyx_L1_error)

  /* "amplpy/iterators.pxi":267
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._rowit, self._index, &v))
 *         self._rowit += 1             # <<<<<<<<<<<<<<
 *         return to_py_variant(v)
 * 
*/
  __pyx_v_self->_rowit = (__pyx_v_self->_rowit + 1);

  /* "amplpy/iterators.pxi":268
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._rowit, self._index, &v))
 *         self._rowit += 1
 *         return to_py_variant(v)             # <<<<<<<<<<<<<<
 * 
 * cdef class RowIterator(object):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":262
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_VARIANT* v
 *         if self._rowit >= self._rowsize:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("amplpy.ampl.ColIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11ColIterator_4__reduce_cython__, "ColIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11ColIterator_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11ColIterator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11ColIterator_4__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_11ColIterator_4__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_ColIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.ColIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11ColIterator_6__setstate_cython__, "ColIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11ColIterator_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11ColIterator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11ColIterator_6__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11ColIterator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.ColIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_11ColIterator_6__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_ColIterator *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11ColIterator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_ColIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.ColIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":276
 *     cdef size_t _columnit
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         rowit = RowIterator()
*/

static PyObject *__pyx_f_6amplpy_4ampl_11RowIterator_create(AMPL_DATAFRAME *__pyx_v_df, size_t __pyx_v_index) {
  struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_rowit = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/iterators.pxi":278
 *     @staticmethod
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         rowit = RowIterator()             # <<<<<<<<<<<<<<
 *         rowit._df = df
 *         rowit._index = index
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_RowIterator);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_RowIterator); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 278, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_rowit = ((struct __pyx_obj_6amplpy_4ampl_RowIterator *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/iterators.pxi":279
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         rowit = RowIterator()
 *         rowit._df = df             # <<<<<<<<<<<<<<
 *         rowit._index = index
 *         rowit._columnit = 0
*/
  __pyx_v_rowit->_df = __pyx_v_df;

  /* "amplpy/iterators.pxi":280
 *         rowit = RowIterator()
 *         rowit._df = df
 *         rowit._index = index             # <<<<<<<<<<<<<<
 *         rowit._columnit = 0
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumCols(rowit._df, &rowit._columnsize))
*/
  __pyx_v_rowit->_index = __pyx_v_index;

  /* "amplpy/iterators.pxi":281
 *         rowit._df = df
 *         rowit._index = index
 *         rowit._columnit = 0             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumCols(rowit._df, &rowit._columnsize))
 *         return rowit
*/
  __pyx_v_rowit->_columnit = 0;

  /* "amplpy/iterators.pxi":282
 *         rowit._index = index
 *         rowit._columnit = 0
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumCols(rowit._df, &rowit._columnsize))             # <<<<<<<<<<<<<<
 *         return rowit
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameGetNumCols(__pyx_v_rowit->_df, (&__pyx_v_rowit->_columnsize))); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 282, __pyx_L1_error)

  /* "amplpy/iterators.pxi":283
 *         rowit._columnit = 0
 *         PY_AMPL_CALL(campl.AMPL_DataFrameGetNumCols(rowit._df, &rowit._columnsize))
 *         return rowit             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_rowit);
  __pyx_r = ((PyObject *)__pyx_v_rowit);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":276
 *     cdef size_t _columnit
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(campl.AMPL_DATAFRAME* df, size_t index):
 *         rowit = RowIterator()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.RowIterator.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rowit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":285
 *         return rowit
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_1__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11RowIterator___iter__(((struct __pyx_obj_6amplpy_4ampl_RowIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator___iter__(struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/iterators.pxi":286
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":285
 *         return rowit
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/iterators.pxi":288
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_VARIANT* v
 *         if self._columnit >= self._columnsize:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_3__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_11RowIterator_2__next__(((struct __pyx_obj_6amplpy_4ampl_RowIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator_2__next__(struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self) {
  AMPL_VARIANT *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "amplpy/iterators.pxi":290
 *     def __next__(self):
 *         cdef campl.AMPL_VARIANT* v
 *         if self._columnit >= self._columnsize:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, self._columnit, &v))
*/
  __pyx_t_1 = (__pyx_v_self->_columnit >= __pyx_v_self->_columnsize);
  if (unlikely(__pyx_t_1)) {

    /* "amplpy/iterators.pxi":291
 *         cdef campl.AMPL_VARIANT* v
 *         if self._columnit >= self._columnsize:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, self._columnit, &v))
 *         self._columnit += 1
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "amplpy/iterators.pxi":290
 *     def __next__(self):
 *         cdef campl.AMPL_VARIANT* v
 *         if self._columnit >= self._columnsize:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, self._columnit, &v))
*/
  }

  /* "amplpy/iterators.pxi":292
 *         if self._columnit >= self._columnsize:
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, self._columnit, &v))             # <<<<<<<<<<<<<<
 *         self._columnit += 1
 *         return to_py_variant(v)
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_DataFrameElement(__pyx_v_self->_df, __pyx_v_self->_index, __pyx_v_self->_columnit, (&__pyx_v_v))); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 292, __pyx_L1_error)

  /* "amplpy/iterators.pxi":293
 *             raise StopIteration
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, self._columnit, &v))
 *         self._columnit += 1             # <<<<<<<<<<<<<<
 *         return to_py_variant(v)
*/
  __pyx_v_self->_columnit = (__pyx_v_self->_columnit + 1);

  /* "amplpy/iterators.pxi":294
 *         PY_AMPL_CALL(campl.AMPL_DataFrameElement(self._df, self._index, self._columnit, &v))
 *         self._columnit += 1
 *         return to_py_variant(v)             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/iterators.pxi":288
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_VARIANT* v
 *         if self._columnit >= self._columnsize:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("amplpy.ampl.RowIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11RowIterator_4__reduce_cython__, "RowIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11RowIterator_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11RowIterator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11RowIterator_4__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_11RowIterator_4__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_RowIterator *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.RowIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_11RowIterator_6__setstate_cython__, "RowIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_11RowIterator_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11RowIterator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11RowIterator_6__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_11RowIterator_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.RowIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_11RowIterator_6__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_RowIterator *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_11RowIterator_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_RowIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__df_cannot_be_converted_to, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.RowIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":24
 *     and the :class:`~amplpy.DataFrame` class.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Objective()
*/

static PyObject *__pyx_f_6amplpy_4ampl_9Objective_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_entity = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/objective.pxi":26
 *     @staticmethod
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Objective()             # <<<<<<<<<<<<<<
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 26, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_entity = ((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/objective.pxi":27
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Objective()
 *         entity._ampl = ampl             # <<<<<<<<<<<<<<
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __pyx_v_entity->__pyx_base._ampl = __pyx_v_ampl;

  /* "amplpy/objective.pxi":28
 *         entity = Objective()
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)             # <<<<<<<<<<<<<<
 *         entity._name = name
 *         entity._index = index
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_INCREF(__pyx_t_1);
  Py_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/objective.pxi":29
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
 *         entity._name = name             # <<<<<<<<<<<<<<
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_OBJECTIVE
*/
  __pyx_v_entity->__pyx_base._name = __pyx_v_name;

  /* "amplpy/objective.pxi":30
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
 *         entity._index = index             # <<<<<<<<<<<<<<
 *         entity.wrap_function = campl.AMPL_OBJECTIVE
 *         entity._entity = parent
*/
  __pyx_v_entity->__pyx_base._index = __pyx_v_index;

  /* "amplpy/objective.pxi":31
 *         entity._name = name
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_OBJECTIVE             # <<<<<<<<<<<<<<
 *         entity._entity = parent
 *         if entity._entity is not None:
*/
  __pyx_v_entity->__pyx_base.wrap_function = AMPL_OBJECTIVE;

  /* "amplpy/objective.pxi":32
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_OBJECTIVE
 *         entity._entity = parent             # <<<<<<<<<<<<<<
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_entity->__pyx_base._entity);
  __Pyx_DECREF(__pyx_v_entity->__pyx_base._entity);
  __pyx_v_entity->__pyx_base._entity = __pyx_v_parent;

  /* "amplpy/objective.pxi":33
 *         entity.wrap_function = campl.AMPL_OBJECTIVE
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  __pyx_t_5 = (__pyx_v_entity->__pyx_base._entity != Py_None);
  if (__pyx_t_5) {

    /* "amplpy/objective.pxi":34
 *         entity._entity = parent
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)             # <<<<<<<<<<<<<<
 *         return entity
 * 
*/
    __pyx_t_1 = __pyx_v_entity->__pyx_base._entity;
    __Pyx_INCREF(__pyx_t_1);
    Py_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/objective.pxi":33
 *         entity.wrap_function = campl.AMPL_OBJECTIVE
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  }

  /* "amplpy/objective.pxi":35
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     def value(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_entity);
  __pyx_r = ((PyObject *)__pyx_v_entity);
  goto __pyx_L0;

  /* "amplpy/objective.pxi":24
 *     and the :class:`~amplpy.DataFrame` class.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Objective()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Objective.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entity);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":37
 *         return entity
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the value of the objective.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_1value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_value, "Objective.value(self)\nGet the value of the objective.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_1value = {"value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_1value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_value};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_1value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("value (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("value", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("value", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_value(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_value(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("value", 0);

  /* "amplpy/objective.pxi":42
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VALUE, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_VALUE, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 42, __pyx_L1_error)

  /* "amplpy/objective.pxi":43
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VALUE, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def astatus(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/objective.pxi":37
 *         return entity
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the value of the objective.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Objective.value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":45
 *         return value
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the AMPL status.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_3astatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_2astatus, "Objective.astatus(self)\nReturn the AMPL status.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_3astatus = {"astatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_3astatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_2astatus};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_3astatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("astatus (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("astatus", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("astatus", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_2astatus(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_2astatus(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("astatus", 0);

  /* "amplpy/objective.pxi":51
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_ASTATUS, (&__pyx_v_value_c));

  /* "amplpy/objective.pxi":52
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/objective.pxi":53
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 53, __pyx_L1_error)

    /* "amplpy/objective.pxi":52
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/objective.pxi":54
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(13, 54, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/objective.pxi":55
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/objective.pxi":57
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def sstatus(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/objective.pxi":45
 *         return value
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the AMPL status.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Objective.astatus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":59
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the solver status.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_5sstatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_4sstatus, "Objective.sstatus(self)\nReturn the solver status.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_5sstatus = {"sstatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_5sstatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_4sstatus};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_5sstatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sstatus (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("sstatus", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("sstatus", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_4sstatus(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_4sstatus(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sstatus", 0);

  /* "amplpy/objective.pxi":65
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_SSTATUS, (&__pyx_v_value_c));

  /* "amplpy/objective.pxi":66
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/objective.pxi":67
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 67, __pyx_L1_error)

    /* "amplpy/objective.pxi":66
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/objective.pxi":68
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(13, 68, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/objective.pxi":69
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/objective.pxi":71
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def exitcode(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/objective.pxi":59
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the solver status.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Objective.sstatus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":73
 *         return value
 * 
 *     def exitcode(self):             # <<<<<<<<<<<<<<
 *         """
 *         Exit code returned by solver after most recent solve with this
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_7exitcode(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_6exitcode, "Objective.exitcode(self)\nExit code returned by solver after most recent solve with this\nobjective.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_7exitcode = {"exitcode", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_7exitcode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_6exitcode};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_7exitcode(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exitcode (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("exitcode", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("exitcode", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_6exitcode(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_6exitcode(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  int __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("exitcode", 0);

  /* "amplpy/objective.pxi":79
 *         """
 *         cdef int value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetIntSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_EXITCODE, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetIntSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_EXITCODE, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 79, __pyx_L1_error)

  /* "amplpy/objective.pxi":80
 *         cdef int value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetIntSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_EXITCODE, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def message(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/objective.pxi":73
 *         return value
 * 
 *     def exitcode(self):             # <<<<<<<<<<<<<<
 *         """
 *         Exit code returned by solver after most recent solve with this
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Objective.exitcode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":82
 *         return value
 * 
 *     def message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Result message returned by solver after most recent solve with this
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_9message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_8message, "Objective.message(self)\nResult message returned by solver after most recent solve with this\nobjective.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_9message = {"message", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_9message, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_8message};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_9message(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("message (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("message", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("message", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_8message(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_8message(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("message", 0);

  /* "amplpy/objective.pxi":89
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_MESSAGE, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_MESSAGE, (&__pyx_v_value_c));

  /* "amplpy/objective.pxi":90
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_MESSAGE, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/objective.pxi":91
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_MESSAGE, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 91, __pyx_L1_error)

    /* "amplpy/objective.pxi":90
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_MESSAGE, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/objective.pxi":92
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(13, 92, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/objective.pxi":93
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/objective.pxi":95
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def result(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/objective.pxi":82
 *         return value
 * 
 *     def message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Result message returned by solver after most recent solve with this
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Objective.message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":97
 *         return value
 * 
 *     def result(self):             # <<<<<<<<<<<<<<
 *         """
 *         Result string returned by solver after most recent solve with this
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_11result(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_10result, "Objective.result(self)\nResult string returned by solver after most recent solve with this\nobjective.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_11result = {"result", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_11result, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_10result};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_11result(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("result (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("result", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("result", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_10result(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_10result(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("result", 0);

  /* "amplpy/objective.pxi":104
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_RESULT, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_RESULT, (&__pyx_v_value_c));

  /* "amplpy/objective.pxi":105
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_RESULT, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/objective.pxi":106
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_RESULT, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 106, __pyx_L1_error)

    /* "amplpy/objective.pxi":105
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_RESULT, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/objective.pxi":107
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(13, 107, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/objective.pxi":108
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/objective.pxi":110
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def drop(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/objective.pxi":97
 *         return value
 * 
 *     def result(self):             # <<<<<<<<<<<<<<
 *         """
 *         Result string returned by solver after most recent solve with this
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Objective.result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":112
 *         return value
 * 
 *     def drop(self):             # <<<<<<<<<<<<<<
 *         """
 *         Drop this objective instance.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_13drop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_12drop, "Objective.drop(self)\nDrop this objective instance.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_13drop = {"drop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_13drop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_12drop};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_13drop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("drop (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("drop", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("drop", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_12drop(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_12drop(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("drop", 0);

  /* "amplpy/objective.pxi":116
 *         Drop this objective instance.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))             # <<<<<<<<<<<<<<
 * 
 *     def restore(self):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityDrop(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 116, __pyx_L1_error)

  /* "amplpy/objective.pxi":112
 *         return value
 * 
 *     def drop(self):             # <<<<<<<<<<<<<<
 *         """
 *         Drop this objective instance.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Objective.drop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":118
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))
 * 
 *     def restore(self):             # <<<<<<<<<<<<<<
 *         """
 *         Restore this objective (if it had been dropped, no effect otherwise).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_15restore(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_14restore, "Objective.restore(self)\nRestore this objective (if it had been dropped, no effect otherwise).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_15restore = {"restore", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_15restore, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_14restore};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_15restore(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("restore (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("restore", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("restore", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_14restore(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_14restore(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("restore", 0);

  /* "amplpy/objective.pxi":122
 *         Restore this objective (if it had been dropped, no effect otherwise).
 *         """
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))             # <<<<<<<<<<<<<<
 * 
 *     def minimization(self):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_EntityRestore(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 122, __pyx_L1_error)

  /* "amplpy/objective.pxi":118
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))
 * 
 *     def restore(self):             # <<<<<<<<<<<<<<
 *         """
 *         Restore this objective (if it had been dropped, no effect otherwise).
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Objective.restore", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/objective.pxi":124
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))
 * 
 *     def minimization(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the sense of this objective. Returns True if minimize,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_17minimization(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_16minimization, "Objective.minimization(self)\nGet the sense of this objective. Returns True if minimize,\nFalse if maximize.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_17minimization = {"minimization", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_17minimization, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_16minimization};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_17minimization(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minimization (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("minimization", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("minimization", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_16minimization(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_16minimization(struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("minimization", 0);

  /* "amplpy/objective.pxi":131
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SENSE, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_SENSE, (&__pyx_v_value_c));

  /* "amplpy/objective.pxi":132
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SENSE, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/objective.pxi":133
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SENSE, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 133, __pyx_L1_error)

    /* "amplpy/objective.pxi":132
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SENSE, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/objective.pxi":134
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(13, 134, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/objective.pxi":135
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         if value == 'minimize':
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/objective.pxi":137
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         if value == 'minimize':             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_value, __pyx_mstate_global->__pyx_n_u_minimize, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(13, 137, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/objective.pxi":138
 * 
 *         if value == 'minimize':
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "amplpy/objective.pxi":137
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         if value == 'minimize':             # <<<<<<<<<<<<<<
 *             return True
 *         else:
*/
  }

  /* "amplpy/objective.pxi":140
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "amplpy/objective.pxi":124
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))
 * 
 *     def minimization(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the sense of this objective. Returns True if minimize,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Objective.minimization", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_19__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_18__reduce_cython__, "Objective.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_19__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_19__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_18__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_19__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_18__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Objective.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_21__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Objective_20__setstate_cython__, "Objective.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Objective_21__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_21__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_20__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9Objective_21__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Objective.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Objective_20__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Objective *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Objective_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Objective *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Objective.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/outputhandler.pxi":17
 *     """
 * 
 *     def output(self, kind, msg):             # <<<<<<<<<<<<<<
 *         """
 *         This method is called when AMPL sends some output derived from
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13OutputHandler_1output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13OutputHandler_output, "OutputHandler.output(self, kind, msg)\nThis method is called when AMPL sends some output derived from\nexecuting a statement.\n\nArgs:\n   kind: kind of the output of the AMPL interpreter.\n\n   msg: text of the output by the AMPL interpreter.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13OutputHandler_1output = {"output", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13OutputHandler_1output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13OutputHandler_output};
static PyObject *__pyx_pw_6amplpy_4ampl_13OutputHandler_1output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_kind = 0;
  PyObject *__pyx_v_msg = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("output (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_kind,&__pyx_mstate_global->__pyx_n_u_msg,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 17, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(3, 17, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 17, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "output", 0) < 0) __PYX_ERR(3, 17, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("output", 1, 2, 2, i); __PYX_ERR(3, 17, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 17, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(3, 17, __pyx_L3_error)
    }
    __pyx_v_kind = values[0];
    __pyx_v_msg = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("output", 1, 2, 2, __pyx_nargs); __PYX_ERR(3, 17, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.OutputHandler.output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_13OutputHandler_output(((struct __pyx_obj_6amplpy_4ampl_OutputHandler *)__pyx_v_self), __pyx_v_kind, __pyx_v_msg);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13OutputHandler_output(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kind, PyObject *__pyx_v_msg) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("output", 0);

  /* "amplpy/outputhandler.pxi":27
 *            msg: text of the output by the AMPL interpreter.
 *         """
 *         print(msg, end="", flush=True)             # <<<<<<<<<<<<<<
 * 
 * cdef void PyOutput(campl.AMPL_OUTPUTKIND kind, const char* msg, void* usrdata) except * with gil:
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_print);
  __pyx_t_3 = __pyx_builtin_print; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, __pyx_v_msg};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_end, __pyx_mstate_global->__pyx_kp_u__3, __pyx_t_5, __pyx_callargs+2, 0) < 0) __PYX_ERR(3, 27, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_flush, Py_True, __pyx_t_5, __pyx_callargs+2, 1) < 0) __PYX_ERR(3, 27, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/outputhandler.pxi":17
 *     """
 * 
 *     def output(self, kind, msg):             # <<<<<<<<<<<<<<
 *         """
 *         This method is called when AMPL sends some output derived from
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.OutputHandler.output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13OutputHandler_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13OutputHandler_2__reduce_cython__, "OutputHandler.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13OutputHandler_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13OutputHandler_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13OutputHandler_2__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_13OutputHandler_3__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_13OutputHandler_2__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_OutputHandler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13OutputHandler_2__reduce_cython__(struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
  __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(8, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, None), state
*/
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_OutputHandler); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(8, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, None), state
 *     else:
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_OutputHandler__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_OutputHandler); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(8, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.OutputHandler.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_OutputHandler__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_13OutputHandler_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_13OutputHandler_4__setstate_cython__, "OutputHandler.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_13OutputHandler_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13OutputHandler_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13OutputHandler_4__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_13OutputHandler_5__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.OutputHandler.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_13OutputHandler_4__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_OutputHandler *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_13OutputHandler_4__setstate_cython__(struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_OutputHandler__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(8, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6amplpy_4ampl___pyx_unpickle_OutputHandler__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_OutputHandler__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.OutputHandler.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/outputhandler.pxi":29
 *         print(msg, end="", flush=True)
 * 
 * cdef void PyOutput(campl.AMPL_OUTPUTKIND kind, const char* msg, void* usrdata) except * with gil:             # <<<<<<<<<<<<<<
 *     PyOutputHandler = <OutputHandler>usrdata
 *     PyOutputHandler.output(kind, msg.decode('utf-8'))
*/

static void __pyx_f_6amplpy_4ampl_PyOutput(AMPL_OUTPUTKIND __pyx_v_kind, char const *__pyx_v_msg, void *__pyx_v_usrdata) {
  struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v_PyOutputHandler = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("PyOutput", 0);

  /* "amplpy/outputhandler.pxi":30
 * 
 * cdef void PyOutput(campl.AMPL_OUTPUTKIND kind, const char* msg, void* usrdata) except * with gil:
 *     PyOutputHandler = <OutputHandler>usrdata             # <<<<<<<<<<<<<<
 *     PyOutputHandler.output(kind, msg.decode('utf-8'))
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_usrdata);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_PyOutputHandler = ((struct __pyx_obj_6amplpy_4ampl_OutputHandler *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/outputhandler.pxi":31
 * cdef void PyOutput(campl.AMPL_OUTPUTKIND kind, const char* msg, void* usrdata) except * with gil:
 *     PyOutputHandler = <OutputHandler>usrdata
 *     PyOutputHandler.output(kind, msg.decode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 * class Kind(object):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_PyOutputHandler);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(__pyx_v_kind); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_ssize_strlen(__pyx_v_msg); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(3, 31, __pyx_L1_error)
  __pyx_t_5 = __Pyx_decode_c_string(__pyx_v_msg, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_output, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/outputhandler.pxi":29
 *         print(msg, end="", flush=True)
 * 
 * cdef void PyOutput(campl.AMPL_OUTPUTKIND kind, const char* msg, void* usrdata) except * with gil:             # <<<<<<<<<<<<<<
 *     PyOutputHandler = <OutputHandler>usrdata
 *     PyOutputHandler.output(kind, msg.decode('utf-8'))
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.PyOutput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_PyOutputHandler);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "amplpy/parameter.pxi":42
 *     and an object of class :class:`~amplpy.DataFrame`.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Parameter()
*/

static PyObject *__pyx_f_6amplpy_4ampl_9Parameter_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_entity = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/parameter.pxi":44
 *     @staticmethod
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Parameter()             # <<<<<<<<<<<<<<
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 44, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_entity = ((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/parameter.pxi":45
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Parameter()
 *         entity._ampl = ampl             # <<<<<<<<<<<<<<
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __pyx_v_entity->__pyx_base._ampl = __pyx_v_ampl;

  /* "amplpy/parameter.pxi":46
 *         entity = Parameter()
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)             # <<<<<<<<<<<<<<
 *         entity._name = name
 *         entity._index = index
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_INCREF(__pyx_t_1);
  Py_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/parameter.pxi":47
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
 *         entity._name = name             # <<<<<<<<<<<<<<
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_PARAMETER
*/
  __pyx_v_entity->__pyx_base._name = __pyx_v_name;

  /* "amplpy/parameter.pxi":48
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
 *         entity._index = index             # <<<<<<<<<<<<<<
 *         entity.wrap_function = campl.AMPL_PARAMETER
 *         entity._entity = parent
*/
  __pyx_v_entity->__pyx_base._index = __pyx_v_index;

  /* "amplpy/parameter.pxi":49
 *         entity._name = name
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_PARAMETER             # <<<<<<<<<<<<<<
 *         entity._entity = parent
 *         if entity._entity is not None:
*/
  __pyx_v_entity->__pyx_base.wrap_function = AMPL_PARAMETER;

  /* "amplpy/parameter.pxi":50
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_PARAMETER
 *         entity._entity = parent             # <<<<<<<<<<<<<<
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_entity->__pyx_base._entity);
  __Pyx_DECREF(__pyx_v_entity->__pyx_base._entity);
  __pyx_v_entity->__pyx_base._entity = __pyx_v_parent;

  /* "amplpy/parameter.pxi":51
 *         entity.wrap_function = campl.AMPL_PARAMETER
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  __pyx_t_5 = (__pyx_v_entity->__pyx_base._entity != Py_None);
  if (__pyx_t_5) {

    /* "amplpy/parameter.pxi":52
 *         entity._entity = parent
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)             # <<<<<<<<<<<<<<
 *         return entity
 * 
*/
    __pyx_t_1 = __pyx_v_entity->__pyx_base._entity;
    __Pyx_INCREF(__pyx_t_1);
    Py_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/parameter.pxi":51
 *         entity.wrap_function = campl.AMPL_PARAMETER
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  }

  /* "amplpy/parameter.pxi":53
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_entity);
  __pyx_r = ((PyObject *)__pyx_v_entity);
  goto __pyx_L0;

  /* "amplpy/parameter.pxi":42
 *     and an object of class :class:`~amplpy.DataFrame`.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Parameter()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entity);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":55
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.set(index, value)
 * 
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_9Parameter_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6amplpy_4ampl_9Parameter_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter___setitem__(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_9Parameter___setitem__(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/parameter.pxi":56
 * 
 *     def __setitem__(self, index, value):
 *         self.set(index, value)             # <<<<<<<<<<<<<<
 * 
 *     def is_symbolic(self):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_index, __pyx_v_value};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/parameter.pxi":55
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.set(index, value)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":58
 *         self.set(index, value)
 * 
 *     def is_symbolic(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the parameter is declared as symbolic (can store both
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_3is_symbolic(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Parameter_2is_symbolic, "Parameter.is_symbolic(self)\nReturns True if the parameter is declared as symbolic (can store both\nnumerical and string values).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Parameter_3is_symbolic = {"is_symbolic", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_3is_symbolic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_2is_symbolic};
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_3is_symbolic(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_symbolic (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_symbolic", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_symbolic", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_2is_symbolic(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_2is_symbolic(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self) {
  bool __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_symbolic", 0);

  /* "amplpy/parameter.pxi":64
 *         """
 *         cdef bool_c value
 *         PY_AMPL_CALL(campl.AMPL_ParameterIsSymbolic(self._ampl._c_ampl, self._name, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ParameterIsSymbolic(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 64, __pyx_L1_error)

  /* "amplpy/parameter.pxi":65
 *         cdef bool_c value
 *         PY_AMPL_CALL(campl.AMPL_ParameterIsSymbolic(self._ampl._c_ampl, self._name, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def has_default(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/parameter.pxi":58
 *         self.set(index, value)
 * 
 *     def is_symbolic(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the parameter is declared as symbolic (can store both
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.is_symbolic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":67
 *         return value
 * 
 *     def has_default(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check if the parameter has a default initial value. In case of the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_5has_default(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Parameter_4has_default, "Parameter.has_default(self)\nCheck if the parameter has a default initial value. In case of the\nfollowing AMPL code:\n\n.. code-block:: ampl\n\n    param a;\n    param b default a;\n\nthe function will return true for parameter ``b``.\n\nReturns:\n    True if the parameter has a default initial value. Please note\n    that if the parameter has a default expression which refers to\n    another parameter which value is not defined, this will return\n    True.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Parameter_5has_default = {"has_default", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_5has_default, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_4has_default};
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_5has_default(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_default (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("has_default", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("has_default", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_4has_default(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_4has_default(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self) {
  bool __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_default", 0);

  /* "amplpy/parameter.pxi":86
 *         """
 *         cdef bool_c value
 *         PY_AMPL_CALL(campl.AMPL_ParameterHasDefault(self._ampl._c_ampl, self._name, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ParameterHasDefault(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 86, __pyx_L1_error)

  /* "amplpy/parameter.pxi":87
 *         cdef bool_c value
 *         PY_AMPL_CALL(campl.AMPL_ParameterHasDefault(self._ampl._c_ampl, self._name, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/parameter.pxi":67
 *         return value
 * 
 *     def has_default(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check if the parameter has a default initial value. In case of the
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.has_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":89
 *         return value
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if not isinstance(index, (tuple, list)):
 *             index = [index]
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_6__getitem__(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_6__getitem__(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_index) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_TUPLE *__pyx_v_tuple_c;
  char *__pyx_v_expression;
  AMPL_VARIANT *__pyx_v_v;
  PyObject *__pyx_v_py_variant = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  AMPL_TUPLE *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "amplpy/parameter.pxi":90
 * 
 *     def __getitem__(self, index):
 *         if not isinstance(index, (tuple, list)):             # <<<<<<<<<<<<<<
 *             index = [index]
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_index); 
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyList_Check(__pyx_v_index); 
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":91
 *     def __getitem__(self, index):
 *         if not isinstance(index, (tuple, list)):
 *             index = [index]             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_TUPLE* tuple_c =  to_c_tuple(index)
*/
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(14, 91, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "amplpy/parameter.pxi":90
 * 
 *     def __getitem__(self, index):
 *         if not isinstance(index, (tuple, list)):             # <<<<<<<<<<<<<<
 *             index = [index]
 *         cdef campl.AMPL_ERRORINFO* errorinfo
*/
  }

  /* "amplpy/parameter.pxi":93
 *             index = [index]
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_TUPLE* tuple_c =  to_c_tuple(index)             # <<<<<<<<<<<<<<
 *         cdef char* expression
 *         cdef campl.AMPL_VARIANT* v
*/
  __pyx_t_4 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_index); if (unlikely(__pyx_t_4 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(14, 93, __pyx_L1_error)
  __pyx_v_tuple_c = __pyx_t_4;

  /* "amplpy/parameter.pxi":96
 *         cdef char* expression
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &expression)             # <<<<<<<<<<<<<<
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:
*/
  __pyx_v_errorinfo = AMPL_InstanceGetName(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_tuple_c, (&__pyx_v_expression));

  /* "amplpy/parameter.pxi":97
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &expression)
 *         campl.AMPL_TupleFree(&tuple_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  (void)(AMPL_TupleFree((&__pyx_v_tuple_c)));

  /* "amplpy/parameter.pxi":98
 *         errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &expression)
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, expression, &v)
*/
  __pyx_t_2 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":99
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, expression, &v)
 *         campl.AMPL_StringFree(&expression)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 99, __pyx_L1_error)

    /* "amplpy/parameter.pxi":98
 *         errorinfo = campl.AMPL_InstanceGetName(self._ampl._c_ampl, self._name, tuple_c, &expression)
 *         campl.AMPL_TupleFree(&tuple_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, expression, &v)
*/
  }

  /* "amplpy/parameter.pxi":100
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, expression, &v)             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&expression)
 *         if errorinfo:
*/
  __pyx_v_errorinfo = AMPL_GetValue(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_expression, (&__pyx_v_v));

  /* "amplpy/parameter.pxi":101
 *             PY_AMPL_CALL(errorinfo)
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, expression, &v)
 *         campl.AMPL_StringFree(&expression)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  (void)(AMPL_StringFree((&__pyx_v_expression)));

  /* "amplpy/parameter.pxi":102
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, expression, &v)
 *         campl.AMPL_StringFree(&expression)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)
*/
  __pyx_t_2 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":103
 *         campl.AMPL_StringFree(&expression)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         py_variant = to_py_variant(v)
 *         campl.AMPL_VariantFree(&v)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 103, __pyx_L1_error)

    /* "amplpy/parameter.pxi":102
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, expression, &v)
 *         campl.AMPL_StringFree(&expression)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)
*/
  }

  /* "amplpy/parameter.pxi":104
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantFree(&v)
 *         return py_variant
*/
  __pyx_t_3 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_py_variant = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "amplpy/parameter.pxi":105
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)
 *         campl.AMPL_VariantFree(&v)             # <<<<<<<<<<<<<<
 *         return py_variant
 * 
*/
  (void)(AMPL_VariantFree((&__pyx_v_v)));

  /* "amplpy/parameter.pxi":106
 *         py_variant = to_py_variant(v)
 *         campl.AMPL_VariantFree(&v)
 *         return py_variant             # <<<<<<<<<<<<<<
 * 
 *     def value(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_py_variant);
  __pyx_r = __pyx_v_py_variant;
  goto __pyx_L0;

  /* "amplpy/parameter.pxi":89
 *         return value
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         if not isinstance(index, (tuple, list)):
 *             index = [index]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_variant);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":108
 *         return py_variant
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the value of this parameter. Valid only for non-indexed parameters.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_9value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Parameter_8value, "Parameter.value(self)\nGet the value of this parameter. Valid only for non-indexed parameters.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Parameter_9value = {"value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_9value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_8value};
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_9value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("value (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("value", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("value", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_8value(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_8value(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_VARIANT *__pyx_v_v;
  PyObject *__pyx_v_py_variant = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("value", 0);

  /* "amplpy/parameter.pxi":114
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, self._name, &v)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_GetValue(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, (&__pyx_v_v));

  /* "amplpy/parameter.pxi":115
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, self._name, &v)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/parameter.pxi":116
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, self._name, &v)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         py_variant = to_py_variant(v)
 *         campl.AMPL_VariantFree(&v)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 116, __pyx_L1_error)

    /* "amplpy/parameter.pxi":115
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_GetValue(self._ampl._c_ampl, self._name, &v)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)
*/
  }

  /* "amplpy/parameter.pxi":117
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantFree(&v)
 *         return py_variant
*/
  __pyx_t_2 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_py_variant = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/parameter.pxi":118
 *             PY_AMPL_CALL(errorinfo)
 *         py_variant = to_py_variant(v)
 *         campl.AMPL_VariantFree(&v)             # <<<<<<<<<<<<<<
 *         return py_variant
 * 
*/
  (void)(AMPL_VariantFree((&__pyx_v_v)));

  /* "amplpy/parameter.pxi":119
 *         py_variant = to_py_variant(v)
 *         campl.AMPL_VariantFree(&v)
 *         return py_variant             # <<<<<<<<<<<<<<
 * 
 *     def set(self, *args):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_py_variant);
  __pyx_r = __pyx_v_py_variant;
  goto __pyx_L0;

  /* "amplpy/parameter.pxi":108
 *         return py_variant
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the value of this parameter. Valid only for non-indexed parameters.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_variant);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":121
 *         return py_variant
 * 
 *     def set(self, *args):             # <<<<<<<<<<<<<<
 *         """
 *         Set the value of a single instance of this parameter.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_11set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Parameter_10set, "Parameter.set(self, *args)\nSet the value of a single instance of this parameter.\n\nArgs:\n    args: value if the parameter is scalar, index and value\n    otherwise.\n\nRaises:\n    RuntimeError: If the entity has been deleted in the underlying\n    AMPL.\n\n    TypeError: If the parameter is not scalar and the index is not\n    provided.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Parameter_11set = {"set", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_11set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_10set};
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_11set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("set", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_10set(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_10set(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_args) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_TUPLE *__pyx_v_index_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  char const *__pyx_t_8;
  AMPL_TUPLE *__pyx_t_9;
  char const *__pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);

  /* "amplpy/parameter.pxi":136
 *             provided.
 *         """
 *         assert len(args) in (1, 2)             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_TUPLE* index_c
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(14, 136, __pyx_L1_error)
    __pyx_t_3 = (__pyx_t_1 == 1);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_t_1 == 2);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    __pyx_t_3 = __pyx_t_2;
    if (unlikely(!__pyx_t_3)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(14, 136, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(14, 136, __pyx_L1_error)
  #endif

  /* "amplpy/parameter.pxi":139
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_TUPLE* index_c
 *         if len(args) == 1:             # <<<<<<<<<<<<<<
 *             value = args[0]
 * 
*/
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(14, 139, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_1 == 1);
  if (__pyx_t_3) {

    /* "amplpy/parameter.pxi":140
 *         cdef campl.AMPL_TUPLE* index_c
 *         if len(args) == 1:
 *             value = args[0]             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(value, Real):
*/
    __pyx_t_4 = __Pyx_PyTuple_GET_ITEM(__pyx_v_args, 0);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_value = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "amplpy/parameter.pxi":142
 *             value = args[0]
 * 
 *             if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterSetNumeric(self._ampl._c_ampl, self._name, float(value))
 *             elif isinstance(value, str):
*/
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(14, 142, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "amplpy/parameter.pxi":143
 * 
 *             if isinstance(value, Real):
 *                 errorinfo = campl.AMPL_ParameterSetNumeric(self._ampl._c_ampl, self._name, float(value))             # <<<<<<<<<<<<<<
 *             elif isinstance(value, str):
 *                 errorinfo = campl.AMPL_ParameterSetString(self._ampl._c_ampl, self._name, value.encode('utf-8'))
*/
      __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_5 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(14, 143, __pyx_L1_error)
      __pyx_v_errorinfo = AMPL_ParameterSetNumeric(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_t_5);

      /* "amplpy/parameter.pxi":142
 *             value = args[0]
 * 
 *             if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterSetNumeric(self._ampl._c_ampl, self._name, float(value))
 *             elif isinstance(value, str):
*/
      goto __pyx_L6;
    }

    /* "amplpy/parameter.pxi":144
 *             if isinstance(value, Real):
 *                 errorinfo = campl.AMPL_ParameterSetNumeric(self._ampl._c_ampl, self._name, float(value))
 *             elif isinstance(value, str):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterSetString(self._ampl._c_ampl, self._name, value.encode('utf-8'))
 *             else:
*/
    __pyx_t_3 = PyUnicode_Check(__pyx_v_value); 
    if (likely(__pyx_t_3)) {

      /* "amplpy/parameter.pxi":145
 *                 errorinfo = campl.AMPL_ParameterSetNumeric(self._ampl._c_ampl, self._name, float(value))
 *             elif isinstance(value, str):
 *                 errorinfo = campl.AMPL_ParameterSetString(self._ampl._c_ampl, self._name, value.encode('utf-8'))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError
*/
      __pyx_t_6 = __pyx_v_value;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 145, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(14, 145, __pyx_L1_error)
      __pyx_v_errorinfo = AMPL_ParameterSetString(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "amplpy/parameter.pxi":144
 *             if isinstance(value, Real):
 *                 errorinfo = campl.AMPL_ParameterSetNumeric(self._ampl._c_ampl, self._name, float(value))
 *             elif isinstance(value, str):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterSetString(self._ampl._c_ampl, self._name, value.encode('utf-8'))
 *             else:
*/
      goto __pyx_L6;
    }

    /* "amplpy/parameter.pxi":147
 *                 errorinfo = campl.AMPL_ParameterSetString(self._ampl._c_ampl, self._name, value.encode('utf-8'))
 *             else:
 *                 raise TypeError             # <<<<<<<<<<<<<<
 *         else:
 *             index, value = args
*/
    /*else*/ {
      __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
      __PYX_ERR(14, 147, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "amplpy/parameter.pxi":139
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_TUPLE* index_c
 *         if len(args) == 1:             # <<<<<<<<<<<<<<
 *             value = args[0]
 * 
*/
    goto __pyx_L5;
  }

  /* "amplpy/parameter.pxi":149
 *                 raise TypeError
 *         else:
 *             index, value = args             # <<<<<<<<<<<<<<
 *             if not isinstance(index, (tuple, list)):
 *                 index = [index]
*/
  /*else*/ {
    if (1) {
      PyObject* sequence = __pyx_v_args;
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(14, 149, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    }
    __pyx_v_index = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_value = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "amplpy/parameter.pxi":150
 *         else:
 *             index, value = args
 *             if not isinstance(index, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 index = [index]
 *             index_c = to_c_tuple(index)
*/
    __pyx_t_2 = PyTuple_Check(__pyx_v_index); 
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = PyList_Check(__pyx_v_index); 
    __pyx_t_3 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    __pyx_t_2 = (!__pyx_t_3);
    if (__pyx_t_2) {

      /* "amplpy/parameter.pxi":151
 *             index, value = args
 *             if not isinstance(index, (tuple, list)):
 *                 index = [index]             # <<<<<<<<<<<<<<
 *             index_c = to_c_tuple(index)
 *             if isinstance(value, Real):
*/
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_index);
      __Pyx_GIVEREF(__pyx_v_index);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_index) != (0)) __PYX_ERR(14, 151, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "amplpy/parameter.pxi":150
 *         else:
 *             index, value = args
 *             if not isinstance(index, (tuple, list)):             # <<<<<<<<<<<<<<
 *                 index = [index]
 *             index_c = to_c_tuple(index)
*/
    }

    /* "amplpy/parameter.pxi":152
 *             if not isinstance(index, (tuple, list)):
 *                 index = [index]
 *             index_c = to_c_tuple(index)             # <<<<<<<<<<<<<<
 *             if isinstance(value, Real):
 *                 errorinfo = campl.AMPL_ParameterInstanceSetNumericValue(self._ampl._c_ampl, self._name, index_c, float(value))
*/
    __pyx_t_9 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_index); if (unlikely(__pyx_t_9 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(14, 152, __pyx_L1_error)
    __pyx_v_index_c = __pyx_t_9;

    /* "amplpy/parameter.pxi":153
 *                 index = [index]
 *             index_c = to_c_tuple(index)
 *             if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterInstanceSetNumericValue(self._ampl._c_ampl, self._name, index_c, float(value))
 *                 campl.AMPL_TupleFree(&index_c)
*/
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_6); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(14, 153, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_2) {

      /* "amplpy/parameter.pxi":154
 *             index_c = to_c_tuple(index)
 *             if isinstance(value, Real):
 *                 errorinfo = campl.AMPL_ParameterInstanceSetNumericValue(self._ampl._c_ampl, self._name, index_c, float(value))             # <<<<<<<<<<<<<<
 *                 campl.AMPL_TupleFree(&index_c)
 *             elif isinstance(value, str):
*/
      __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_5 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(14, 154, __pyx_L1_error)
      __pyx_v_errorinfo = AMPL_ParameterInstanceSetNumericValue(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_index_c, __pyx_t_5);

      /* "amplpy/parameter.pxi":155
 *             if isinstance(value, Real):
 *                 errorinfo = campl.AMPL_ParameterInstanceSetNumericValue(self._ampl._c_ampl, self._name, index_c, float(value))
 *                 campl.AMPL_TupleFree(&index_c)             # <<<<<<<<<<<<<<
 *             elif isinstance(value, str):
 *                 errorinfo = campl.AMPL_ParameterInstanceSetStringValue(self._ampl._c_ampl, self._name, index_c, value.encode('utf-8'))
*/
      (void)(AMPL_TupleFree((&__pyx_v_index_c)));

      /* "amplpy/parameter.pxi":153
 *                 index = [index]
 *             index_c = to_c_tuple(index)
 *             if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterInstanceSetNumericValue(self._ampl._c_ampl, self._name, index_c, float(value))
 *                 campl.AMPL_TupleFree(&index_c)
*/
      goto __pyx_L10;
    }

    /* "amplpy/parameter.pxi":156
 *                 errorinfo = campl.AMPL_ParameterInstanceSetNumericValue(self._ampl._c_ampl, self._name, index_c, float(value))
 *                 campl.AMPL_TupleFree(&index_c)
 *             elif isinstance(value, str):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterInstanceSetStringValue(self._ampl._c_ampl, self._name, index_c, value.encode('utf-8'))
 *                 campl.AMPL_TupleFree(&index_c)
*/
    __pyx_t_2 = PyUnicode_Check(__pyx_v_value); 
    if (likely(__pyx_t_2)) {

      /* "amplpy/parameter.pxi":157
 *                 campl.AMPL_TupleFree(&index_c)
 *             elif isinstance(value, str):
 *                 errorinfo = campl.AMPL_ParameterInstanceSetStringValue(self._ampl._c_ampl, self._name, index_c, value.encode('utf-8'))             # <<<<<<<<<<<<<<
 *                 campl.AMPL_TupleFree(&index_c)
 *             else:
*/
      __pyx_t_4 = __pyx_v_value;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_utf_8};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(14, 157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_6); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(14, 157, __pyx_L1_error)
      __pyx_v_errorinfo = AMPL_ParameterInstanceSetStringValue(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_index_c, __pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "amplpy/parameter.pxi":158
 *             elif isinstance(value, str):
 *                 errorinfo = campl.AMPL_ParameterInstanceSetStringValue(self._ampl._c_ampl, self._name, index_c, value.encode('utf-8'))
 *                 campl.AMPL_TupleFree(&index_c)             # <<<<<<<<<<<<<<
 *             else:
 *                 campl.AMPL_TupleFree(&index_c)
*/
      (void)(AMPL_TupleFree((&__pyx_v_index_c)));

      /* "amplpy/parameter.pxi":156
 *                 errorinfo = campl.AMPL_ParameterInstanceSetNumericValue(self._ampl._c_ampl, self._name, index_c, float(value))
 *                 campl.AMPL_TupleFree(&index_c)
 *             elif isinstance(value, str):             # <<<<<<<<<<<<<<
 *                 errorinfo = campl.AMPL_ParameterInstanceSetStringValue(self._ampl._c_ampl, self._name, index_c, value.encode('utf-8'))
 *                 campl.AMPL_TupleFree(&index_c)
*/
      goto __pyx_L10;
    }

    /* "amplpy/parameter.pxi":160
 *                 campl.AMPL_TupleFree(&index_c)
 *             else:
 *                 campl.AMPL_TupleFree(&index_c)             # <<<<<<<<<<<<<<
 *                 raise TypeError
 *         if errorinfo:
*/
    /*else*/ {
      (void)(AMPL_TupleFree((&__pyx_v_index_c)));

      /* "amplpy/parameter.pxi":161
 *             else:
 *                 campl.AMPL_TupleFree(&index_c)
 *                 raise TypeError             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
      __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
      __PYX_ERR(14, 161, __pyx_L1_error)
    }
    __pyx_L10:;
  }
  __pyx_L5:;

  /* "amplpy/parameter.pxi":162
 *                 campl.AMPL_TupleFree(&index_c)
 *                 raise TypeError
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  __pyx_t_2 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":163
 *                 raise TypeError
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *     def set_values(self, values):
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 163, __pyx_L1_error)

    /* "amplpy/parameter.pxi":162
 *                 campl.AMPL_TupleFree(&index_c)
 *                 raise TypeError
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  }

  /* "amplpy/parameter.pxi":121
 *         return py_variant
 * 
 *     def set(self, *args):             # <<<<<<<<<<<<<<
 *         """
 *         Set the value of a single instance of this parameter.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":165
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Assign the values (string or float) to the parameter instances with the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_13set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Parameter_12set_values, "Parameter.set_values(self, values)\nAssign the values (string or float) to the parameter instances with the\nspecified indices, equivalent to the AMPL code:\n\n.. code-block:: ampl\n\n    let {i in indices} par[i] := values[i];\n\nArgs:\n    values: list, dictionary or :class:`~amplpy.DataFrame` with the\n    indices and the values to be set.\n\nRaises:\n    TypeError: If called on a scalar parameter.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Parameter_13set_values = {"set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_13set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_12set_values};
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_13set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_values = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_values,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(14, 165, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 165, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_values", 0) < 0) __PYX_ERR(14, 165, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_values", 1, 1, 1, i); __PYX_ERR(14, 165, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(14, 165, __pyx_L3_error)
    }
    __pyx_v_values = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_values", 1, 1, 1, __pyx_nargs); __PYX_ERR(14, 165, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Parameter.set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_12set_values(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self), __pyx_v_values);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/parameter.pxi":198
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))
 *         elif isinstance(values, Iterable):
 *             if all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_10set_values_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_9_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(14, 198, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9Parameter_10set_values_2generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_set_values_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(14, 198, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Parameter.set_values.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(14, 198, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(14, 198, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 198, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 198, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 198, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 198, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(14, 198, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = PyUnicode_Check(__pyx_cur_scope->__pyx_v_value); 
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_5generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/parameter.pxi":204
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_10set_values_3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_10_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(14, 204, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_9Parameter_10set_values_5generator7, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_set_values_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(14, 204, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Parameter.set_values.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_5generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(14, 204, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(14, 204, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(14, 204, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 204, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(14, 204, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 204, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(14, 204, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(14, 204, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/parameter.pxi":165
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Assign the values (string or float) to the parameter instances with the
*/

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_12set_values(struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, PyObject *__pyx_v_values) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  PyObject *__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_2generator6 = 0;
  PyObject *__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_5generator7 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  AMPL_ERRORINFO *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_values", 0);
  __Pyx_INCREF(__pyx_v_values);

  /* "amplpy/parameter.pxi":182
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         if isinstance(values, dict):             # <<<<<<<<<<<<<<
 *             if not values:
 *                 return
*/
  __pyx_t_1 = PyDict_Check(__pyx_v_values); 
  if (__pyx_t_1) {

    /* "amplpy/parameter.pxi":183
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         if isinstance(values, dict):
 *             if not values:             # <<<<<<<<<<<<<<
 *                 return
 *             errorinfo = setValuesPyDict(self._ampl._c_ampl, self._name, values)
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_values); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(14, 183, __pyx_L1_error)
    __pyx_t_2 = (!__pyx_t_1);
    if (__pyx_t_2) {

      /* "amplpy/parameter.pxi":184
 *         if isinstance(values, dict):
 *             if not values:
 *                 return             # <<<<<<<<<<<<<<
 *             errorinfo = setValuesPyDict(self._ampl._c_ampl, self._name, values)
 *             if errorinfo:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "amplpy/parameter.pxi":183
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         if isinstance(values, dict):
 *             if not values:             # <<<<<<<<<<<<<<
 *                 return
 *             errorinfo = setValuesPyDict(self._ampl._c_ampl, self._name, values)
*/
    }

    /* "amplpy/parameter.pxi":185
 *             if not values:
 *                 return
 *             errorinfo = setValuesPyDict(self._ampl._c_ampl, self._name, values)             # <<<<<<<<<<<<<<
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
*/
    if (!(likely(PyDict_CheckExact(__pyx_v_values))||((__pyx_v_values) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v_values))) __PYX_ERR(14, 185, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6amplpy_4ampl_setValuesPyDict(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, ((PyObject*)__pyx_v_values)); if (unlikely(__pyx_t_3 == ((AMPL_ERRORINFO *)0) && PyErr_Occurred())) __PYX_ERR(14, 185, __pyx_L1_error)
    __pyx_v_errorinfo = __pyx_t_3;

    /* "amplpy/parameter.pxi":186
 *                 return
 *             errorinfo = setValuesPyDict(self._ampl._c_ampl, self._name, values)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(values, DataFrame):
*/
    __pyx_t_2 = (__pyx_v_errorinfo != 0);
    if (__pyx_t_2) {

      /* "amplpy/parameter.pxi":187
 *             errorinfo = setValuesPyDict(self._ampl._c_ampl, self._name, values)
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         elif isinstance(values, DataFrame):
 *             Entity.set_values(self, values)
*/
      __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 187, __pyx_L1_error)

      /* "amplpy/parameter.pxi":186
 *                 return
 *             errorinfo = setValuesPyDict(self._ampl._c_ampl, self._name, values)
 *             if errorinfo:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(values, DataFrame):
*/
    }

    /* "amplpy/parameter.pxi":182
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         if isinstance(values, dict):             # <<<<<<<<<<<<<<
 *             if not values:
 *                 return
*/
    goto __pyx_L3;
  }

  /* "amplpy/parameter.pxi":188
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(values, DataFrame):             # <<<<<<<<<<<<<<
 *             Entity.set_values(self, values)
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):
*/
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_values, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame); 
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":189
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(values, DataFrame):
 *             Entity.set_values(self, values)             # <<<<<<<<<<<<<<
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):
 *             Entity.set_values(self, values)
*/
    __pyx_t_5 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_values};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "amplpy/parameter.pxi":188
 *             if errorinfo:
 *                 PY_AMPL_CALL(errorinfo)
 *         elif isinstance(values, DataFrame):             # <<<<<<<<<<<<<<
 *             Entity.set_values(self, values)
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):
*/
    goto __pyx_L3;
  }

  /* "amplpy/parameter.pxi":190
 *         elif isinstance(values, DataFrame):
 *             Entity.set_values(self, values)
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *             Entity.set_values(self, values)
 *         elif np is not None and isinstance(values, np.ndarray):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__pyx_t_4 != Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L6_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = PyObject_IsInstance(__pyx_v_values, __pyx_t_5); 
  if (!__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_8 = PyObject_IsInstance(__pyx_v_values, __pyx_t_7); 
  __pyx_t_1 = __pyx_t_8;
  __pyx_L8_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":191
 *             Entity.set_values(self, values)
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):
 *             Entity.set_values(self, values)             # <<<<<<<<<<<<<<
 *         elif np is not None and isinstance(values, np.ndarray):
 *             if len(values.shape) <= 1:
*/
    __pyx_t_7 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_values};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "amplpy/parameter.pxi":190
 *         elif isinstance(values, DataFrame):
 *             Entity.set_values(self, values)
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *             Entity.set_values(self, values)
 *         elif np is not None and isinstance(values, np.ndarray):
*/
    goto __pyx_L3;
  }

  /* "amplpy/parameter.pxi":192
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):
 *             Entity.set_values(self, values)
 *         elif np is not None and isinstance(values, np.ndarray):             # <<<<<<<<<<<<<<
 *             if len(values.shape) <= 1:
 *                 self.set_values(values.tolist())
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = (__pyx_t_5 != Py_None);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L10_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ndarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_values, __pyx_t_7); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(14, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":193
 *             Entity.set_values(self, values)
 *         elif np is not None and isinstance(values, np.ndarray):
 *             if len(values.shape) <= 1:             # <<<<<<<<<<<<<<
 *                 self.set_values(values.tolist())
 *             else:
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_values, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(14, 193, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = (__pyx_t_9 <= 1);
    if (__pyx_t_2) {

      /* "amplpy/parameter.pxi":194
 *         elif np is not None and isinstance(values, np.ndarray):
 *             if len(values.shape) <= 1:
 *                 self.set_values(values.tolist())             # <<<<<<<<<<<<<<
 *             else:
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))
*/
      __pyx_t_5 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_10 = __pyx_v_values;
      __Pyx_INCREF(__pyx_t_10);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 194, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 194, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "amplpy/parameter.pxi":193
 *             Entity.set_values(self, values)
 *         elif np is not None and isinstance(values, np.ndarray):
 *             if len(values.shape) <= 1:             # <<<<<<<<<<<<<<
 *                 self.set_values(values.tolist())
 *             else:
*/
      goto __pyx_L12;
    }

    /* "amplpy/parameter.pxi":196
 *                 self.set_values(values.tolist())
 *             else:
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))             # <<<<<<<<<<<<<<
 *         elif isinstance(values, Iterable):
 *             if all(isinstance(value, str) for value in values):
*/
    /*else*/ {
      __pyx_t_4 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_itertools); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_chain); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = __pyx_v_values;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tolist, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 196, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_t_11 = __Pyx_PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(14, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(14, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(14, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_11};
        __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 196, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L12:;

    /* "amplpy/parameter.pxi":192
 *         elif pd is not None and isinstance(values, (pd.DataFrame, pd.Series)):
 *             Entity.set_values(self, values)
 *         elif np is not None and isinstance(values, np.ndarray):             # <<<<<<<<<<<<<<
 *             if len(values.shape) <= 1:
 *                 self.set_values(values.tolist())
*/
    goto __pyx_L3;
  }

  /* "amplpy/parameter.pxi":197
 *             else:
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))
 *         elif isinstance(values, Iterable):             # <<<<<<<<<<<<<<
 *             if all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_values, __pyx_t_7); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(14, 197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_2) {

    /* "amplpy/parameter.pxi":198
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))
 *         elif isinstance(values, Iterable):
 *             if all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/
    __pyx_t_7 = __pyx_pf_6amplpy_4ampl_9Parameter_10set_values_genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_11 = __Pyx_Generator_GetInlinedResult(__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(14, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(14, 198, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_2) {

      /* "amplpy/parameter.pxi":199
 *         elif isinstance(values, Iterable):
 *             if all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *                     values = list(values)
 *                 errorinfo = setValuesParamStr(self._ampl._c_ampl, self._name, values)
*/
      __pyx_t_1 = PyList_Check(__pyx_v_values); 
      if (!__pyx_t_1) {
      } else {
        __pyx_t_2 = __pyx_t_1;
        goto __pyx_L15_bool_binop_done;
      }
      __pyx_t_1 = PyTuple_Check(__pyx_v_values); 
      __pyx_t_2 = __pyx_t_1;
      __pyx_L15_bool_binop_done:;
      __pyx_t_1 = (!__pyx_t_2);
      if (__pyx_t_1) {

        /* "amplpy/parameter.pxi":200
 *             if all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)             # <<<<<<<<<<<<<<
 *                 errorinfo = setValuesParamStr(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:
*/
        __pyx_t_11 = PySequence_List(__pyx_v_values); if (unlikely(!__pyx_t_11)) __PYX_ERR(14, 200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "amplpy/parameter.pxi":199
 *         elif isinstance(values, Iterable):
 *             if all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *                     values = list(values)
 *                 errorinfo = setValuesParamStr(self._ampl._c_ampl, self._name, values)
*/
      }

      /* "amplpy/parameter.pxi":201
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
 *                 errorinfo = setValuesParamStr(self._ampl._c_ampl, self._name, values)             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      __pyx_t_3 = __pyx_f_6amplpy_4ampl_setValuesParamStr(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_values); if (unlikely(__pyx_t_3 == ((AMPL_ERRORINFO *)0) && PyErr_Occurred())) __PYX_ERR(14, 201, __pyx_L1_error)
      __pyx_v_errorinfo = __pyx_t_3;

      /* "amplpy/parameter.pxi":202
 *                     values = list(values)
 *                 errorinfo = setValuesParamStr(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):
*/
      __pyx_t_1 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_1) {

        /* "amplpy/parameter.pxi":203
 *                 errorinfo = setValuesParamStr(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *             elif all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 203, __pyx_L1_error)

        /* "amplpy/parameter.pxi":202
 *                     values = list(values)
 *                 errorinfo = setValuesParamStr(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):
*/
      }

      /* "amplpy/parameter.pxi":198
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))
 *         elif isinstance(values, Iterable):
 *             if all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/
      goto __pyx_L13;
    }

    /* "amplpy/parameter.pxi":204
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
*/
    __pyx_t_11 = __pyx_pf_6amplpy_4ampl_9Parameter_10set_values_3genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_11)) __PYX_ERR(14, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_7 = __Pyx_Generator_GetInlinedResult(__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(14, 204, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_1) {

      /* "amplpy/parameter.pxi":205
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))             # <<<<<<<<<<<<<<
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:
*/
      __pyx_t_11 = NULL;
      __Pyx_INCREF(__pyx_builtin_map);
      __pyx_t_4 = __pyx_builtin_map; 
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_11, ((PyObject *)(&PyFloat_Type)), __pyx_v_values};
        __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_4 = __Pyx_PySequence_ListKeepNew(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "amplpy/parameter.pxi":206
 *             elif all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      __pyx_t_3 = __pyx_f_6amplpy_4ampl_setValuesParamNum(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_values); if (unlikely(__pyx_t_3 == ((AMPL_ERRORINFO *)0) && PyErr_Occurred())) __PYX_ERR(14, 206, __pyx_L1_error)
      __pyx_v_errorinfo = __pyx_t_3;

      /* "amplpy/parameter.pxi":207
 *                 values = list(map(float, values))
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
*/
      __pyx_t_1 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_1) {

        /* "amplpy/parameter.pxi":208
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *             else:
 *                 Entity.set_values(self, values)
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(14, 208, __pyx_L1_error)

        /* "amplpy/parameter.pxi":207
 *                 values = list(map(float, values))
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
*/
      }

      /* "amplpy/parameter.pxi":204
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValuesParamNum(self._ampl._c_ampl, self._name, values)
*/
      goto __pyx_L13;
    }

    /* "amplpy/parameter.pxi":210
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
 *                 Entity.set_values(self, values)             # <<<<<<<<<<<<<<
 *         else:
 *             Entity.set_values(self, values)
*/
    /*else*/ {
      __pyx_t_7 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_values};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L13:;

    /* "amplpy/parameter.pxi":197
 *             else:
 *                 self.set_values(tuple(itertools.chain(*values.tolist())))
 *         elif isinstance(values, Iterable):             # <<<<<<<<<<<<<<
 *             if all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):
*/
    goto __pyx_L3;
  }

  /* "amplpy/parameter.pxi":212
 *                 Entity.set_values(self, values)
 *         else:
 *             Entity.set_values(self, values)             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  /*else*/ {
    __pyx_t_7 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_values};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(14, 212, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "amplpy/parameter.pxi":165
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Assign the values (string or float) to the parameter instances with the
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("amplpy.ampl.Parameter.set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_2generator6);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_9Parameter_10set_values_5generator7);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Parameter_14__reduce_cython__, "Parameter.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Parameter_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_14__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_15__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_14__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Parameter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_9Parameter_16__setstate_cython__, "Parameter.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9Parameter_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_16__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_9Parameter_17__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Parameter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_9Parameter_16__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Parameter *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_9Parameter_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Parameter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Parameter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":31
 *     :class:`~amplpy.DataFrame`.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Set()
*/

static PyObject *__pyx_f_6amplpy_4ampl_3Set_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_entity = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/set.pxi":33
 *     @staticmethod
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Set()             # <<<<<<<<<<<<<<
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 33, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_entity = ((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/set.pxi":34
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Set()
 *         entity._ampl = ampl             # <<<<<<<<<<<<<<
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __pyx_v_entity->__pyx_base._ampl = __pyx_v_ampl;

  /* "amplpy/set.pxi":35
 *         entity = Set()
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)             # <<<<<<<<<<<<<<
 *         entity._name = name
 *         entity._index = index
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_INCREF(__pyx_t_1);
  Py_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/set.pxi":36
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
 *         entity._name = name             # <<<<<<<<<<<<<<
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_SET
*/
  __pyx_v_entity->__pyx_base._name = __pyx_v_name;

  /* "amplpy/set.pxi":37
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
 *         entity._index = index             # <<<<<<<<<<<<<<
 *         entity.wrap_function = campl.AMPL_SET
 *         entity._entity = parent
*/
  __pyx_v_entity->__pyx_base._index = __pyx_v_index;

  /* "amplpy/set.pxi":38
 *         entity._name = name
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_SET             # <<<<<<<<<<<<<<
 *         entity._entity = parent
 *         if entity._entity is not None:
*/
  __pyx_v_entity->__pyx_base.wrap_function = AMPL_SET;

  /* "amplpy/set.pxi":39
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_SET
 *         entity._entity = parent             # <<<<<<<<<<<<<<
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_entity->__pyx_base._entity);
  __Pyx_DECREF(__pyx_v_entity->__pyx_base._entity);
  __pyx_v_entity->__pyx_base._entity = __pyx_v_parent;

  /* "amplpy/set.pxi":40
 *         entity.wrap_function = campl.AMPL_SET
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  __pyx_t_5 = (__pyx_v_entity->__pyx_base._entity != Py_None);
  if (__pyx_t_5) {

    /* "amplpy/set.pxi":41
 *         entity._entity = parent
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)             # <<<<<<<<<<<<<<
 *         return entity
 * 
*/
    __pyx_t_1 = __pyx_v_entity->__pyx_base._entity;
    __Pyx_INCREF(__pyx_t_1);
    Py_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/set.pxi":40
 *         entity.wrap_function = campl.AMPL_SET
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  }

  /* "amplpy/set.pxi":42
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_entity);
  __pyx_r = ((PyObject *)__pyx_v_entity);
  goto __pyx_L0;

  /* "amplpy/set.pxi":31
 *     :class:`~amplpy.DataFrame`.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char* name, campl.AMPL_TUPLE* index, parent):
 *         entity = Set()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Set.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entity);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":44
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.__getitem__(index).set_values(value)
 * 
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_3Set_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6amplpy_4ampl_3Set_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set___setitem__(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_3Set___setitem__(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/set.pxi":45
 * 
 *     def __setitem__(self, index, value):
 *         self.__getitem__(index).set_values(value)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_index};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_getitem, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_value};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/set.pxi":44
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.__getitem__(index).set_values(value)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Set.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":47
 *         self.__getitem__(index).set_values(value)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if self.is_scalar():
 *             return self.members()
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_3__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_2__iter__(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_2__iter__(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/set.pxi":48
 * 
 *     def __iter__(self):
 *         if self.is_scalar():             # <<<<<<<<<<<<<<
 *             return self.members()
 *         else:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_scalar, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(15, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "amplpy/set.pxi":49
 *     def __iter__(self):
 *         if self.is_scalar():
 *             return self.members()             # <<<<<<<<<<<<<<
 *         else:
 *             return self.instances()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_members, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "amplpy/set.pxi":48
 * 
 *     def __iter__(self):
 *         if self.is_scalar():             # <<<<<<<<<<<<<<
 *             return self.members()
 *         else:
*/
  }

  /* "amplpy/set.pxi":51
 *             return self.members()
 *         else:
 *             return self.instances()             # <<<<<<<<<<<<<<
 * 
 *     def instances(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_instances, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "amplpy/set.pxi":47
 *         self.__getitem__(index).set_values(value)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if self.is_scalar():
 *             return self.members()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Set.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":53
 *             return self.instances()
 * 
 *     def instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get an iterator to iterate over all the instances in a Set.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_5instances(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_4instances, "Set.instances(self)\nGet an iterator to iterate over all the instances in a Set.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_5instances = {"instances", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_5instances, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_4instances};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_5instances(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("instances (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("instances", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("instances", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_4instances(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_4instances(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("instances", 0);

  /* "amplpy/set.pxi":57
 *         Get an iterator to iterate over all the instances in a Set.
 *         """
 *         return Entity.instances(self)             # <<<<<<<<<<<<<<
 * 
 *     def arity(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_instances, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 57, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/set.pxi":53
 *             return self.instances()
 * 
 *     def instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get an iterator to iterate over all the instances in a Set.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.Set.instances", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":59
 *         return Entity.instances(self)
 * 
 *     def arity(self):             # <<<<<<<<<<<<<<
 *         """
 *         The arity of the set, or number of components in each member of this
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_7arity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_6arity, "Set.arity(self)\nThe arity of the set, or number of components in each member of this\nset.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_7arity = {"arity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_7arity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_6arity};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_7arity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("arity", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("arity", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_6arity(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_6arity(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self) {
  size_t __pyx_v_arity;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arity", 0);

  /* "amplpy/set.pxi":65
 *         """
 *         cdef size_t arity
 *         PY_AMPL_CALL(campl.AMPL_SetGetArity(self._ampl._c_ampl, self._name, &arity))             # <<<<<<<<<<<<<<
 *         return int(arity)
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetGetArity(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, (&__pyx_v_arity))); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 65, __pyx_L1_error)

  /* "amplpy/set.pxi":66
 *         cdef size_t arity
 *         PY_AMPL_CALL(campl.AMPL_SetGetArity(self._ampl._c_ampl, self._name, &arity))
 *         return int(arity)             # <<<<<<<<<<<<<<
 * 
 *     def get_values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_arity); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 66, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/set.pxi":59
 *         return Entity.instances(self)
 * 
 *     def arity(self):             # <<<<<<<<<<<<<<
 *         """
 *         The arity of the set, or number of components in each member of this
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Set.arity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":68
 *         return int(arity)
 * 
 *     def get_values(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get values of this set in a DataFrame. Valid only for non-indexed sets.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_9get_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_8get_values, "Set.get_values(self)\nGet values of this set in a DataFrame. Valid only for non-indexed sets.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_9get_values = {"get_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_9get_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_8get_values};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_9get_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_values", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_8get_values(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_8get_values(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self) {
  AMPL_DATAFRAME *__pyx_v_df_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_values", 0);

  /* "amplpy/set.pxi":73
 *         """
 *         cdef campl.AMPL_DATAFRAME* df_c
 *         PY_AMPL_CALL(campl.AMPL_SetInstanceGetValuesDataframe(self._ampl._c_ampl, self._name, self._index, &df_c))             # <<<<<<<<<<<<<<
 *         return DataFrame.create(df_c)
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetInstanceGetValuesDataframe(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, (&__pyx_v_df_c))); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 73, __pyx_L1_error)

  /* "amplpy/set.pxi":74
 *         cdef campl.AMPL_DATAFRAME* df_c
 *         PY_AMPL_CALL(campl.AMPL_SetInstanceGetValuesDataframe(self._ampl._c_ampl, self._name, self._index, &df_c))
 *         return DataFrame.create(df_c)             # <<<<<<<<<<<<<<
 * 
 *     def members(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9DataFrame_create(__pyx_v_df_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/set.pxi":68
 *         return int(arity)
 * 
 *     def get_values(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get values of this set in a DataFrame. Valid only for non-indexed sets.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Set.get_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":76
 *         return DataFrame.create(df_c)
 * 
 *     def members(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get members (tuples) of this Set. Valid only for non-indexed sets.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_11members(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_10members, "Set.members(self)\nGet members (tuples) of this Set. Valid only for non-indexed sets.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_11members = {"members", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_11members, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_10members};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_11members(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("members (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("members", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("members", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_10members(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10members(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("members", 0);

  /* "amplpy/set.pxi":80
 *         Get members (tuples) of this Set. Valid only for non-indexed sets.
 *         """
 *         return MemberRangeIterator.create(self._ampl._c_ampl, self._name, self._index, self)             # <<<<<<<<<<<<<<
 * 
 *     def size(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_19MemberRangeIterator_create(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/set.pxi":76
 *         return DataFrame.create(df_c)
 * 
 *     def members(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get members (tuples) of this Set. Valid only for non-indexed sets.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Set.members", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":82
 *         return MemberRangeIterator.create(self._ampl._c_ampl, self._name, self._index, self)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of tuples in this set. Valid only for non-indexed sets.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_13size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_12size, "Set.size(self)\nGet the number of tuples in this set. Valid only for non-indexed sets.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_13size = {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_13size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_12size};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_13size(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("size", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("size", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_12size(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_12size(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self) {
  size_t __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("size", 0);

  /* "amplpy/set.pxi":87
 *         """
 *         cdef size_t size
 *         PY_AMPL_CALL(campl.AMPL_SetInstanceGetSize(self._ampl._c_ampl, self._name, self._index, &size))             # <<<<<<<<<<<<<<
 *         return int(size)
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetInstanceGetSize(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, (&__pyx_v_size))); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 87, __pyx_L1_error)

  /* "amplpy/set.pxi":88
 *         cdef size_t size
 *         PY_AMPL_CALL(campl.AMPL_SetInstanceGetSize(self._ampl._c_ampl, self._name, self._index, &size))
 *         return int(size)             # <<<<<<<<<<<<<<
 * 
 *     def contains(self, t):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __pyx_t_3 = ((PyObject *)(&PyLong_Type)); 
  __pyx_t_4 = __Pyx_PyLong_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/set.pxi":82
 *         return MemberRangeIterator.create(self._ampl._c_ampl, self._name, self._index, self)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of tuples in this set. Valid only for non-indexed sets.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Set.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":90
 *         return int(size)
 * 
 *     def contains(self, t):             # <<<<<<<<<<<<<<
 *         """
 *         Check wether this set instance contains the specified Tuple.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_15contains(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_14contains, "Set.contains(self, t)\nCheck wether this set instance contains the specified Tuple.\nValid only for non-indexed sets.\n\nArgs:\n    t: Tuple to be found.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_15contains = {"contains", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_15contains, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_14contains};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_15contains(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_t = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contains (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_t,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 90, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 90, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "contains", 0) < 0) __PYX_ERR(15, 90, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("contains", 1, 1, 1, i); __PYX_ERR(15, 90, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 90, __pyx_L3_error)
    }
    __pyx_v_t = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contains", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 90, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Set.contains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_14contains(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self), __pyx_v_t);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_14contains(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, PyObject *__pyx_v_t) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  bool __pyx_v_contains_c;
  AMPL_TUPLE *__pyx_v_t_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  AMPL_TUPLE *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("contains", 0);

  /* "amplpy/set.pxi":100
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef bool_c contains_c
 *         cdef campl.AMPL_TUPLE* t_c = to_c_tuple(t)             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_SetInstanceContains(self._ampl._c_ampl, self._name, NULL, t_c, &contains_c)
 *         campl.AMPL_TupleFree(&t_c)
*/
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_to_c_tuple(__pyx_v_t); if (unlikely(__pyx_t_1 == ((AMPL_TUPLE *)0) && PyErr_Occurred())) __PYX_ERR(15, 100, __pyx_L1_error)
  __pyx_v_t_c = __pyx_t_1;

  /* "amplpy/set.pxi":101
 *         cdef bool_c contains_c
 *         cdef campl.AMPL_TUPLE* t_c = to_c_tuple(t)
 *         errorinfo = campl.AMPL_SetInstanceContains(self._ampl._c_ampl, self._name, NULL, t_c, &contains_c)             # <<<<<<<<<<<<<<
 *         campl.AMPL_TupleFree(&t_c)
 *         if errorinfo:
*/
  __pyx_v_errorinfo = AMPL_SetInstanceContains(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, NULL, __pyx_v_t_c, (&__pyx_v_contains_c));

  /* "amplpy/set.pxi":102
 *         cdef campl.AMPL_TUPLE* t_c = to_c_tuple(t)
 *         errorinfo = campl.AMPL_SetInstanceContains(self._ampl._c_ampl, self._name, NULL, t_c, &contains_c)
 *         campl.AMPL_TupleFree(&t_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  (void)(AMPL_TupleFree((&__pyx_v_t_c)));

  /* "amplpy/set.pxi":103
 *         errorinfo = campl.AMPL_SetInstanceContains(self._ampl._c_ampl, self._name, NULL, t_c, &contains_c)
 *         campl.AMPL_TupleFree(&t_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         return contains_c
*/
  __pyx_t_2 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_2) {

    /* "amplpy/set.pxi":104
 *         campl.AMPL_TupleFree(&t_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         return contains_c
 * 
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 104, __pyx_L1_error)

    /* "amplpy/set.pxi":103
 *         errorinfo = campl.AMPL_SetInstanceContains(self._ampl._c_ampl, self._name, NULL, t_c, &contains_c)
 *         campl.AMPL_TupleFree(&t_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         return contains_c
*/
  }

  /* "amplpy/set.pxi":105
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         return contains_c             # <<<<<<<<<<<<<<
 * 
 *     def set_values(self, values):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_contains_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "amplpy/set.pxi":90
 *         return int(size)
 * 
 *     def contains(self, t):             # <<<<<<<<<<<<<<
 *         """
 *         Check wether this set instance contains the specified Tuple.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Set.contains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":107
 *         return contains_c
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the tuples in this set. Valid only for non-indexed sets.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_17set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_16set_values, "Set.set_values(self, values)\nSet the tuples in this set. Valid only for non-indexed sets.\n\nArgs:\n    values: A list of tuples or a :class:`~amplpy.DataFrame`.\n\nIn the case of a :class:`~amplpy.DataFrame`, the number of indexing\ncolumns of the must be equal to the arity of the set. In the case of\na list of tuples, the arity of each tuple must be equal to the arity\nof the set.\n\nFor example, considering the following AMPL entities and corresponding\nPython objects:\n\n.. code-block:: ampl\n\n    set A := 1..2;\n    param p{i in A} := i+10;\n    set AA;\n\nThe following is valid:\n\n.. code-block:: python\n\n    A, AA = ampl.get_set('A'), ampl.get_set('AA')\n    AA.set_values(A.get_values())  # AA has now the members {1, 2}");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_17set_values = {"set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_17set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_16set_values};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_17set_values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_values = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_values,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 107, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 107, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_values", 0) < 0) __PYX_ERR(15, 107, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_values", 1, 1, 1, i); __PYX_ERR(15, 107, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 107, __pyx_L3_error)
    }
    __pyx_v_values = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_values", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 107, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_16set_values(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self), __pyx_v_values);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":160
 *             else:
 * 
 *                 def cast_value(value):             # <<<<<<<<<<<<<<
 *                     if isinstance(value, str):
 *                         return value
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_10set_values_1cast_value(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_10set_values_1cast_value = {"cast_value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_10set_values_1cast_value, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_10set_values_1cast_value(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cast_value (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 160, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 160, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cast_value", 0) < 0) __PYX_ERR(15, 160, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cast_value", 1, 1, 1, i); __PYX_ERR(15, 160, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 160, __pyx_L3_error)
    }
    __pyx_v_value = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cast_value", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 160, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.cast_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_10set_values_cast_value(__pyx_self, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_cast_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cast_value", 0);

  /* "amplpy/set.pxi":161
 * 
 *                 def cast_value(value):
 *                     if isinstance(value, str):             # <<<<<<<<<<<<<<
 *                         return value
 *                     elif isinstance(value, Real):
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "amplpy/set.pxi":162
 *                 def cast_value(value):
 *                     if isinstance(value, str):
 *                         return value             # <<<<<<<<<<<<<<
 *                     elif isinstance(value, Real):
 *                         return float(value)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;

    /* "amplpy/set.pxi":161
 * 
 *                 def cast_value(value):
 *                     if isinstance(value, str):             # <<<<<<<<<<<<<<
 *                         return value
 *                     elif isinstance(value, Real):
*/
  }

  /* "amplpy/set.pxi":163
 *                     if isinstance(value, str):
 *                         return value
 *                     elif isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                         return float(value)
 *                     else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_value, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(15, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(__pyx_t_1)) {

    /* "amplpy/set.pxi":164
 *                         return value
 *                     elif isinstance(value, Real):
 *                         return float(value)             # <<<<<<<<<<<<<<
 *                     else:
 *                         raise TypeError("Excepted string or real.")
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "amplpy/set.pxi":163
 *                     if isinstance(value, str):
 *                         return value
 *                     elif isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                         return float(value)
 *                     else:
*/
  }

  /* "amplpy/set.pxi":166
 *                         return float(value)
 *                     else:
 *                         raise TypeError("Excepted string or real.")             # <<<<<<<<<<<<<<
 * 
 *                 def cast_row(row):
*/
  /*else*/ {
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_TypeError);
    __pyx_t_4 = __pyx_builtin_TypeError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Excepted_string_or_real};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(15, 166, __pyx_L1_error)
  }

  /* "amplpy/set.pxi":160
 *             else:
 * 
 *                 def cast_value(value):             # <<<<<<<<<<<<<<
 *                     if isinstance(value, str):
 *                         return value
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.cast_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":168
 *                         raise TypeError("Excepted string or real.")
 * 
 *                 def cast_row(row):             # <<<<<<<<<<<<<<
 *                     if isinstance(row, str):
 *                         return row
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_10set_values_3cast_row(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_10set_values_3cast_row = {"cast_row", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_10set_values_3cast_row, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_10set_values_3cast_row(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_row = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cast_row (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_row,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(15, 168, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 168, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cast_row", 0) < 0) __PYX_ERR(15, 168, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cast_row", 1, 1, 1, i); __PYX_ERR(15, 168, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(15, 168, __pyx_L3_error)
    }
    __pyx_v_row = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cast_row", 1, 1, 1, __pyx_nargs); __PYX_ERR(15, 168, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.cast_row", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_10set_values_2cast_row(__pyx_self, __pyx_v_row);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_2cast_row(PyObject *__pyx_self, PyObject *__pyx_v_row) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *__pyx_cur_scope;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[3];
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cast_row", 0);
  __pyx_outer_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "amplpy/set.pxi":169
 * 
 *                 def cast_row(row):
 *                     if isinstance(row, str):             # <<<<<<<<<<<<<<
 *                         return row
 *                     elif isinstance(row, Real):
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_row); 
  if (__pyx_t_1) {

    /* "amplpy/set.pxi":170
 *                 def cast_row(row):
 *                     if isinstance(row, str):
 *                         return row             # <<<<<<<<<<<<<<
 *                     elif isinstance(row, Real):
 *                         return float(row)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_row);
    __pyx_r = __pyx_v_row;
    goto __pyx_L0;

    /* "amplpy/set.pxi":169
 * 
 *                 def cast_row(row):
 *                     if isinstance(row, str):             # <<<<<<<<<<<<<<
 *                         return row
 *                     elif isinstance(row, Real):
*/
  }

  /* "amplpy/set.pxi":171
 *                     if isinstance(row, str):
 *                         return row
 *                     elif isinstance(row, Real):             # <<<<<<<<<<<<<<
 *                         return float(row)
 *                     elif isinstance(row, Iterable):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_row, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(15, 171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "amplpy/set.pxi":172
 *                         return row
 *                     elif isinstance(row, Real):
 *                         return float(row)             # <<<<<<<<<<<<<<
 *                     elif isinstance(row, Iterable):
 *                         return tuple(map(cast_value, row))
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_v_row); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "amplpy/set.pxi":171
 *                     if isinstance(row, str):
 *                         return row
 *                     elif isinstance(row, Real):             # <<<<<<<<<<<<<<
 *                         return float(row)
 *                     elif isinstance(row, Iterable):
*/
  }

  /* "amplpy/set.pxi":173
 *                     elif isinstance(row, Real):
 *                         return float(row)
 *                     elif isinstance(row, Iterable):             # <<<<<<<<<<<<<<
 *                         return tuple(map(cast_value, row))
 *                     else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_row, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(15, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "amplpy/set.pxi":174
 *                         return float(row)
 *                     elif isinstance(row, Iterable):
 *                         return tuple(map(cast_value, row))             # <<<<<<<<<<<<<<
 *                     else:
 *                         if dimen == 1:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_map);
    __pyx_t_4 = __pyx_builtin_map; 
    if (unlikely(!__pyx_cur_scope->__pyx_v_cast_value)) { __Pyx_RaiseClosureNameError("cast_value"); __PYX_ERR(15, 174, __pyx_L1_error) }
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_cast_value, __pyx_v_row};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "amplpy/set.pxi":173
 *                     elif isinstance(row, Real):
 *                         return float(row)
 *                     elif isinstance(row, Iterable):             # <<<<<<<<<<<<<<
 *                         return tuple(map(cast_value, row))
 *                     else:
*/
  }

  /* "amplpy/set.pxi":176
 *                         return tuple(map(cast_value, row))
 *                     else:
 *                         if dimen == 1:             # <<<<<<<<<<<<<<
 *                             raise TypeError("Excepted string or real.")
 *                         else:
*/
  /*else*/ {
    if (unlikely(!__pyx_cur_scope->__pyx_v_dimen)) { __Pyx_RaiseClosureNameError("dimen"); __PYX_ERR(15, 176, __pyx_L1_error) }
    __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_cur_scope->__pyx_v_dimen, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(15, 176, __pyx_L1_error)
    if (unlikely(__pyx_t_1)) {

      /* "amplpy/set.pxi":177
 *                     else:
 *                         if dimen == 1:
 *                             raise TypeError("Excepted string or real.")             # <<<<<<<<<<<<<<
 *                         else:
 *                             raise ValueError(f"Excepted tuple of arity {dimen}.")
*/
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_3 = __pyx_builtin_TypeError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Excepted_string_or_real};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 177, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(15, 177, __pyx_L1_error)

      /* "amplpy/set.pxi":176
 *                         return tuple(map(cast_value, row))
 *                     else:
 *                         if dimen == 1:             # <<<<<<<<<<<<<<
 *                             raise TypeError("Excepted string or real.")
 *                         else:
*/
    }

    /* "amplpy/set.pxi":179
 *                             raise TypeError("Excepted string or real.")
 *                         else:
 *                             raise ValueError(f"Excepted tuple of arity {dimen}.")             # <<<<<<<<<<<<<<
 * 
 *                 values = [cast_row(row) for row in values]
*/
    /*else*/ {
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_2 = __pyx_builtin_ValueError; 
      if (unlikely(!__pyx_cur_scope->__pyx_v_dimen)) { __Pyx_RaiseClosureNameError("dimen"); __PYX_ERR(15, 179, __pyx_L1_error) }
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_dimen, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_Excepted_tuple_of_arity;
      __pyx_t_7[1] = __pyx_t_6;
      __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(15, 179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 179, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(15, 179, __pyx_L1_error)
    }
  }

  /* "amplpy/set.pxi":168
 *                         raise TypeError("Excepted string or real.")
 * 
 *                 def cast_row(row):             # <<<<<<<<<<<<<<
 *                     if isinstance(row, str):
 *                         return row
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.cast_row", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_6generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/set.pxi":147
 *         elif isinstance(values, Iterable):
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_4genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_12_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(15, 147, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_3Set_10set_values_6generator8, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_set_values_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(15, 147, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_6generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(15, 147, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(15, 147, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 147, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 147, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 147, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 147, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(15, 147, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = PyUnicode_Check(__pyx_cur_scope->__pyx_v_value); 
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_9generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/set.pxi":153
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
*/

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_7genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_13_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(15, 153, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_3Set_10set_values_9generator9, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_set_values_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(15, 153, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_9generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(15, 153, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(15, 153, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 153, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 153, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 153, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 153, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(15, 153, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(15, 153, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_12generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/set.pxi":183
 *                 values = [cast_row(row) for row in values]
 *                 if dimen == 1:
 *                     if any(isinstance(row, tuple) for row in values):             # <<<<<<<<<<<<<<
 *                         raise ValueError(
 *                             f"Trying to assign tuples to set of arity {dimen}."
*/

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_10genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_14_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(15, 183, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_3Set_10set_values_12generator10, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_set_values_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(15, 183, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_12generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(15, 183, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(15, 183, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 183, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 183, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 183, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 183, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(15, 183, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = PyTuple_Check(__pyx_cur_scope->__pyx_v_row); 
    if (__pyx_t_5) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_15generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/set.pxi":189
 *                 else:
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen             # <<<<<<<<<<<<<<
 *                         for row in values
 *                     ):
*/

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_10set_values_13genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_15_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(15, 189, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_3Set_10set_values_15generator11, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_set_values_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(15, 189, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_15generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(15, 189, __pyx_L1_error)

  /* "amplpy/set.pxi":190
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen
 *                         for row in values             # <<<<<<<<<<<<<<
 *                     ):
 *                         raise ValueError(f"Expected tuples of arity {dimen}.")
*/
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(15, 190, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(15, 190, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 190, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 190, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 190, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(15, 190, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "amplpy/set.pxi":189
 *                 else:
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen             # <<<<<<<<<<<<<<
 *                         for row in values
 *                     ):
*/
    __pyx_t_6 = PyTuple_Check(__pyx_cur_scope->__pyx_v_row); 
    __pyx_t_7 = (!__pyx_t_6);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_5 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = PyObject_Length(__pyx_cur_scope->__pyx_v_row); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(15, 189, __pyx_L1_error)
    __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(15, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_dimen)) { __Pyx_RaiseClosureNameError("dimen"); __PYX_ERR(15, 189, __pyx_L1_error) }
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_dimen, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(15, 189, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(15, 189, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_5 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_5) {

      /* "amplpy/set.pxi":188
 *                         )
 *                 else:
 *                     if any(             # <<<<<<<<<<<<<<
 *                         not isinstance(row, tuple) or len(row) != dimen
 *                         for row in values
*/
      __Pyx_XDECREF(__pyx_r);

      /* "amplpy/set.pxi":189
 *                 else:
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen             # <<<<<<<<<<<<<<
 *                         for row in values
 *                     ):
*/
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "amplpy/set.pxi":190
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen
 *                         for row in values             # <<<<<<<<<<<<<<
 *                     ):
 *                         raise ValueError(f"Expected tuples of arity {dimen}.")
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {

    /* "amplpy/set.pxi":188
 *                         )
 *                 else:
 *                     if any(             # <<<<<<<<<<<<<<
 *                         not isinstance(row, tuple) or len(row) != dimen
 *                         for row in values
*/
    __Pyx_XDECREF(__pyx_r);

    /* "amplpy/set.pxi":189
 *                 else:
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen             # <<<<<<<<<<<<<<
 *                         for row in values
 *                     ):
*/
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/set.pxi":107
 *         return contains_c
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the tuples in this set. Valid only for non-indexed sets.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_16set_values(struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, PyObject *__pyx_v_values) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *__pyx_cur_scope;
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_df = 0;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_members = NULL;
  PyObject *__pyx_v_cast_row = 0;
  PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_6generator8 = 0;
  PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_9generator9 = 0;
  PyObject *__pyx_9genexpr30__pyx_v_row = NULL;
  PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_12generator10 = 0;
  PyObject *__pyx_gb_6amplpy_4ampl_3Set_10set_values_15generator11 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  AMPL_DATAFRAME *__pyx_t_12;
  AMPL_ERRORINFO *__pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *__pyx_t_15[3];
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_values", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_11_set_values(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(15, 107, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __Pyx_INCREF(__pyx_v_values);

  /* "amplpy/set.pxi":136
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef DataFrame df = None             # <<<<<<<<<<<<<<
 *         if not self.is_scalar():
 *             if not isinstance(values, dict):
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_df = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)Py_None);

  /* "amplpy/set.pxi":137
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef DataFrame df = None
 *         if not self.is_scalar():             # <<<<<<<<<<<<<<
 *             if not isinstance(values, dict):
 *                 raise TypeError("Excepted dictionary of set members for each index.")
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_scalar, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(15, 137, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (!__pyx_t_4);
  if (__pyx_t_5) {

    /* "amplpy/set.pxi":138
 *         cdef DataFrame df = None
 *         if not self.is_scalar():
 *             if not isinstance(values, dict):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Excepted dictionary of set members for each index.")
 *             for index, members in values.items():
*/
    __pyx_t_5 = PyDict_Check(__pyx_v_values); 
    __pyx_t_4 = (!__pyx_t_5);
    if (unlikely(__pyx_t_4)) {

      /* "amplpy/set.pxi":139
 *         if not self.is_scalar():
 *             if not isinstance(values, dict):
 *                 raise TypeError("Excepted dictionary of set members for each index.")             # <<<<<<<<<<<<<<
 *             for index, members in values.items():
 *                 self[index].set_values(members)
*/
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_6 = __pyx_builtin_TypeError; 
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Excepted_dictionary_of_set_membe};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 139, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(15, 139, __pyx_L1_error)

      /* "amplpy/set.pxi":138
 *         cdef DataFrame df = None
 *         if not self.is_scalar():
 *             if not isinstance(values, dict):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Excepted dictionary of set members for each index.")
 *             for index, members in values.items():
*/
    }

    /* "amplpy/set.pxi":140
 *             if not isinstance(values, dict):
 *                 raise TypeError("Excepted dictionary of set members for each index.")
 *             for index, members in values.items():             # <<<<<<<<<<<<<<
 *                 self[index].set_values(members)
 *         elif isinstance(values, DataFrame):
*/
    __pyx_t_7 = 0;
    if (unlikely(__pyx_v_values == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(15, 140, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_values, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_8, &__pyx_t_7, &__pyx_t_6, &__pyx_t_2, NULL, __pyx_t_9);
      if (unlikely(__pyx_t_10 == 0)) break;
      if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(15, 140, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_members, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "amplpy/set.pxi":141
 *                 raise TypeError("Excepted dictionary of set members for each index.")
 *             for index, members in values.items():
 *                 self[index].set_values(members)             # <<<<<<<<<<<<<<
 *         elif isinstance(values, DataFrame):
 *             df = values
*/
      __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_11)) __PYX_ERR(15, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_6 = __pyx_t_11;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_members};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/set.pxi":137
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef DataFrame df = None
 *         if not self.is_scalar():             # <<<<<<<<<<<<<<
 *             if not isinstance(values, dict):
 *                 raise TypeError("Excepted dictionary of set members for each index.")
*/
    goto __pyx_L3;
  }

  /* "amplpy/set.pxi":142
 *             for index, members in values.items():
 *                 self[index].set_values(members)
 *         elif isinstance(values, DataFrame):             # <<<<<<<<<<<<<<
 *             df = values
 *             PY_AMPL_CALL(campl.AMPL_SetInstanceSetValuesDataframe(self._ampl._c_ampl, self._name, self._index, df.get_ptr()))
*/
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_values, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame); 
  if (__pyx_t_4) {

    /* "amplpy/set.pxi":143
 *                 self[index].set_values(members)
 *         elif isinstance(values, DataFrame):
 *             df = values             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetInstanceSetValuesDataframe(self._ampl._c_ampl, self._name, self._index, df.get_ptr()))
 *         elif isinstance(values, Iterable):
*/
    __pyx_t_1 = __pyx_v_values;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame))))) __PYX_ERR(15, 143, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_df, ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "amplpy/set.pxi":144
 *         elif isinstance(values, DataFrame):
 *             df = values
 *             PY_AMPL_CALL(campl.AMPL_SetInstanceSetValuesDataframe(self._ampl._c_ampl, self._name, self._index, df.get_ptr()))             # <<<<<<<<<<<<<<
 *         elif isinstance(values, Iterable):
 *             dimen = self.arity()
*/
    __pyx_t_12 = ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame *)__pyx_v_df->__pyx_vtab)->get_ptr(__pyx_v_df); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 144, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetInstanceSetValuesDataframe(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_t_12)); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 144, __pyx_L1_error)

    /* "amplpy/set.pxi":142
 *             for index, members in values.items():
 *                 self[index].set_values(members)
 *         elif isinstance(values, DataFrame):             # <<<<<<<<<<<<<<
 *             df = values
 *             PY_AMPL_CALL(campl.AMPL_SetInstanceSetValuesDataframe(self._ampl._c_ampl, self._name, self._index, df.get_ptr()))
*/
    goto __pyx_L3;
  }

  /* "amplpy/set.pxi":145
 *             df = values
 *             PY_AMPL_CALL(campl.AMPL_SetInstanceSetValuesDataframe(self._ampl._c_ampl, self._name, self._index, df.get_ptr()))
 *         elif isinstance(values, Iterable):             # <<<<<<<<<<<<<<
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(15, 145, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "amplpy/set.pxi":146
 *             PY_AMPL_CALL(campl.AMPL_SetInstanceSetValuesDataframe(self._ampl._c_ampl, self._name, self._index, df.get_ptr()))
 *         elif isinstance(values, Iterable):
 *             dimen = self.arity()             # <<<<<<<<<<<<<<
 *             if dimen == 1 and all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_arity, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_v_dimen = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "amplpy/set.pxi":147
 *         elif isinstance(values, Iterable):
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/
    __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_cur_scope->__pyx_v_dimen, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(15, 147, __pyx_L1_error)
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_1 = __pyx_pf_6amplpy_4ampl_3Set_10set_values_4genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(15, 147, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_4) {

      /* "amplpy/set.pxi":148
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *                     values = list(values)
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
*/
      __pyx_t_5 = PyList_Check(__pyx_v_values); 
      if (!__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_5 = PyTuple_Check(__pyx_v_values); 
      __pyx_t_4 = __pyx_t_5;
      __pyx_L11_bool_binop_done:;
      __pyx_t_5 = (!__pyx_t_4);
      if (__pyx_t_5) {

        /* "amplpy/set.pxi":149
 *             if dimen == 1 and all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)             # <<<<<<<<<<<<<<
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:
*/
        __pyx_t_2 = PySequence_List(__pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 149, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "amplpy/set.pxi":148
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):
 *                 if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *                     values = list(values)
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
*/
      }

      /* "amplpy/set.pxi":150
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      __pyx_t_8 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(15, 150, __pyx_L1_error)
      __pyx_t_13 = __pyx_f_6amplpy_4ampl_setValues(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_v_values, __pyx_t_8); if (unlikely(__pyx_t_13 == ((AMPL_ERRORINFO *)0) && PyErr_Occurred())) __PYX_ERR(15, 150, __pyx_L1_error)
      __pyx_v_errorinfo = __pyx_t_13;

      /* "amplpy/set.pxi":151
 *                     values = list(values)
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):
*/
      __pyx_t_5 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_5) {

        /* "amplpy/set.pxi":152
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 152, __pyx_L1_error)

        /* "amplpy/set.pxi":151
 *                     values = list(values)
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):
*/
      }

      /* "amplpy/set.pxi":147
 *         elif isinstance(values, Iterable):
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):             # <<<<<<<<<<<<<<
 *                 if not isinstance(values, (list, tuple)):
 *                     values = list(values)
*/
      goto __pyx_L7;
    }

    /* "amplpy/set.pxi":153
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
*/
    __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_cur_scope->__pyx_v_dimen, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(15, 153, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_5 = __pyx_t_4;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_2 = __pyx_pf_6amplpy_4ampl_3Set_10set_values_7genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_Generator_GetInlinedResult(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(15, 153, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __pyx_t_4;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_5) {

      /* "amplpy/set.pxi":154
 *                     PY_AMPL_CALL(errorinfo)
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))             # <<<<<<<<<<<<<<
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:
*/
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_map);
      __pyx_t_11 = __pyx_builtin_map; 
      __pyx_t_3 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)(&PyFloat_Type)), __pyx_v_values};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 154, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_11 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(15, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "amplpy/set.pxi":155
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):
 *                 values = list(map(float, values))
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      __pyx_t_8 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(15, 155, __pyx_L1_error)
      __pyx_t_13 = __pyx_f_6amplpy_4ampl_setValues(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_v_values, __pyx_t_8); if (unlikely(__pyx_t_13 == ((AMPL_ERRORINFO *)0) && PyErr_Occurred())) __PYX_ERR(15, 155, __pyx_L1_error)
      __pyx_v_errorinfo = __pyx_t_13;

      /* "amplpy/set.pxi":156
 *                 values = list(map(float, values))
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
*/
      __pyx_t_5 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_5) {

        /* "amplpy/set.pxi":157
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *             else:
 * 
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 157, __pyx_L1_error)

        /* "amplpy/set.pxi":156
 *                 values = list(map(float, values))
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *             else:
*/
      }

      /* "amplpy/set.pxi":153
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
 *             elif dimen == 1 and all(isinstance(value, Real) for value in values):             # <<<<<<<<<<<<<<
 *                 values = list(map(float, values))
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
*/
      goto __pyx_L7;
    }

    /* "amplpy/set.pxi":160
 *             else:
 * 
 *                 def cast_value(value):             # <<<<<<<<<<<<<<
 *                     if isinstance(value, str):
 *                         return value
*/
    /*else*/ {
      __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_10set_values_1cast_value, 0, __pyx_mstate_global->__pyx_n_u_set_values_locals_cast_value, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_11)) __PYX_ERR(15, 160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      __pyx_cur_scope->__pyx_v_cast_value = __pyx_t_11;
      __pyx_t_11 = 0;

      /* "amplpy/set.pxi":168
 *                         raise TypeError("Excepted string or real.")
 * 
 *                 def cast_row(row):             # <<<<<<<<<<<<<<
 *                     if isinstance(row, str):
 *                         return row
*/
      __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_10set_values_3cast_row, 0, __pyx_mstate_global->__pyx_n_u_set_values_locals_cast_row, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_11)) __PYX_ERR(15, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_v_cast_row = __pyx_t_11;
      __pyx_t_11 = 0;

      /* "amplpy/set.pxi":181
 *                             raise ValueError(f"Excepted tuple of arity {dimen}.")
 * 
 *                 values = [cast_row(row) for row in values]             # <<<<<<<<<<<<<<
 *                 if dimen == 1:
 *                     if any(isinstance(row, tuple) for row in values):
*/
      { /* enter inner scope */
        __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(15, 181, __pyx_L19_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
          __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1);
          __pyx_t_8 = 0;
          __pyx_t_14 = NULL;
        } else {
          __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 181, __pyx_L19_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(15, 181, __pyx_L19_error)
        }
        for (;;) {
          if (likely(!__pyx_t_14)) {
            if (likely(PyList_CheckExact(__pyx_t_1))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 181, __pyx_L19_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_8);
              ++__pyx_t_8;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(15, 181, __pyx_L19_error)
                #endif
                if (__pyx_t_8 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8));
              #else
              __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_8);
              #endif
              ++__pyx_t_8;
            }
            if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 181, __pyx_L19_error)
          } else {
            __pyx_t_2 = __pyx_t_14(__pyx_t_1);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(15, 181, __pyx_L19_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_XDECREF_SET(__pyx_9genexpr30__pyx_v_row, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __pyx_pf_6amplpy_4ampl_3Set_10set_values_2cast_row(__pyx_v_cast_row, __pyx_9genexpr30__pyx_v_row); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 181, __pyx_L19_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_11, (PyObject*)__pyx_t_2))) __PYX_ERR(15, 181, __pyx_L19_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_row); __pyx_9genexpr30__pyx_v_row = 0;
        goto __pyx_L23_exit_scope;
        __pyx_L19_error:;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_row); __pyx_9genexpr30__pyx_v_row = 0;
        goto __pyx_L1_error;
        __pyx_L23_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "amplpy/set.pxi":182
 * 
 *                 values = [cast_row(row) for row in values]
 *                 if dimen == 1:             # <<<<<<<<<<<<<<
 *                     if any(isinstance(row, tuple) for row in values):
 *                         raise ValueError(
*/
      __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_cur_scope->__pyx_v_dimen, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(15, 182, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "amplpy/set.pxi":183
 *                 values = [cast_row(row) for row in values]
 *                 if dimen == 1:
 *                     if any(isinstance(row, tuple) for row in values):             # <<<<<<<<<<<<<<
 *                         raise ValueError(
 *                             f"Trying to assign tuples to set of arity {dimen}."
*/
        __pyx_t_11 = __pyx_pf_6amplpy_4ampl_3Set_10set_values_10genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_11)) __PYX_ERR(15, 183, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_1 = __Pyx_Generator_GetInlinedResult(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 183, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(15, 183, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(__pyx_t_5)) {

          /* "amplpy/set.pxi":184
 *                 if dimen == 1:
 *                     if any(isinstance(row, tuple) for row in values):
 *                         raise ValueError(             # <<<<<<<<<<<<<<
 *                             f"Trying to assign tuples to set of arity {dimen}."
 *                         )
*/
          __pyx_t_11 = NULL;
          __Pyx_INCREF(__pyx_builtin_ValueError);
          __pyx_t_2 = __pyx_builtin_ValueError; 

          /* "amplpy/set.pxi":185
 *                     if any(isinstance(row, tuple) for row in values):
 *                         raise ValueError(
 *                             f"Trying to assign tuples to set of arity {dimen}."             # <<<<<<<<<<<<<<
 *                         )
 *                 else:
*/
          __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_dimen, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 185, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_15[0] = __pyx_mstate_global->__pyx_kp_u_Trying_to_assign_tuples_to_set_o;
          __pyx_t_15[1] = __pyx_t_6;
          __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u__2;
          __pyx_t_16 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, 40 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
          if (unlikely(!__pyx_t_16)) __PYX_ERR(15, 185, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_3 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_16};
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 184, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_Raise(__pyx_t_1, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(15, 184, __pyx_L1_error)

          /* "amplpy/set.pxi":183
 *                 values = [cast_row(row) for row in values]
 *                 if dimen == 1:
 *                     if any(isinstance(row, tuple) for row in values):             # <<<<<<<<<<<<<<
 *                         raise ValueError(
 *                             f"Trying to assign tuples to set of arity {dimen}."
*/
        }

        /* "amplpy/set.pxi":182
 * 
 *                 values = [cast_row(row) for row in values]
 *                 if dimen == 1:             # <<<<<<<<<<<<<<
 *                     if any(isinstance(row, tuple) for row in values):
 *                         raise ValueError(
*/
        goto __pyx_L24;
      }

      /* "amplpy/set.pxi":188
 *                         )
 *                 else:
 *                     if any(             # <<<<<<<<<<<<<<
 *                         not isinstance(row, tuple) or len(row) != dimen
 *                         for row in values
*/
      /*else*/ {

        /* "amplpy/set.pxi":189
 *                 else:
 *                     if any(
 *                         not isinstance(row, tuple) or len(row) != dimen             # <<<<<<<<<<<<<<
 *                         for row in values
 *                     ):
*/
        __pyx_t_1 = __pyx_pf_6amplpy_4ampl_3Set_10set_values_13genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(15, 189, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "amplpy/set.pxi":188
 *                         )
 *                 else:
 *                     if any(             # <<<<<<<<<<<<<<
 *                         not isinstance(row, tuple) or len(row) != dimen
 *                         for row in values
*/
        if (unlikely(__pyx_t_5)) {

          /* "amplpy/set.pxi":192
 *                         for row in values
 *                     ):
 *                         raise ValueError(f"Expected tuples of arity {dimen}.")             # <<<<<<<<<<<<<<
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:
*/
          __pyx_t_1 = NULL;
          __Pyx_INCREF(__pyx_builtin_ValueError);
          __pyx_t_16 = __pyx_builtin_ValueError; 
          __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_dimen, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(15, 192, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_15[0] = __pyx_mstate_global->__pyx_kp_u_Expected_tuples_of_arity;
          __pyx_t_15[1] = __pyx_t_11;
          __pyx_t_15[2] = __pyx_mstate_global->__pyx_kp_u__2;
          __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_15, 3, 25 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11));
          if (unlikely(!__pyx_t_6)) __PYX_ERR(15, 192, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_3 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_6};
            __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 192, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_Raise(__pyx_t_2, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(15, 192, __pyx_L1_error)

          /* "amplpy/set.pxi":188
 *                         )
 *                 else:
 *                     if any(             # <<<<<<<<<<<<<<
 *                         not isinstance(row, tuple) or len(row) != dimen
 *                         for row in values
*/
        }
      }
      __pyx_L24:;

      /* "amplpy/set.pxi":193
 *                     ):
 *                         raise ValueError(f"Expected tuples of arity {dimen}.")
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))             # <<<<<<<<<<<<<<
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)
*/
      __pyx_t_8 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(15, 193, __pyx_L1_error)
      __pyx_t_13 = __pyx_f_6amplpy_4ampl_setValues(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_v_values, __pyx_t_8); if (unlikely(__pyx_t_13 == ((AMPL_ERRORINFO *)0) && PyErr_Occurred())) __PYX_ERR(15, 193, __pyx_L1_error)
      __pyx_v_errorinfo = __pyx_t_13;

      /* "amplpy/set.pxi":194
 *                         raise ValueError(f"Expected tuples of arity {dimen}.")
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *         else:
*/
      __pyx_t_5 = (__pyx_v_errorinfo != 0);
      if (__pyx_t_5) {

        /* "amplpy/set.pxi":195
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:
 *                     PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         else:
 *             Entity.set_values(self, values)
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(15, 195, __pyx_L1_error)

        /* "amplpy/set.pxi":194
 *                         raise ValueError(f"Expected tuples of arity {dimen}.")
 *                 errorinfo = setValues(self._ampl._c_ampl, self._name, self._index, values, len(values))
 *                 if errorinfo:             # <<<<<<<<<<<<<<
 *                     PY_AMPL_CALL(errorinfo)
 *         else:
*/
      }
    }
    __pyx_L7:;

    /* "amplpy/set.pxi":145
 *             df = values
 *             PY_AMPL_CALL(campl.AMPL_SetInstanceSetValuesDataframe(self._ampl._c_ampl, self._name, self._index, df.get_ptr()))
 *         elif isinstance(values, Iterable):             # <<<<<<<<<<<<<<
 *             dimen = self.arity()
 *             if dimen == 1 and all(isinstance(value, str) for value in values):
*/
    goto __pyx_L3;
  }

  /* "amplpy/set.pxi":197
 *                     PY_AMPL_CALL(errorinfo)
 *         else:
 *             Entity.set_values(self, values)             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  /*else*/ {
    __pyx_t_16 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity);
    __Pyx_INCREF(__pyx_t_16);
    __pyx_t_3 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_16, ((PyObject *)__pyx_v_self), __pyx_v_values};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "amplpy/set.pxi":107
 *         return contains_c
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the tuples in this set. Valid only for non-indexed sets.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("amplpy.ampl.Set.set_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_df);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_members);
  __Pyx_XDECREF(__pyx_v_cast_row);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_3Set_10set_values_6generator8);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_3Set_10set_values_9generator9);
  __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_row);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_3Set_10set_values_12generator10);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_3Set_10set_values_15generator11);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_19__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_18__reduce_cython__, "Set.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_19__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_19__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_18__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_19__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_18__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Set.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_21__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_3Set_20__setstate_cython__, "Set.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3Set_21__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_21__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_20__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_3Set_21__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Set.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_3Set_20__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Set *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_3Set_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Set *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Set.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":23
 *     and the :class:`~amplpy.DataFrame` class.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, parent):
 *         entity = Variable()
*/

static PyObject *__pyx_f_6amplpy_4ampl_8Variable_create(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_ampl, char *__pyx_v_name, AMPL_TUPLE *__pyx_v_index, PyObject *__pyx_v_parent) {
  struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_entity = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create", 0);

  /* "amplpy/variable.pxi":25
 *     @staticmethod
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, parent):
 *         entity = Variable()             # <<<<<<<<<<<<<<
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 25, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_entity = ((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/variable.pxi":26
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, parent):
 *         entity = Variable()
 *         entity._ampl = ampl             # <<<<<<<<<<<<<<
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ampl);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ampl);
  __Pyx_GOTREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_DECREF((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __pyx_v_entity->__pyx_base._ampl = __pyx_v_ampl;

  /* "amplpy/variable.pxi":27
 *         entity = Variable()
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)             # <<<<<<<<<<<<<<
 *         entity._name = name
 *         entity._index = index
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_entity->__pyx_base._ampl);
  __Pyx_INCREF(__pyx_t_1);
  Py_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/variable.pxi":28
 *         entity._ampl = ampl
 *         Py_INCREF(entity._ampl)
 *         entity._name = name             # <<<<<<<<<<<<<<
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_VARIABLE
*/
  __pyx_v_entity->__pyx_base._name = __pyx_v_name;

  /* "amplpy/variable.pxi":29
 *         Py_INCREF(entity._ampl)
 *         entity._name = name
 *         entity._index = index             # <<<<<<<<<<<<<<
 *         entity.wrap_function = campl.AMPL_VARIABLE
 *         entity._entity = parent
*/
  __pyx_v_entity->__pyx_base._index = __pyx_v_index;

  /* "amplpy/variable.pxi":30
 *         entity._name = name
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_VARIABLE             # <<<<<<<<<<<<<<
 *         entity._entity = parent
 *         if entity._entity is not None:
*/
  __pyx_v_entity->__pyx_base.wrap_function = AMPL_VARIABLE;

  /* "amplpy/variable.pxi":31
 *         entity._index = index
 *         entity.wrap_function = campl.AMPL_VARIABLE
 *         entity._entity = parent             # <<<<<<<<<<<<<<
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
*/
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_entity->__pyx_base._entity);
  __Pyx_DECREF(__pyx_v_entity->__pyx_base._entity);
  __pyx_v_entity->__pyx_base._entity = __pyx_v_parent;

  /* "amplpy/variable.pxi":32
 *         entity.wrap_function = campl.AMPL_VARIABLE
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  __pyx_t_5 = (__pyx_v_entity->__pyx_base._entity != Py_None);
  if (__pyx_t_5) {

    /* "amplpy/variable.pxi":33
 *         entity._entity = parent
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)             # <<<<<<<<<<<<<<
 *         return entity
 * 
*/
    __pyx_t_1 = __pyx_v_entity->__pyx_base._entity;
    __Pyx_INCREF(__pyx_t_1);
    Py_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/variable.pxi":32
 *         entity.wrap_function = campl.AMPL_VARIABLE
 *         entity._entity = parent
 *         if entity._entity is not None:             # <<<<<<<<<<<<<<
 *             Py_INCREF(entity._entity)
 *         return entity
*/
  }

  /* "amplpy/variable.pxi":34
 *         if entity._entity is not None:
 *             Py_INCREF(entity._entity)
 *         return entity             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, index, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_entity);
  __pyx_r = ((PyObject *)__pyx_v_entity);
  goto __pyx_L0;

  /* "amplpy/variable.pxi":23
 *     and the :class:`~amplpy.DataFrame` class.
 *     """
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef create(AMPL ampl, char *name, campl.AMPL_TUPLE* index, parent):
 *         entity = Variable()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Variable.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entity);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":36
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.__getitem__(index).set_value(value)
 * 
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_8Variable_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6amplpy_4ampl_8Variable_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable___setitem__(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_8Variable___setitem__(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/variable.pxi":37
 * 
 *     def __setitem__(self, index, value):
 *         self.__getitem__(index).set_value(value)             # <<<<<<<<<<<<<<
 * 
 *     def value(self):
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_index};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_getitem, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_value};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_value, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/variable.pxi":36
 *         return entity
 * 
 *     def __setitem__(self, index, value):             # <<<<<<<<<<<<<<
 *         self.__getitem__(index).set_value(value)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.Variable.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":39
 *         self.__getitem__(index).set_value(value)
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of this variable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_3value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_2value, "Variable.value(self)\nGet the current value of this variable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_3value = {"value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_3value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_2value};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_3value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("value (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("value", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("value", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_2value(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_2value(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("value", 0);

  /* "amplpy/variable.pxi":44
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VALUE, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_VALUE, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 44, __pyx_L1_error)

  /* "amplpy/variable.pxi":45
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_VALUE, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def fix(self, value=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":39
 *         self.__getitem__(index).set_value(value)
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of this variable.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":47
 *         return value
 * 
 *     def fix(self, value=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fix all instances of this variable to a value if provided or to
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_5fix(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_4fix, "Variable.fix(self, value=None)\nFix all instances of this variable to a value if provided or to\ntheir current value otherwise.\n\nArgs:\n    value: value to be set.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_5fix = {"fix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_5fix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_4fix};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_5fix(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fix (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(16, 47, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(16, 47, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "fix", 0) < 0) __PYX_ERR(16, 47, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(16, 47, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_value = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fix", 0, 0, 1, __pyx_nargs); __PYX_ERR(16, 47, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Variable.fix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_4fix(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self), __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_4fix(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fix", 0);

  /* "amplpy/variable.pxi":55
 *             value: value to be set.
 *         """
 *         if value is None:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFix(self._ampl._c_ampl, self._name, self._index))
 *         else:
*/
  __pyx_t_1 = (__pyx_v_value == Py_None);
  if (__pyx_t_1) {

    /* "amplpy/variable.pxi":56
 *         """
 *         if value is None:
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFix(self._ampl._c_ampl, self._name, self._index))             # <<<<<<<<<<<<<<
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFixToValue(self._ampl._c_ampl, self._name, self._index, value))
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_VariableInstanceFix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index)); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 56, __pyx_L1_error)

    /* "amplpy/variable.pxi":55
 *             value: value to be set.
 *         """
 *         if value is None:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFix(self._ampl._c_ampl, self._name, self._index))
 *         else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/variable.pxi":58
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFix(self._ampl._c_ampl, self._name, self._index))
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFixToValue(self._ampl._c_ampl, self._name, self._index, value))             # <<<<<<<<<<<<<<
 * 
 *     def unfix(self):
*/
  /*else*/ {
    __pyx_t_2 = __Pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(16, 58, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_VariableInstanceFixToValue(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 58, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "amplpy/variable.pxi":47
 *         return value
 * 
 *     def fix(self, value=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fix all instances of this variable to a value if provided or to
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Variable.fix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":60
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFixToValue(self._ampl._c_ampl, self._name, self._index, value))
 * 
 *     def unfix(self):             # <<<<<<<<<<<<<<
 *         """
 *         Unfix all instances of this variable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_7unfix(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_6unfix, "Variable.unfix(self)\nUnfix all instances of this variable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_7unfix = {"unfix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_7unfix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_6unfix};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_7unfix(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unfix (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("unfix", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("unfix", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_6unfix(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_6unfix(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("unfix", 0);

  /* "amplpy/variable.pxi":64
 *         Unfix all instances of this variable.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_VariableInstanceUnfix(self._ampl._c_ampl, self._name, self._index))             # <<<<<<<<<<<<<<
 * 
 *     def set_value(self, value):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_VariableInstanceUnfix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index)); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 64, __pyx_L1_error)

  /* "amplpy/variable.pxi":60
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFixToValue(self._ampl._c_ampl, self._name, self._index, value))
 * 
 *     def unfix(self):             # <<<<<<<<<<<<<<
 *         """
 *         Unfix all instances of this variable.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Variable.unfix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":66
 *         PY_AMPL_CALL(campl.AMPL_VariableInstanceUnfix(self._ampl._c_ampl, self._name, self._index))
 * 
 *     def set_value(self, value):             # <<<<<<<<<<<<<<
 *         """
 *         Set the current value of this variable (does not fix it),
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_9set_value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_8set_value, "Variable.set_value(self, value)\nSet the current value of this variable (does not fix it),\nequivalent to the AMPL command `let`.\n\nArgs:\n    value: value to be set.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_9set_value = {"set_value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_9set_value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_8set_value};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_9set_value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_value (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(16, 66, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(16, 66, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_value", 0) < 0) __PYX_ERR(16, 66, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_value", 1, 1, 1, i); __PYX_ERR(16, 66, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(16, 66, __pyx_L3_error)
    }
    __pyx_v_value = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_value", 1, 1, 1, __pyx_nargs); __PYX_ERR(16, 66, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Variable.set_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_8set_value(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self), __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_8set_value(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  double __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_value", 0);

  /* "amplpy/variable.pxi":74
 *             value: value to be set.
 *         """
 *         if isinstance(value, Parameter):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, value.value()))
 *         else:
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_value, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter); 
  if (__pyx_t_1) {

    /* "amplpy/variable.pxi":75
 *         """
 *         if isinstance(value, Parameter):
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, value.value()))             # <<<<<<<<<<<<<<
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, float(value)))
*/
    __pyx_t_3 = __pyx_v_value;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_value, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 75, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(16, 75, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_VariableInstanceSetValue(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 75, __pyx_L1_error)

    /* "amplpy/variable.pxi":74
 *             value: value to be set.
 *         """
 *         if isinstance(value, Parameter):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, value.value()))
 *         else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/variable.pxi":77
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, value.value()))
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, float(value)))             # <<<<<<<<<<<<<<
 * 
 *     def astatus(self):
*/
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_5 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(16, 77, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_VariableInstanceSetValue(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, __pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 77, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "amplpy/variable.pxi":66
 *         PY_AMPL_CALL(campl.AMPL_VariableInstanceUnfix(self._ampl._c_ampl, self._name, self._index))
 * 
 *     def set_value(self, value):             # <<<<<<<<<<<<<<
 *         """
 *         Set the current value of this variable (does not fix it),
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Variable.set_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":79
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, float(value)))
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL status (fixed, presolved, or substituted out).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_11astatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_10astatus, "Variable.astatus(self)\nGet the AMPL status (fixed, presolved, or substituted out).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_11astatus = {"astatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_11astatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_10astatus};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_11astatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("astatus (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("astatus", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("astatus", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_10astatus(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_10astatus(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("astatus", 0);

  /* "amplpy/variable.pxi":85
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_ASTATUS, (&__pyx_v_value_c));

  /* "amplpy/variable.pxi":86
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/variable.pxi":87
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 87, __pyx_L1_error)

    /* "amplpy/variable.pxi":86
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_ASTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/variable.pxi":88
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(16, 88, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/variable.pxi":89
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/variable.pxi":91
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def defeqn(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":79
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, float(value)))
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL status (fixed, presolved, or substituted out).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Variable.astatus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":93
 *         return value
 * 
 *     def defeqn(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the index in `_con` of "defining constraint" used to substitute
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_13defeqn(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_12defeqn, "Variable.defeqn(self)\nGet the index in `_con` of \"defining constraint\" used to substitute\nvariable out.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_13defeqn = {"defeqn", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_13defeqn, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_12defeqn};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_13defeqn(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("defeqn (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("defeqn", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("defeqn", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_12defeqn(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_12defeqn(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  int __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("defeqn", 0);

  /* "amplpy/variable.pxi":99
 *         """
 *         cdef int value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetIntSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DEFEQN, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetIntSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_DEFEQN, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 99, __pyx_L1_error)

  /* "amplpy/variable.pxi":100
 *         cdef int value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetIntSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DEFEQN, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def dual(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":93
 *         return value
 * 
 *     def defeqn(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the index in `_con` of "defining constraint" used to substitute
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.defeqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":102
 *         return value
 * 
 *     def dual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the dual value on defining constraint of variable substituted out.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_15dual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_14dual, "Variable.dual(self)\nGet the dual value on defining constraint of variable substituted out.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_15dual = {"dual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_15dual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_14dual};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_15dual(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dual (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("dual", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("dual", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_14dual(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_14dual(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dual", 0);

  /* "amplpy/variable.pxi":107
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DUAL, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_DUAL, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 107, __pyx_L1_error)

  /* "amplpy/variable.pxi":108
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_DUAL, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def init(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":102
 *         return value
 * 
 *     def dual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the dual value on defining constraint of variable substituted out.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.dual", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":110
 *         return value
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current initial guess.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_17init(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_16init, "Variable.init(self)\nGet the current initial guess.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_17init = {"init", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_17init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_16init};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_17init(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("init", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("init", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_16init(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_16init(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init", 0);

  /* "amplpy/variable.pxi":115
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_INIT, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_INIT, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 115, __pyx_L1_error)

  /* "amplpy/variable.pxi":116
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_INIT, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def init0(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":110
 *         return value
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current initial guess.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":118
 *         return value
 * 
 *     def init0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the original initial guess (set by `:=` or`default` or by a data
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_19init0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_18init0, "Variable.init0(self)\nGet the original initial guess (set by `:=` or`default` or by a data\nstatement).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_19init0 = {"init0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_19init0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_18init0};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_19init0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init0 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("init0", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("init0", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_18init0(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_18init0(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init0", 0);

  /* "amplpy/variable.pxi":124
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_INIT0, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_INIT0, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 124, __pyx_L1_error)

  /* "amplpy/variable.pxi":125
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_INIT0, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lb(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":118
 *         return value
 * 
 *     def init0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the original initial guess (set by `:=` or`default` or by a data
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.init0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":127
 *         return value
 * 
 *     def lb(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current lower bound.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_21lb(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_20lb, "Variable.lb(self)\nReturns the current lower bound.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_21lb = {"lb", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_21lb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_20lb};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_21lb(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lb (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lb", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lb", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_20lb(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_20lb(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lb", 0);

  /* "amplpy/variable.pxi":132
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LB, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 132, __pyx_L1_error)

  /* "amplpy/variable.pxi":133
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def ub(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":127
 *         return value
 * 
 *     def lb(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current lower bound.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.lb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":135
 *         return value
 * 
 *     def ub(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current upper bound.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_23ub(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_22ub, "Variable.ub(self)\nReturns the current upper bound.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_23ub = {"ub", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_23ub, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_22ub};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_23ub(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ub (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ub", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ub", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_22ub(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_22ub(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ub", 0);

  /* "amplpy/variable.pxi":140
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_UB, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 140, __pyx_L1_error)

  /* "amplpy/variable.pxi":141
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lb0(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":135
 *         return value
 * 
 *     def ub(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current upper bound.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.ub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":143
 *         return value
 * 
 *     def lb0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the initial lower bounds, from the var declaration.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_25lb0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_24lb0, "Variable.lb0(self)\nReturns the initial lower bounds, from the var declaration.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_25lb0 = {"lb0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_25lb0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_24lb0};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_25lb0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lb0 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lb0", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lb0", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_24lb0(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_24lb0(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lb0", 0);

  /* "amplpy/variable.pxi":148
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB0, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LB0, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 148, __pyx_L1_error)

  /* "amplpy/variable.pxi":149
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB0, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def ub0(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":143
 *         return value
 * 
 *     def lb0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the initial lower bounds, from the var declaration.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.lb0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":151
 *         return value
 * 
 *     def ub0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the initial upper bound, from the var declaration.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_27ub0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_26ub0, "Variable.ub0(self)\nReturns the initial upper bound, from the var declaration.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_27ub0 = {"ub0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_27ub0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_26ub0};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_27ub0(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ub0 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ub0", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ub0", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_26ub0(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_26ub0(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ub0", 0);

  /* "amplpy/variable.pxi":156
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB0, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_UB0, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 156, __pyx_L1_error)

  /* "amplpy/variable.pxi":157
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB0, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lb1(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":151
 *         return value
 * 
 *     def ub0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the initial upper bound, from the var declaration.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.ub0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":159
 *         return value
 * 
 *     def lb1(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the weaker lower bound from AMPL's presolve phase.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_29lb1(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_28lb1, "Variable.lb1(self)\nReturns the weaker lower bound from AMPL's presolve phase.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_29lb1 = {"lb1", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_29lb1, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_28lb1};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_29lb1(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lb1 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lb1", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lb1", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_28lb1(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_28lb1(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lb1", 0);

  /* "amplpy/variable.pxi":164
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB1, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LB1, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 164, __pyx_L1_error)

  /* "amplpy/variable.pxi":165
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB1, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def ub1(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":159
 *         return value
 * 
 *     def lb1(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the weaker lower bound from AMPL's presolve phase.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.lb1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":167
 *         return value
 * 
 *     def ub1(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the weaker upper bound from AMPL's presolve phase.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_31ub1(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_30ub1, "Variable.ub1(self)\nReturns the weaker upper bound from AMPL's presolve phase.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_31ub1 = {"ub1", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_31ub1, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_30ub1};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_31ub1(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ub1 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ub1", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ub1", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_30ub1(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_30ub1(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ub1", 0);

  /* "amplpy/variable.pxi":172
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB1, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_UB1, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 172, __pyx_L1_error)

  /* "amplpy/variable.pxi":173
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB1, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lb2(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":167
 *         return value
 * 
 *     def ub1(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the weaker upper bound from AMPL's presolve phase.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.ub1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":175
 *         return value
 * 
 *     def lb2(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the stronger lower bound from AMPL's presolve phase.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_33lb2(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_32lb2, "Variable.lb2(self)\nReturns the stronger lower bound from AMPL's presolve phase.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_33lb2 = {"lb2", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_33lb2, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_32lb2};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_33lb2(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lb2 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lb2", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lb2", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_32lb2(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_32lb2(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lb2", 0);

  /* "amplpy/variable.pxi":180
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB2, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LB2, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 180, __pyx_L1_error)

  /* "amplpy/variable.pxi":181
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LB2, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def ub2(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":175
 *         return value
 * 
 *     def lb2(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the stronger lower bound from AMPL's presolve phase.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.lb2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":183
 *         return value
 * 
 *     def ub2(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the stronger upper bound from AMPL's presolve phase.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_35ub2(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_34ub2, "Variable.ub2(self)\nReturns the stronger upper bound from AMPL's presolve phase.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_35ub2 = {"ub2", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_35ub2, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_34ub2};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_35ub2(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ub2 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ub2", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ub2", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_34ub2(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_34ub2(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ub2", 0);

  /* "amplpy/variable.pxi":188
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB2, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_UB2, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 188, __pyx_L1_error)

  /* "amplpy/variable.pxi":189
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_UB2, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lrc(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":183
 *         return value
 * 
 *     def ub2(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the stronger upper bound from AMPL's presolve phase.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.ub2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":191
 *         return value
 * 
 *     def lrc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the reduced cost at lower bound.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_37lrc(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_36lrc, "Variable.lrc(self)\nReturns the reduced cost at lower bound.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_37lrc = {"lrc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_37lrc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_36lrc};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_37lrc(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lrc (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lrc", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lrc", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_36lrc(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_36lrc(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lrc", 0);

  /* "amplpy/variable.pxi":196
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LRC, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LRC, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 196, __pyx_L1_error)

  /* "amplpy/variable.pxi":197
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LRC, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def urc(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":191
 *         return value
 * 
 *     def lrc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the reduced cost at lower bound.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.lrc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":199
 *         return value
 * 
 *     def urc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the reduced cost at upper bound.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_39urc(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_38urc, "Variable.urc(self)\nReturns the reduced cost at upper bound.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_39urc = {"urc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_39urc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_38urc};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_39urc(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("urc (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("urc", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("urc", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_38urc(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_38urc(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("urc", 0);

  /* "amplpy/variable.pxi":204
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_URC, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_URC, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 204, __pyx_L1_error)

  /* "amplpy/variable.pxi":205
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_URC, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def lslack(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":199
 *         return value
 * 
 *     def urc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the reduced cost at upper bound.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.urc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":207
 *         return value
 * 
 *     def lslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the slack at lower bound (``val - lb``).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_41lslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_40lslack, "Variable.lslack(self)\nReturn the slack at lower bound (``val - lb``).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_41lslack = {"lslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_41lslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_40lslack};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_41lslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lslack (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("lslack", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("lslack", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_40lslack(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_40lslack(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lslack", 0);

  /* "amplpy/variable.pxi":212
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LSLACK, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_LSLACK, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 212, __pyx_L1_error)

  /* "amplpy/variable.pxi":213
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_LSLACK, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def uslack(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":207
 *         return value
 * 
 *     def lslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the slack at lower bound (``val - lb``).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.lslack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":215
 *         return value
 * 
 *     def uslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the slack at upper bound (``ub - val``).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_43uslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_42uslack, "Variable.uslack(self)\nReturn the slack at upper bound (``ub - val``).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_43uslack = {"uslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_43uslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_42uslack};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_43uslack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("uslack (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("uslack", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("uslack", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_42uslack(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_42uslack(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("uslack", 0);

  /* "amplpy/variable.pxi":220
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_USLACK, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_USLACK, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 220, __pyx_L1_error)

  /* "amplpy/variable.pxi":221
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_USLACK, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def rc(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":215
 *         return value
 * 
 *     def uslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the slack at upper bound (``ub - val``).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.uslack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":223
 *         return value
 * 
 *     def rc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the reduced cost (at the nearer bound).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_45rc(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_44rc, "Variable.rc(self)\nGet the reduced cost (at the nearer bound).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_45rc = {"rc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_45rc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_44rc};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_45rc(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rc (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("rc", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("rc", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_44rc(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_44rc(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rc", 0);

  /* "amplpy/variable.pxi":228
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_RC, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_RC, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 228, __pyx_L1_error)

  /* "amplpy/variable.pxi":229
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_RC, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def slack(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":223
 *         return value
 * 
 *     def rc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the reduced cost (at the nearer bound).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.rc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":231
 *         return value
 * 
 *     def slack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the bound slack which is the lesser of
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_47slack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_46slack, "Variable.slack(self)\nReturns the bound slack which is the lesser of\n:func:`~amplpy.Variable.lslack` and :func:`~amplpy.Variable.uslack`.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_47slack = {"slack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_47slack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_46slack};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_47slack(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("slack (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("slack", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("slack", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_46slack(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_46slack(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("slack", 0);

  /* "amplpy/variable.pxi":237
 *         """
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_SLACK, &value))             # <<<<<<<<<<<<<<
 *         return value
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_InstanceGetDoubleSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_SLACK, (&__pyx_v_value))); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 237, __pyx_L1_error)

  /* "amplpy/variable.pxi":238
 *         cdef double value
 *         PY_AMPL_CALL(campl.AMPL_InstanceGetDoubleSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_NUMERICSUFFIX.AMPL_SLACK, &value))
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def sstatus(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":231
 *         return value
 * 
 *     def slack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the bound slack which is the lesser of
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.Variable.slack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":240
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Solver status (basis status of variable).
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_49sstatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_48sstatus, "Variable.sstatus(self)\nSolver status (basis status of variable).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_49sstatus = {"sstatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_49sstatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_48sstatus};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_49sstatus(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sstatus (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("sstatus", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("sstatus", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_48sstatus(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_48sstatus(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sstatus", 0);

  /* "amplpy/variable.pxi":246
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_SSTATUS, (&__pyx_v_value_c));

  /* "amplpy/variable.pxi":247
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/variable.pxi":248
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 248, __pyx_L1_error)

    /* "amplpy/variable.pxi":247
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_SSTATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/variable.pxi":249
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(16, 249, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/variable.pxi":250
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/variable.pxi":252
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def status(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":240
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Solver status (basis status of variable).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Variable.sstatus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/variable.pxi":254
 *         return value
 * 
 *     def status(self):             # <<<<<<<<<<<<<<
 *         """
 *         AMPL status if not `in`, otherwise solver status.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_51status(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_50status, "Variable.status(self)\nAMPL status if not `in`, otherwise solver status.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_51status = {"status", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_51status, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_50status};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_51status(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("status (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("status", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("status", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_50status(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_50status(struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("status", 0);

  /* "amplpy/variable.pxi":260
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_InstanceGetStringSuffix(__pyx_v_self->__pyx_base._ampl->_c_ampl, __pyx_v_self->__pyx_base._name, __pyx_v_self->__pyx_base._index, AMPL_STATUS, (&__pyx_v_value_c));

  /* "amplpy/variable.pxi":261
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/variable.pxi":262
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(16, 262, __pyx_L1_error)

    /* "amplpy/variable.pxi":261
 *         cdef char* value_c
 *         errorinfo = campl.AMPL_InstanceGetStringSuffix(self._ampl._c_ampl, self._name, self._index, campl.AMPL_STRINGSUFFIX.AMPL_STATUS, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
*/
  }

  /* "amplpy/variable.pxi":263
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(16, 263, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(16, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_value = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/variable.pxi":264
 *             PY_AMPL_CALL(errorinfo)
 *         value = str(value_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/variable.pxi":266
 *         campl.AMPL_StringFree(&value_c)
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "amplpy/variable.pxi":254
 *         return value
 * 
 *     def status(self):             # <<<<<<<<<<<<<<
 *         """
 *         AMPL status if not `in`, otherwise solver status.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.Variable.status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_53__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_52__reduce_cython__, "Variable.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_53__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_53__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_52__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_53__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_52__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_52__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Variable.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_55__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8Variable_54__setstate_cython__, "Variable.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_8Variable_55__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_55__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_54__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_8Variable_55__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.Variable.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_8Variable_54__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_Variable *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8Variable_54__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_Variable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__index_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.Variable.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":36
 * 
 * 
 * def nested_dict_of_suffixes(lst):             # <<<<<<<<<<<<<<
 *     nested = {}
 *     for name, value in lst:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_3nested_dict_of_suffixes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_2nested_dict_of_suffixes, "nested_dict_of_suffixes(lst)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_3nested_dict_of_suffixes = {"nested_dict_of_suffixes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3nested_dict_of_suffixes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_2nested_dict_of_suffixes};
static PyObject *__pyx_pw_6amplpy_4ampl_3nested_dict_of_suffixes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_lst = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nested_dict_of_suffixes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_lst,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 36, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 36, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "nested_dict_of_suffixes", 0) < 0) __PYX_ERR(0, 36, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("nested_dict_of_suffixes", 1, 1, 1, i); __PYX_ERR(0, 36, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 36, __pyx_L3_error)
    }
    __pyx_v_lst = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nested_dict_of_suffixes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 36, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.nested_dict_of_suffixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_2nested_dict_of_suffixes(__pyx_self, __pyx_v_lst);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_2nested_dict_of_suffixes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lst) {
  PyObject *__pyx_v_nested = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  size_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13[3];
  Py_ssize_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("nested_dict_of_suffixes", 0);

  /* "amplpy/ampl.pyx":37
 * 
 * def nested_dict_of_suffixes(lst):
 *     nested = {}             # <<<<<<<<<<<<<<
 *     for name, value in lst:
 *         if "[" not in name:
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nested = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":38
 * def nested_dict_of_suffixes(lst):
 *     nested = {}
 *     for name, value in lst:             # <<<<<<<<<<<<<<
 *         if "[" not in name:
 *             nested[name] = value
*/
  if (likely(PyList_CheckExact(__pyx_v_lst)) || PyTuple_CheckExact(__pyx_v_lst)) {
    __pyx_t_1 = __pyx_v_lst; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_lst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 38, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 38, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 38, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 38, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRef(sequence, 0);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyList_GetItemRef(sequence, 1);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 38, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 38, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "amplpy/ampl.pyx":39
 *     nested = {}
 *     for name, value in lst:
 *         if "[" not in name:             # <<<<<<<<<<<<<<
 *             nested[name] = value
 *         else:
*/
    __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__8, __pyx_v_name, Py_NE)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 39, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "amplpy/ampl.pyx":40
 *     for name, value in lst:
 *         if "[" not in name:
 *             nested[name] = value             # <<<<<<<<<<<<<<
 *         else:
 *             p = name.find("[")
*/
      if (unlikely((PyDict_SetItem(__pyx_v_nested, __pyx_v_name, __pyx_v_value) < 0))) __PYX_ERR(0, 40, __pyx_L1_error)

      /* "amplpy/ampl.pyx":39
 *     nested = {}
 *     for name, value in lst:
 *         if "[" not in name:             # <<<<<<<<<<<<<<
 *             nested[name] = value
 *         else:
*/
      goto __pyx_L7;
    }

    /* "amplpy/ampl.pyx":42
 *             nested[name] = value
 *         else:
 *             p = name.find("[")             # <<<<<<<<<<<<<<
 *             v, index = name[:p], literal_eval(f"({name[p+1:-1]},)")
 *             if v not in nested:
*/
    /*else*/ {
      __pyx_t_6 = __pyx_v_name;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_10 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u__8};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_find, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "amplpy/ampl.pyx":43
 *         else:
 *             p = name.find("[")
 *             v, index = name[:p], literal_eval(f"({name[p+1:-1]},)")             # <<<<<<<<<<<<<<
 *             if v not in nested:
 *                 nested[v] = {}
*/
      __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_name, 0, 0, NULL, &__pyx_v_p, NULL, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_literal_eval); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = __Pyx_PyLong_AddObjC(__pyx_v_p, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_name, 0, -1L, &__pyx_t_11, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_t_12, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13[0] = __pyx_mstate_global->__pyx_kp_u__9;
      __pyx_t_13[1] = __pyx_t_11;
      __pyx_t_13[2] = __pyx_mstate_global->__pyx_kp_u__10;
      __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11));
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_10 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_10 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "amplpy/ampl.pyx":44
 *             p = name.find("[")
 *             v, index = name[:p], literal_eval(f"({name[p+1:-1]},)")
 *             if v not in nested:             # <<<<<<<<<<<<<<
 *                 nested[v] = {}
 *             if len(index) == 1:
*/
      __pyx_t_9 = (__Pyx_PyDict_ContainsTF(__pyx_v_v, __pyx_v_nested, Py_NE)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 44, __pyx_L1_error)
      if (__pyx_t_9) {

        /* "amplpy/ampl.pyx":45
 *             v, index = name[:p], literal_eval(f"({name[p+1:-1]},)")
 *             if v not in nested:
 *                 nested[v] = {}             # <<<<<<<<<<<<<<
 *             if len(index) == 1:
 *                 index = index[0]
*/
        __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (unlikely((PyDict_SetItem(__pyx_v_nested, __pyx_v_v, __pyx_t_6) < 0))) __PYX_ERR(0, 45, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":44
 *             p = name.find("[")
 *             v, index = name[:p], literal_eval(f"({name[p+1:-1]},)")
 *             if v not in nested:             # <<<<<<<<<<<<<<
 *                 nested[v] = {}
 *             if len(index) == 1:
*/
      }

      /* "amplpy/ampl.pyx":46
 *             if v not in nested:
 *                 nested[v] = {}
 *             if len(index) == 1:             # <<<<<<<<<<<<<<
 *                 index = index[0]
 *             nested[v][index] = value
*/
      __pyx_t_14 = PyObject_Length(__pyx_v_index); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 46, __pyx_L1_error)
      __pyx_t_9 = (__pyx_t_14 == 1);
      if (__pyx_t_9) {

        /* "amplpy/ampl.pyx":47
 *                 nested[v] = {}
 *             if len(index) == 1:
 *                 index = index[0]             # <<<<<<<<<<<<<<
 *             nested[v][index] = value
 *     return nested
*/
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_index, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":46
 *             if v not in nested:
 *                 nested[v] = {}
 *             if len(index) == 1:             # <<<<<<<<<<<<<<
 *                 index = index[0]
 *             nested[v][index] = value
*/
      }

      /* "amplpy/ampl.pyx":48
 *             if len(index) == 1:
 *                 index = index[0]
 *             nested[v][index] = value             # <<<<<<<<<<<<<<
 *     return nested
 * 
*/
      __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_nested, __pyx_v_v); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely((PyObject_SetItem(__pyx_t_6, __pyx_v_index, __pyx_v_value) < 0))) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L7:;

    /* "amplpy/ampl.pyx":38
 * def nested_dict_of_suffixes(lst):
 *     nested = {}
 *     for name, value in lst:             # <<<<<<<<<<<<<<
 *         if "[" not in name:
 *             nested[name] = value
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":49
 *                 index = index[0]
 *             nested[v][index] = value
 *     return nested             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_nested);
  __pyx_r = __pyx_v_nested;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":36
 * 
 * 
 * def nested_dict_of_suffixes(lst):             # <<<<<<<<<<<<<<
 *     nested = {}
 *     for name, value in lst:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("amplpy.ampl.nested_dict_of_suffixes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nested);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":114
 *     cdef object _error_handler_wrapper
 * 
 *     def __init__(self, environment=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
*/

/* Python wrapper */
static int __pyx_pw_6amplpy_4ampl_4AMPL_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL___init__, "\n        Constructor:\n        creates a new AMPL instance with the specified environment if provided.\n\n        Args:\n            environment (:class:`~amplpy.Environment`): This allows the user to\n            specify the location of the AMPL binaries to be used and to modify\n            the environment variables in which the AMPL interpreter will run.\n\n        Raises:\n            RuntimeError: If no valid AMPL license has been found or if the\n            translator cannot be started for any other reason.\n        ");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_6amplpy_4ampl_4AMPL___init__;
#endif
static int __pyx_pw_6amplpy_4ampl_4AMPL_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_environment = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_environment,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 114, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 114, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 114, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 114, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_environment = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 114, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL___init__(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_environment);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6amplpy_4ampl_4AMPL___init__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_environment) {
  struct __pyx_obj_6amplpy_4ampl_Environment *__pyx_v_env = 0;
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_v_line = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  AMPL_ENVIRONMENT *__pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  Py_ssize_t __pyx_t_17;
  PyObject *(*__pyx_t_18)(PyObject *);
  PyObject *__pyx_t_19[3];
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  char const *__pyx_t_23;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  PyObject *__pyx_t_28 = NULL;
  PyObject *__pyx_t_29 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_environment);

  /* "amplpy/ampl.pyx":129
 *         """
 *         cdef Environment env
 *         try:             # <<<<<<<<<<<<<<
 *             if environment is None and os.name == "nt":
 *                 environment = Environment()
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "amplpy/ampl.pyx":130
 *         cdef Environment env
 *         try:
 *             if environment is None and os.name == "nt":             # <<<<<<<<<<<<<<
 *                 environment = Environment()
 *             if environment is None:
*/
      __pyx_t_5 = (__pyx_v_environment == Py_None);
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L10_bool_binop_done;
      }
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 130, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 130, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_nt, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 130, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_4 = __pyx_t_5;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_4) {

        /* "amplpy/ampl.pyx":131
 *         try:
 *             if environment is None and os.name == "nt":
 *                 environment = Environment()             # <<<<<<<<<<<<<<
 *             if environment is None:
 *                 PY_AMPL_CALL(campl.AMPL_Create(&self._c_ampl))
*/
        __pyx_t_6 = NULL;
        __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment);
        __pyx_t_8 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment); 
        __pyx_t_9 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
          __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 131, __pyx_L3_error)
          __Pyx_GOTREF((PyObject *)__pyx_t_7);
        }
        __Pyx_DECREF_SET(__pyx_v_environment, ((PyObject *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "amplpy/ampl.pyx":130
 *         cdef Environment env
 *         try:
 *             if environment is None and os.name == "nt":             # <<<<<<<<<<<<<<
 *                 environment = Environment()
 *             if environment is None:
*/
      }

      /* "amplpy/ampl.pyx":132
 *             if environment is None and os.name == "nt":
 *                 environment = Environment()
 *             if environment is None:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(campl.AMPL_Create(&self._c_ampl))
 *             else:
*/
      __pyx_t_4 = (__pyx_v_environment == Py_None);
      if (__pyx_t_4) {

        /* "amplpy/ampl.pyx":133
 *                 environment = Environment()
 *             if environment is None:
 *                 PY_AMPL_CALL(campl.AMPL_Create(&self._c_ampl))             # <<<<<<<<<<<<<<
 *             else:
 *                 env = environment
*/
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_Create((&__pyx_v_self->_c_ampl))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error)

        /* "amplpy/ampl.pyx":132
 *             if environment is None and os.name == "nt":
 *                 environment = Environment()
 *             if environment is None:             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(campl.AMPL_Create(&self._c_ampl))
 *             else:
*/
        goto __pyx_L12;
      }

      /* "amplpy/ampl.pyx":135
 *                 PY_AMPL_CALL(campl.AMPL_Create(&self._c_ampl))
 *             else:
 *                 env = environment             # <<<<<<<<<<<<<<
 *                 PY_AMPL_CALL(campl.AMPL_CreateWithEnv(&self._c_ampl, env.get_c_pointer()))
 *         except RuntimeError as exp:
*/
      /*else*/ {
        __pyx_t_7 = __pyx_v_environment;
        __Pyx_INCREF(__pyx_t_7);
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment))))) __PYX_ERR(0, 135, __pyx_L3_error)
        __pyx_v_env = ((struct __pyx_obj_6amplpy_4ampl_Environment *)__pyx_t_7);
        __pyx_t_7 = 0;

        /* "amplpy/ampl.pyx":136
 *             else:
 *                 env = environment
 *                 PY_AMPL_CALL(campl.AMPL_CreateWithEnv(&self._c_ampl, env.get_c_pointer()))             # <<<<<<<<<<<<<<
 *         except RuntimeError as exp:
 *             if str(exp).startswith("AMPL could not be started"):
*/
        __pyx_t_10 = ((struct __pyx_vtabstruct_6amplpy_4ampl_Environment *)__pyx_v_env->__pyx_vtab)->get_c_pointer(__pyx_v_env); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)
        __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_CreateWithEnv((&__pyx_v_self->_c_ampl), __pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)
      }
      __pyx_L12:;

      /* "amplpy/ampl.pyx":129
 *         """
 *         cdef Environment env
 *         try:             # <<<<<<<<<<<<<<
 *             if environment is None and os.name == "nt":
 *                 environment = Environment()
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "amplpy/ampl.pyx":137
 *                 env = environment
 *                 PY_AMPL_CALL(campl.AMPL_CreateWithEnv(&self._c_ampl, env.get_c_pointer()))
 *         except RuntimeError as exp:             # <<<<<<<<<<<<<<
 *             if str(exp).startswith("AMPL could not be started"):
 *                 print("*" * 79, file=sys.stderr)
*/
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_RuntimeError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("amplpy.ampl.AMPL.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 137, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_exp = __pyx_t_8;
      /*try:*/ {

        /* "amplpy/ampl.pyx":138
 *                 PY_AMPL_CALL(campl.AMPL_CreateWithEnv(&self._c_ampl, env.get_c_pointer()))
 *         except RuntimeError as exp:
 *             if str(exp).startswith("AMPL could not be started"):             # <<<<<<<<<<<<<<
 *                 print("*" * 79, file=sys.stderr)
 *                 for line in AMPL_NOT_FOUND_MESSAGE.split("\n"):
*/
        __pyx_t_12 = __Pyx_PyObject_Unicode(__pyx_v_exp); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 138, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_4 = __Pyx_PyUnicode_Tailmatch(__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_AMPL_could_not_be_started, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 138, __pyx_L18_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (__pyx_t_4) {

          /* "amplpy/ampl.pyx":139
 *         except RuntimeError as exp:
 *             if str(exp).startswith("AMPL could not be started"):
 *                 print("*" * 79, file=sys.stderr)             # <<<<<<<<<<<<<<
 *                 for line in AMPL_NOT_FOUND_MESSAGE.split("\n"):
 *                     print(f"* {line:75} *", file=sys.stderr)
*/
          __pyx_t_13 = NULL;
          __Pyx_INCREF(__pyx_builtin_print);
          __pyx_t_14 = __pyx_builtin_print; 
          __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 139, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_stderr); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 139, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_9 = 1;
          {
            PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_13, __pyx_mstate_global->__pyx_kp_u__11};
            __pyx_t_15 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 139, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_15);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_file, __pyx_t_16, __pyx_t_15, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 139, __pyx_L18_error)
            __pyx_t_12 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_14, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_15);
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 139, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_12);
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "amplpy/ampl.pyx":140
 *             if str(exp).startswith("AMPL could not be started"):
 *                 print("*" * 79, file=sys.stderr)
 *                 for line in AMPL_NOT_FOUND_MESSAGE.split("\n"):             # <<<<<<<<<<<<<<
 *                     print(f"* {line:75} *", file=sys.stderr)
 *                 print("*" * 79, file=sys.stderr)
*/
          __pyx_t_14 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_AMPL_NOT_FOUND_MESSAGE); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 140, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_split); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 140, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_9 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_16))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_16);
            assert(__pyx_t_14);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_16, __pyx__function);
            __pyx_t_9 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u__5};
            __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 140, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_12);
          }
          if (likely(PyList_CheckExact(__pyx_t_12)) || PyTuple_CheckExact(__pyx_t_12)) {
            __pyx_t_16 = __pyx_t_12; __Pyx_INCREF(__pyx_t_16);
            __pyx_t_17 = 0;
            __pyx_t_18 = NULL;
          } else {
            __pyx_t_17 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 140, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_16);
            __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 140, __pyx_L18_error)
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          for (;;) {
            if (likely(!__pyx_t_18)) {
              if (likely(PyList_CheckExact(__pyx_t_16))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_16);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 140, __pyx_L18_error)
                  #endif
                  if (__pyx_t_17 >= __pyx_temp) break;
                }
                __pyx_t_12 = __Pyx_PyList_GetItemRef(__pyx_t_16, __pyx_t_17);
                ++__pyx_t_17;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_16);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 140, __pyx_L18_error)
                  #endif
                  if (__pyx_t_17 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_12 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_17));
                #else
                __pyx_t_12 = __Pyx_PySequence_ITEM(__pyx_t_16, __pyx_t_17);
                #endif
                ++__pyx_t_17;
              }
              if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 140, __pyx_L18_error)
            } else {
              __pyx_t_12 = __pyx_t_18(__pyx_t_16);
              if (unlikely(!__pyx_t_12)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 140, __pyx_L18_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_12);
            __pyx_t_12 = 0;

            /* "amplpy/ampl.pyx":141
 *                 print("*" * 79, file=sys.stderr)
 *                 for line in AMPL_NOT_FOUND_MESSAGE.split("\n"):
 *                     print(f"* {line:75} *", file=sys.stderr)             # <<<<<<<<<<<<<<
 *                 print("*" * 79, file=sys.stderr)
 *             raise
*/
            __pyx_t_14 = NULL;
            __Pyx_INCREF(__pyx_builtin_print);
            __pyx_t_15 = __pyx_builtin_print; 
            __pyx_t_13 = __Pyx_PyObject_Format(__pyx_v_line, __pyx_mstate_global->__pyx_kp_u_75); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 141, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_19[0] = __pyx_mstate_global->__pyx_kp_u__12;
            __pyx_t_19[1] = __pyx_t_13;
            __pyx_t_19[2] = __pyx_mstate_global->__pyx_kp_u__13;
            __pyx_t_20 = __Pyx_PyUnicode_Join(__pyx_t_19, 3, 2 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
            if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 141, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_20);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 141, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_stderr); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 141, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_21);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_9 = 1;
            {
              PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_14, __pyx_t_20};
              __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 141, __pyx_L18_error)
              __Pyx_GOTREF(__pyx_t_13);
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_file, __pyx_t_21, __pyx_t_13, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 141, __pyx_L18_error)
              __pyx_t_12 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_15, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_13);
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
              __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 141, __pyx_L18_error)
              __Pyx_GOTREF(__pyx_t_12);
            }
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

            /* "amplpy/ampl.pyx":140
 *             if str(exp).startswith("AMPL could not be started"):
 *                 print("*" * 79, file=sys.stderr)
 *                 for line in AMPL_NOT_FOUND_MESSAGE.split("\n"):             # <<<<<<<<<<<<<<
 *                     print(f"* {line:75} *", file=sys.stderr)
 *                 print("*" * 79, file=sys.stderr)
*/
          }
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

          /* "amplpy/ampl.pyx":142
 *                 for line in AMPL_NOT_FOUND_MESSAGE.split("\n"):
 *                     print(f"* {line:75} *", file=sys.stderr)
 *                 print("*" * 79, file=sys.stderr)             # <<<<<<<<<<<<<<
 *             raise
 *         self._output_handler = None
*/
          __pyx_t_12 = NULL;
          __Pyx_INCREF(__pyx_builtin_print);
          __pyx_t_15 = __pyx_builtin_print; 
          __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 142, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_stderr); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 142, __pyx_L18_error)
          __Pyx_GOTREF(__pyx_t_21);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_9 = 1;
          {
            PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u__11};
            __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 142, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_13);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_file, __pyx_t_21, __pyx_t_13, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 142, __pyx_L18_error)
            __pyx_t_16 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_15, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_13);
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 142, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_16);
          }
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

          /* "amplpy/ampl.pyx":138
 *                 PY_AMPL_CALL(campl.AMPL_CreateWithEnv(&self._c_ampl, env.get_c_pointer()))
 *         except RuntimeError as exp:
 *             if str(exp).startswith("AMPL could not be started"):             # <<<<<<<<<<<<<<
 *                 print("*" * 79, file=sys.stderr)
 *                 for line in AMPL_NOT_FOUND_MESSAGE.split("\n"):
*/
        }

        /* "amplpy/ampl.pyx":143
 *                     print(f"* {line:75} *", file=sys.stderr)
 *                 print("*" * 79, file=sys.stderr)
 *             raise             # <<<<<<<<<<<<<<
 *         self._output_handler = None
 *         self._error_handler = None
*/
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_8, __pyx_t_6);
        __pyx_t_7 = 0;  __pyx_t_8 = 0;  __pyx_t_6 = 0; 
        __PYX_ERR(0, 143, __pyx_L18_error)
      }

      /* "amplpy/ampl.pyx":137
 *                 env = environment
 *                 PY_AMPL_CALL(campl.AMPL_CreateWithEnv(&self._c_ampl, env.get_c_pointer()))
 *         except RuntimeError as exp:             # <<<<<<<<<<<<<<
 *             if str(exp).startswith("AMPL could not be started"):
 *                 print("*" * 79, file=sys.stderr)
*/
      /*finally:*/ {
        __pyx_L18_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; __pyx_t_29 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_27, &__pyx_t_28, &__pyx_t_29);
          if ( unlikely(__Pyx_GetException(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26) < 0)) __Pyx_ErrFetch(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26);
          __Pyx_XGOTREF(__pyx_t_24);
          __Pyx_XGOTREF(__pyx_t_25);
          __Pyx_XGOTREF(__pyx_t_26);
          __Pyx_XGOTREF(__pyx_t_27);
          __Pyx_XGOTREF(__pyx_t_28);
          __Pyx_XGOTREF(__pyx_t_29);
          __pyx_t_11 = __pyx_lineno; __pyx_t_22 = __pyx_clineno; __pyx_t_23 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_exp); __pyx_v_exp = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_27);
          __Pyx_XGIVEREF(__pyx_t_28);
          __Pyx_XGIVEREF(__pyx_t_29);
          __Pyx_ExceptionReset(__pyx_t_27, __pyx_t_28, __pyx_t_29);
          __Pyx_XGIVEREF(__pyx_t_24);
          __Pyx_XGIVEREF(__pyx_t_25);
          __Pyx_XGIVEREF(__pyx_t_26);
          __Pyx_ErrRestore(__pyx_t_24, __pyx_t_25, __pyx_t_26);
          __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; __pyx_t_29 = 0;
          __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_22; __pyx_filename = __pyx_t_23;
          goto __pyx_L5_except_error;
        }
      }
    }
    goto __pyx_L5_except_error;

    /* "amplpy/ampl.pyx":129
 *         """
 *         cdef Environment env
 *         try:             # <<<<<<<<<<<<<<
 *             if environment is None and os.name == "nt":
 *                 environment = Environment()
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "amplpy/ampl.pyx":144
 *                 print("*" * 79, file=sys.stderr)
 *             raise
 *         self._output_handler = None             # <<<<<<<<<<<<<<
 *         self._error_handler = None
 *         self.set_output_handler(OutputHandler())
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_output_handler);
  __Pyx_DECREF(__pyx_v_self->_output_handler);
  __pyx_v_self->_output_handler = Py_None;

  /* "amplpy/ampl.pyx":145
 *             raise
 *         self._output_handler = None
 *         self._error_handler = None             # <<<<<<<<<<<<<<
 *         self.set_output_handler(OutputHandler())
 *         self.set_error_handler(ErrorHandler())
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_error_handler);
  __Pyx_DECREF(__pyx_v_self->_error_handler);
  __pyx_v_self->_error_handler = Py_None;

  /* "amplpy/ampl.pyx":146
 *         self._output_handler = None
 *         self._error_handler = None
 *         self.set_output_handler(OutputHandler())             # <<<<<<<<<<<<<<
 *         self.set_error_handler(ErrorHandler())
 * 
*/
  __pyx_t_8 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_16 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_OutputHandler);
  __pyx_t_15 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_OutputHandler); 
  __pyx_t_9 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_16, NULL};
    __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_7);
  }
  __pyx_t_9 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, ((PyObject *)__pyx_t_7)};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_output_handler, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF((PyObject *)__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "amplpy/ampl.pyx":147
 *         self._error_handler = None
 *         self.set_output_handler(OutputHandler())
 *         self.set_error_handler(ErrorHandler())             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_7 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_15 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler);
  __pyx_t_16 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler); 
  __pyx_t_9 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_15, NULL};
    __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_8);
  }
  __pyx_t_9 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, ((PyObject *)__pyx_t_8)};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_error_handler, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF((PyObject *)__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "amplpy/ampl.pyx":114
 *     cdef object _error_handler_wrapper
 * 
 *     def __init__(self, environment=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_env);
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XDECREF(__pyx_v_line);
  __Pyx_XDECREF(__pyx_v_environment);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":149
 *         self.set_error_handler(ErrorHandler())
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Default destructor:
*/

/* Python wrapper */
static void __pyx_pw_6amplpy_4ampl_4AMPL_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6amplpy_4ampl_4AMPL_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6amplpy_4ampl_4AMPL_2__dealloc__(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6amplpy_4ampl_4AMPL_2__dealloc__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "amplpy/ampl.pyx":155
 *         kills the underlying  interpreter).
 *         """
 *         self.close()             # <<<<<<<<<<<<<<
 * 
 *     #def get_data_arrow(self, *statements):
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":149
 *         self.set_error_handler(ErrorHandler())
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Default destructor:
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("amplpy.ampl.AMPL.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "amplpy/ampl.pyx":179
 * 
 * 
 *     def get_data(self, *statements):             # <<<<<<<<<<<<<<
 *         """
 *         Get the data corresponding to the display statements. The statements
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_5get_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_4get_data, "AMPL.get_data(self, *statements)\nGet the data corresponding to the display statements. The statements\ncan be AMPL expressions, or entities. It captures the equivalent of the\ncommand:\n\n.. code-block:: ampl\n\n    display ds1, ..., dsn;\n\nwhere ds1, ..., dsn are the ``displayStatements`` with which the\nfunction is called.\n\nAs only one DataFrame is returned, the operation will fail if the\nresults of the display statements cannot be indexed over the same set.\nAs a result, any attempt to get data from more than one set, or to get\ndata for multiple parameters with a different number of indexing sets\nwill fail.\n\nArgs:\n    statements: The display statements to be fetched.\n\nRaises:\n    TypeError: if the AMPL visualization command does not succeed\n    for one of the reasons listed above.\n\n    RuntimeError: if there are issues with the data.\n\nReturns:\n    DataFrame capturing the output of the display\n    command in tabular form.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_5get_data = {"get_data", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_5get_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_4get_data};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_5get_data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_statements = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_data", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_statements = __pyx_args;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4get_data(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_statements);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_statements);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4get_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_statements) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_DATAFRAME *__pyx_v_data;
  char **__pyx_v_statements_c;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  char const *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_data", 0);

  /* "amplpy/ampl.pyx":213
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_DATAFRAME* data
 *         cdef char** statements_c = <char**> malloc(len(statements) * sizeof(char*))             # <<<<<<<<<<<<<<
 *         for i in range(len(statements)):
 *             statements_c[i] = strdup(statements[i].encode('utf-8'))
*/
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_statements); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 213, __pyx_L1_error)
  __pyx_v_statements_c = ((char **)malloc((__pyx_t_1 * (sizeof(char *)))));

  /* "amplpy/ampl.pyx":214
 *         cdef campl.AMPL_DATAFRAME* data
 *         cdef char** statements_c = <char**> malloc(len(statements) * sizeof(char*))
 *         for i in range(len(statements)):             # <<<<<<<<<<<<<<
 *             statements_c[i] = strdup(statements[i].encode('utf-8'))
 *         errorinfo = campl.AMPL_GetData(self._c_ampl, statements_c, len(statements), &data)
*/
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_statements); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 214, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "amplpy/ampl.pyx":215
 *         cdef char** statements_c = <char**> malloc(len(statements) * sizeof(char*))
 *         for i in range(len(statements)):
 *             statements_c[i] = strdup(statements[i].encode('utf-8'))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_GetData(self._c_ampl, statements_c, len(statements), &data)
 *         for i in range(len(statements)):
*/
    __pyx_t_5 = __Pyx_PyTuple_GET_ITEM(__pyx_v_statements, __pyx_v_i);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error)
    (__pyx_v_statements_c[__pyx_v_i]) = strdup(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }

  /* "amplpy/ampl.pyx":216
 *         for i in range(len(statements)):
 *             statements_c[i] = strdup(statements[i].encode('utf-8'))
 *         errorinfo = campl.AMPL_GetData(self._c_ampl, statements_c, len(statements), &data)             # <<<<<<<<<<<<<<
 *         for i in range(len(statements)):
 *             free(statements_c[i])
*/
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_statements); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 216, __pyx_L1_error)
  __pyx_v_errorinfo = AMPL_GetData(__pyx_v_self->_c_ampl, __pyx_v_statements_c, __pyx_t_1, (&__pyx_v_data));

  /* "amplpy/ampl.pyx":217
 *             statements_c[i] = strdup(statements[i].encode('utf-8'))
 *         errorinfo = campl.AMPL_GetData(self._c_ampl, statements_c, len(statements), &data)
 *         for i in range(len(statements)):             # <<<<<<<<<<<<<<
 *             free(statements_c[i])
 *         free(statements_c)
*/
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_statements); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 217, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "amplpy/ampl.pyx":218
 *         errorinfo = campl.AMPL_GetData(self._c_ampl, statements_c, len(statements), &data)
 *         for i in range(len(statements)):
 *             free(statements_c[i])             # <<<<<<<<<<<<<<
 *         free(statements_c)
 *         if errorinfo:
*/
    free((__pyx_v_statements_c[__pyx_v_i]));
  }

  /* "amplpy/ampl.pyx":219
 *         for i in range(len(statements)):
 *             free(statements_c[i])
 *         free(statements_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  free(__pyx_v_statements_c);

  /* "amplpy/ampl.pyx":220
 *             free(statements_c[i])
 *         free(statements_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         return DataFrame.create(data)
*/
  __pyx_t_8 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_8) {

    /* "amplpy/ampl.pyx":221
 *         free(statements_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         return DataFrame.create(data)
 * 
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error)

    /* "amplpy/ampl.pyx":220
 *             free(statements_c[i])
 *         free(statements_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         return DataFrame.create(data)
*/
  }

  /* "amplpy/ampl.pyx":222
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         return DataFrame.create(data)             # <<<<<<<<<<<<<<
 * 
 *     def get_entity(self, name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_6amplpy_4ampl_9DataFrame_create(__pyx_v_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":179
 * 
 * 
 *     def get_data(self, *statements):             # <<<<<<<<<<<<<<
 *         """
 *         Get the data corresponding to the display statements. The statements
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":224
 *         return DataFrame.create(data)
 * 
 *     def get_entity(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get entity corresponding to the specified name (looks for it in all
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7get_entity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_6get_entity, "AMPL.get_entity(self, name)\nGet entity corresponding to the specified name (looks for it in all\ntypes of entities).\n\nArgs:\n    name: Name of the entity.\n\nRaises:\n    KeyError: if the specified entity does not exist.\n\nReturns:\n    The AMPL entity with the specified name.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_7get_entity = {"get_entity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_7get_entity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_6get_entity};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7get_entity(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_entity (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 224, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 224, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_entity", 0) < 0) __PYX_ERR(0, 224, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_entity", 1, 1, 1, i); __PYX_ERR(0, 224, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 224, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_entity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 224, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_entity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_6get_entity(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6get_entity(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name) {
  char *__pyx_v_name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_entity", 0);

  /* "amplpy/ampl.pyx":238
 *             The AMPL entity with the specified name.
 *         """
 *         cdef char* name_c = strdup(name.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         return Entity.create(self, name_c, NULL, None)
 * 
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error)
  __pyx_v_name_c = strdup(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":239
 *         """
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         return Entity.create(self, name_c, NULL, None)             # <<<<<<<<<<<<<<
 * 
 *     def get_variable(self, name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_6Entity_create(__pyx_v_self, __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":224
 *         return DataFrame.create(data)
 * 
 *     def get_entity(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get entity corresponding to the specified name (looks for it in all
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_entity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":241
 *         return Entity.create(self, name_c, NULL, None)
 * 
 *     def get_variable(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the variable with the corresponding name.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_9get_variable(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_8get_variable, "AMPL.get_variable(self, name)\nGet the variable with the corresponding name.\n\nArgs:\n    name: Name of the variable to be found.\n\nRaises:\n    KeyError: if the specified variable does not exist.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_9get_variable = {"get_variable", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_9get_variable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_8get_variable};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_9get_variable(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_variable (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 241, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 241, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_variable", 0) < 0) __PYX_ERR(0, 241, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_variable", 1, 1, 1, i); __PYX_ERR(0, 241, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 241, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_variable", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 241, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_8get_variable(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_8get_variable(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_ENTITYTYPE __pyx_v_entitytype;
  char *__pyx_v_name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_variable", 0);

  /* "amplpy/ampl.pyx":253
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error)
  __pyx_v_name_c = strdup(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":254
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             free(name_c)
*/
  __pyx_v_errorinfo = AMPL_EntityGetType(__pyx_v_self->_c_ampl, __pyx_v_name_c, (&__pyx_v_entitytype));

  /* "amplpy/ampl.pyx":255
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":256
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_VARIABLE:
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":257
 *         if errorinfo:
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         if entitytype != campl.AMPL_VARIABLE:
 *             free(name_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error)

    /* "amplpy/ampl.pyx":255
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  }

  /* "amplpy/ampl.pyx":258
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_VARIABLE, name)
*/
  __pyx_t_5 = (__pyx_v_entitytype != AMPL_VARIABLE);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":259
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_VARIABLE:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             raiseKeyError(campl.AMPL_VARIABLE, name)
 *         return Variable.create(self, name_c, NULL, None)
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":260
 *         if entitytype != campl.AMPL_VARIABLE:
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_VARIABLE, name)             # <<<<<<<<<<<<<<
 *         return Variable.create(self, name_c, NULL, None)
 * 
*/
    if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_name))) __PYX_ERR(0, 260, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_raiseKeyError(AMPL_VARIABLE, ((PyObject*)__pyx_v_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L1_error)

    /* "amplpy/ampl.pyx":258
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_VARIABLE:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_VARIABLE, name)
*/
  }

  /* "amplpy/ampl.pyx":261
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_VARIABLE, name)
 *         return Variable.create(self, name_c, NULL, None)             # <<<<<<<<<<<<<<
 * 
 *     def get_constraint(self, name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_8Variable_create(__pyx_v_self, __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":241
 *         return Entity.create(self, name_c, NULL, None)
 * 
 *     def get_variable(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the variable with the corresponding name.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":263
 *         return Variable.create(self, name_c, NULL, None)
 * 
 *     def get_constraint(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint with the corresponding name.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_11get_constraint(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_10get_constraint, "AMPL.get_constraint(self, name)\nGet the constraint with the corresponding name.\n\nArgs:\n    name: Name of the constraint to be found.\n\nRaises:\n    KeyError: if the specified constraint does not exist.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_11get_constraint = {"get_constraint", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_11get_constraint, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_10get_constraint};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_11get_constraint(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_constraint (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 263, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 263, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_constraint", 0) < 0) __PYX_ERR(0, 263, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_constraint", 1, 1, 1, i); __PYX_ERR(0, 263, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 263, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_constraint", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 263, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_constraint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_10get_constraint(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_10get_constraint(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_ENTITYTYPE __pyx_v_entitytype;
  char *__pyx_v_name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_constraint", 0);

  /* "amplpy/ampl.pyx":275
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error)
  __pyx_v_name_c = strdup(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":276
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             free(name_c)
*/
  __pyx_v_errorinfo = AMPL_EntityGetType(__pyx_v_self->_c_ampl, __pyx_v_name_c, (&__pyx_v_entitytype));

  /* "amplpy/ampl.pyx":277
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":278
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_CONSTRAINT:
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":279
 *         if errorinfo:
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         if entitytype != campl.AMPL_CONSTRAINT:
 *             free(name_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error)

    /* "amplpy/ampl.pyx":277
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  }

  /* "amplpy/ampl.pyx":280
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_CONSTRAINT:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_CONSTRAINT, name)
*/
  __pyx_t_5 = (__pyx_v_entitytype != AMPL_CONSTRAINT);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":281
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_CONSTRAINT:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             raiseKeyError(campl.AMPL_CONSTRAINT, name)
 *         return Constraint.create(self, name_c, NULL, None)
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":282
 *         if entitytype != campl.AMPL_CONSTRAINT:
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_CONSTRAINT, name)             # <<<<<<<<<<<<<<
 *         return Constraint.create(self, name_c, NULL, None)
 * 
*/
    if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_name))) __PYX_ERR(0, 282, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_raiseKeyError(AMPL_CONSTRAINT, ((PyObject*)__pyx_v_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L1_error)

    /* "amplpy/ampl.pyx":280
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_CONSTRAINT:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_CONSTRAINT, name)
*/
  }

  /* "amplpy/ampl.pyx":283
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_CONSTRAINT, name)
 *         return Constraint.create(self, name_c, NULL, None)             # <<<<<<<<<<<<<<
 * 
 *     def get_objective(self, name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_10Constraint_create(__pyx_v_self, __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":263
 *         return Variable.create(self, name_c, NULL, None)
 * 
 *     def get_constraint(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint with the corresponding name.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_constraint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":285
 *         return Constraint.create(self, name_c, NULL, None)
 * 
 *     def get_objective(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the objective with the corresponding name.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_13get_objective(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_12get_objective, "AMPL.get_objective(self, name)\nGet the objective with the corresponding name.\n\nArgs:\n    name: Name of the objective to be found.\n\nRaises:\n    KeyError: if the specified objective does not exist.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_13get_objective = {"get_objective", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_13get_objective, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_12get_objective};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_13get_objective(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_objective (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 285, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 285, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_objective", 0) < 0) __PYX_ERR(0, 285, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_objective", 1, 1, 1, i); __PYX_ERR(0, 285, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 285, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_objective", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 285, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_objective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_12get_objective(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_12get_objective(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_ENTITYTYPE __pyx_v_entitytype;
  char *__pyx_v_name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_objective", 0);

  /* "amplpy/ampl.pyx":297
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 297, __pyx_L1_error)
  __pyx_v_name_c = strdup(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":298
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             free(name_c)
*/
  __pyx_v_errorinfo = AMPL_EntityGetType(__pyx_v_self->_c_ampl, __pyx_v_name_c, (&__pyx_v_entitytype));

  /* "amplpy/ampl.pyx":299
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":300
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_OBJECTIVE:
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":301
 *         if errorinfo:
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         if entitytype != campl.AMPL_OBJECTIVE:
 *             free(name_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error)

    /* "amplpy/ampl.pyx":299
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  }

  /* "amplpy/ampl.pyx":302
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_OBJECTIVE:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_OBJECTIVE, name)
*/
  __pyx_t_5 = (__pyx_v_entitytype != AMPL_OBJECTIVE);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":303
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_OBJECTIVE:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             raiseKeyError(campl.AMPL_OBJECTIVE, name)
 *         return Objective.create(self, name_c, NULL, None)
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":304
 *         if entitytype != campl.AMPL_OBJECTIVE:
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_OBJECTIVE, name)             # <<<<<<<<<<<<<<
 *         return Objective.create(self, name_c, NULL, None)
 * 
*/
    if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_name))) __PYX_ERR(0, 304, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_raiseKeyError(AMPL_OBJECTIVE, ((PyObject*)__pyx_v_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L1_error)

    /* "amplpy/ampl.pyx":302
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_OBJECTIVE:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_OBJECTIVE, name)
*/
  }

  /* "amplpy/ampl.pyx":305
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_OBJECTIVE, name)
 *         return Objective.create(self, name_c, NULL, None)             # <<<<<<<<<<<<<<
 * 
 *     def get_set(self, name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9Objective_create(__pyx_v_self, __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":285
 *         return Constraint.create(self, name_c, NULL, None)
 * 
 *     def get_objective(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the objective with the corresponding name.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_objective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":307
 *         return Objective.create(self, name_c, NULL, None)
 * 
 *     def get_set(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the set with the corresponding name.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_15get_set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_14get_set, "AMPL.get_set(self, name)\nGet the set with the corresponding name.\n\nArgs:\n    name: Name of the set to be found.\n\nRaises:\n    KeyError: if the specified set does not exist.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_15get_set = {"get_set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_15get_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_14get_set};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_15get_set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_set (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 307, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 307, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_set", 0) < 0) __PYX_ERR(0, 307, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_set", 1, 1, 1, i); __PYX_ERR(0, 307, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 307, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_set", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 307, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_14get_set(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_14get_set(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_ENTITYTYPE __pyx_v_entitytype;
  char *__pyx_v_name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_set", 0);

  /* "amplpy/ampl.pyx":319
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error)
  __pyx_v_name_c = strdup(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":320
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             free(name_c)
*/
  __pyx_v_errorinfo = AMPL_EntityGetType(__pyx_v_self->_c_ampl, __pyx_v_name_c, (&__pyx_v_entitytype));

  /* "amplpy/ampl.pyx":321
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":322
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_SET:
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":323
 *         if errorinfo:
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         if entitytype != campl.AMPL_SET:
 *             free(name_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 323, __pyx_L1_error)

    /* "amplpy/ampl.pyx":321
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  }

  /* "amplpy/ampl.pyx":324
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_SET:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_SET, name)
*/
  __pyx_t_5 = (__pyx_v_entitytype != AMPL_SET);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":325
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_SET:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             raiseKeyError(campl.AMPL_SET, name)
 *         return Set.create(self, name_c, NULL, None)
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":326
 *         if entitytype != campl.AMPL_SET:
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_SET, name)             # <<<<<<<<<<<<<<
 *         return Set.create(self, name_c, NULL, None)
 * 
*/
    if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_name))) __PYX_ERR(0, 326, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_raiseKeyError(AMPL_SET, ((PyObject*)__pyx_v_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L1_error)

    /* "amplpy/ampl.pyx":324
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_SET:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_SET, name)
*/
  }

  /* "amplpy/ampl.pyx":327
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_SET, name)
 *         return Set.create(self, name_c, NULL, None)             # <<<<<<<<<<<<<<
 * 
 *     def get_parameter(self, name):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_3Set_create(__pyx_v_self, __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":307
 *         return Objective.create(self, name_c, NULL, None)
 * 
 *     def get_set(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the set with the corresponding name.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":329
 *         return Set.create(self, name_c, NULL, None)
 * 
 *     def get_parameter(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the parameter with the corresponding name.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17get_parameter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_16get_parameter, "AMPL.get_parameter(self, name)\nGet the parameter with the corresponding name.\n\nArgs:\n    name: Name of the parameter to be found.\n\nRaises:\n    KeyError: if the specified parameter does not exist.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_17get_parameter = {"get_parameter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_17get_parameter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_16get_parameter};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17get_parameter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_parameter (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 329, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 329, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_parameter", 0) < 0) __PYX_ERR(0, 329, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_parameter", 1, 1, 1, i); __PYX_ERR(0, 329, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 329, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_parameter", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 329, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_parameter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_16get_parameter(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_16get_parameter(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_ENTITYTYPE __pyx_v_entitytype;
  char *__pyx_v_name_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_parameter", 0);

  /* "amplpy/ampl.pyx":341
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L1_error)
  __pyx_v_name_c = strdup(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":342
 *         cdef campl.AMPL_ENTITYTYPE entitytype
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             free(name_c)
*/
  __pyx_v_errorinfo = AMPL_EntityGetType(__pyx_v_self->_c_ampl, __pyx_v_name_c, (&__pyx_v_entitytype));

  /* "amplpy/ampl.pyx":343
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":344
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_PARAMETER:
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":345
 *         if errorinfo:
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         if entitytype != campl.AMPL_PARAMETER:
 *             free(name_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 345, __pyx_L1_error)

    /* "amplpy/ampl.pyx":343
 *         cdef char* name_c = strdup(name.encode('utf-8'))
 *         errorinfo = campl.AMPL_EntityGetType(self._c_ampl, name_c, &entitytype)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
*/
  }

  /* "amplpy/ampl.pyx":346
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_PARAMETER:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_PARAMETER, name)
*/
  __pyx_t_5 = (__pyx_v_entitytype != AMPL_PARAMETER);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":347
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_PARAMETER:
 *             free(name_c)             # <<<<<<<<<<<<<<
 *             raiseKeyError(campl.AMPL_PARAMETER, name)
 *         return Parameter.create(self, name_c, NULL, None)
*/
    free(__pyx_v_name_c);

    /* "amplpy/ampl.pyx":348
 *         if entitytype != campl.AMPL_PARAMETER:
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_PARAMETER, name)             # <<<<<<<<<<<<<<
 *         return Parameter.create(self, name_c, NULL, None)
 * 
*/
    if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_name))) __PYX_ERR(0, 348, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_raiseKeyError(AMPL_PARAMETER, ((PyObject*)__pyx_v_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L1_error)

    /* "amplpy/ampl.pyx":346
 *             free(name_c)
 *             PY_AMPL_CALL(errorinfo)
 *         if entitytype != campl.AMPL_PARAMETER:             # <<<<<<<<<<<<<<
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_PARAMETER, name)
*/
  }

  /* "amplpy/ampl.pyx":349
 *             free(name_c)
 *             raiseKeyError(campl.AMPL_PARAMETER, name)
 *         return Parameter.create(self, name_c, NULL, None)             # <<<<<<<<<<<<<<
 * 
 *     def eval(self, statements):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9Parameter_create(__pyx_v_self, __pyx_v_name_c, NULL, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":329
 *         return Set.create(self, name_c, NULL, None)
 * 
 *     def get_parameter(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the parameter with the corresponding name.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_parameter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":351
 *         return Parameter.create(self, name_c, NULL, None)
 * 
 *     def eval(self, statements):             # <<<<<<<<<<<<<<
 *         """
 *         Parses AMPL code and evaluates it as a possibly empty sequence of AMPL
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_19eval(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_18eval, "AMPL.eval(self, statements)\nParses AMPL code and evaluates it as a possibly empty sequence of AMPL\ndeclarations and statements.\n\nAs a side effect, it invalidates all entities (as the passed statements\ncan contain any arbitrary command); the lists of entities will be\nre-populated lazily (at first access)\n\nThe output of interpreting the statements is passed to the current\nOutputHandler (see getOutputHandler and\nsetOutputHandler).\n\nBy default, errors and warnings are printed on stdout.\nThis behavior can be changed reassigning an ErrorHandler\nusing setErrorHandler.\n\nArgs:\n  statements: A collection of AMPL statements and declarations to\n  be passed to the interpreter.\n\nRaises:\n  RuntimeError: if the input is not a complete AMPL statement (e.g.\n  if it does not end with semicolon) or if the underlying\n  interpreter is not running.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_19eval = {"eval", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_19eval, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_18eval};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_19eval(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_statements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eval (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_statements,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 351, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 351, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "eval", 0) < 0) __PYX_ERR(0, 351, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("eval", 1, 1, 1, i); __PYX_ERR(0, 351, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 351, __pyx_L3_error)
    }
    __pyx_v_statements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("eval", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 351, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_18eval(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_statements);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_18eval(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_statements) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  AMPL_ERRORINFO *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("eval", 0);
  __Pyx_INCREF(__pyx_v_statements);

  /* "amplpy/ampl.pyx":378
 *         """
 *         # Workaround for #56
 *         if not statements.endswith((" ", ";", "\n")):             # <<<<<<<<<<<<<<
 *             statements += "\n"
 *         PY_AMPL_CALL(campl.AMPL_Eval(self._c_ampl, statements.encode('utf-8')))
*/
  __pyx_t_2 = __pyx_v_statements;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2]};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (!__pyx_t_4);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":379
 *         # Workaround for #56
 *         if not statements.endswith((" ", ";", "\n")):
 *             statements += "\n"             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_Eval(self._c_ampl, statements.encode('utf-8')))
 *         self._error_handler_wrapper.check()
*/
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_statements, __pyx_mstate_global->__pyx_kp_u__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_statements, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":378
 *         """
 *         # Workaround for #56
 *         if not statements.endswith((" ", ";", "\n")):             # <<<<<<<<<<<<<<
 *             statements += "\n"
 *         PY_AMPL_CALL(campl.AMPL_Eval(self._c_ampl, statements.encode('utf-8')))
*/
  }

  /* "amplpy/ampl.pyx":380
 *         if not statements.endswith((" ", ";", "\n")):
 *             statements += "\n"
 *         PY_AMPL_CALL(campl.AMPL_Eval(self._c_ampl, statements.encode('utf-8')))             # <<<<<<<<<<<<<<
 *         self._error_handler_wrapper.check()
 * 
*/
  __pyx_t_2 = __pyx_v_statements;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 380, __pyx_L1_error)
  __pyx_t_7 = AMPL_Eval(__pyx_v_self->_c_ampl, __pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 380, __pyx_L1_error)

  /* "amplpy/ampl.pyx":381
 *             statements += "\n"
 *         PY_AMPL_CALL(campl.AMPL_Eval(self._c_ampl, statements.encode('utf-8')))
 *         self._error_handler_wrapper.check()             # <<<<<<<<<<<<<<
 * 
 *     def get_output(self, statements):
*/
  __pyx_t_2 = __pyx_v_self->_error_handler_wrapper;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_check, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":351
 *         return Parameter.create(self, name_c, NULL, None)
 * 
 *     def eval(self, statements):             # <<<<<<<<<<<<<<
 *         """
 *         Parses AMPL code and evaluates it as a possibly empty sequence of AMPL
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_statements);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":383
 *         self._error_handler_wrapper.check()
 * 
 *     def get_output(self, statements):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to :func:`~amplpy.AMPL.eval` but returns the output as a
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_21get_output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_20get_output, "AMPL.get_output(self, statements)\nEquivalent to :func:`~amplpy.AMPL.eval` but returns the output as a\nstring.\n\nArgs:\n  statements: A collection of AMPL statements and declarations to\n  be passed to the interpreter.\n\nReturns:\n  A string with the output.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_21get_output = {"get_output", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_21get_output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_20get_output};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_21get_output(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_statements = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_output (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_statements,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 383, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 383, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_output", 0) < 0) __PYX_ERR(0, 383, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_output", 1, 1, 1, i); __PYX_ERR(0, 383, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 383, __pyx_L3_error)
    }
    __pyx_v_statements = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_output", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 383, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_20get_output(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_statements);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_20get_output(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_statements) {
  char *__pyx_v_output_c;
  PyObject *__pyx_v_output = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_output", 0);
  __Pyx_INCREF(__pyx_v_statements);

  /* "amplpy/ampl.pyx":396
 *         """
 *         # Workaround for #56
 *         if not statements.endswith((" ", ";", "\n")):             # <<<<<<<<<<<<<<
 *             statements += "\n"
 *         cdef char* output_c
*/
  __pyx_t_2 = __pyx_v_statements;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2]};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 396, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (!__pyx_t_4);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":397
 *         # Workaround for #56
 *         if not statements.endswith((" ", ";", "\n")):
 *             statements += "\n"             # <<<<<<<<<<<<<<
 *         cdef char* output_c
 *         PY_AMPL_CALL(campl.AMPL_GetOutput(self._c_ampl, statements.encode('utf-8'), &output_c))
*/
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_statements, __pyx_mstate_global->__pyx_kp_u__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_statements, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":396
 *         """
 *         # Workaround for #56
 *         if not statements.endswith((" ", ";", "\n")):             # <<<<<<<<<<<<<<
 *             statements += "\n"
 *         cdef char* output_c
*/
  }

  /* "amplpy/ampl.pyx":399
 *             statements += "\n"
 *         cdef char* output_c
 *         PY_AMPL_CALL(campl.AMPL_GetOutput(self._c_ampl, statements.encode('utf-8'), &output_c))             # <<<<<<<<<<<<<<
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)
*/
  __pyx_t_2 = __pyx_v_statements;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_GetOutput(__pyx_v_self->_c_ampl, __pyx_t_6, (&__pyx_v_output_c))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":400
 *         cdef char* output_c
 *         PY_AMPL_CALL(campl.AMPL_GetOutput(self._c_ampl, statements.encode('utf-8'), &output_c))
 *         output = str(output_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&output_c)
 *         return output
*/
  __pyx_t_7 = __Pyx_ssize_strlen(__pyx_v_output_c); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 400, __pyx_L1_error)
  __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_output_c, 0, __pyx_t_7, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_output = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":401
 *         PY_AMPL_CALL(campl.AMPL_GetOutput(self._c_ampl, statements.encode('utf-8'), &output_c))
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)             # <<<<<<<<<<<<<<
 *         return output
 * 
*/
  (void)(AMPL_StringFree((&__pyx_v_output_c)));

  /* "amplpy/ampl.pyx":402
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":383
 *         self._error_handler_wrapper.check()
 * 
 *     def get_output(self, statements):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to :func:`~amplpy.AMPL.eval` but returns the output as a
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XDECREF(__pyx_v_statements);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":404
 *         return output
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Clears all entities in the underlying AMPL interpreter, clears all maps
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_23reset(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_22reset, "AMPL.reset(self)\nClears all entities in the underlying AMPL interpreter, clears all maps\nand invalidates all entities.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_23reset = {"reset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_23reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_22reset};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_23reset(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("reset", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_22reset(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_22reset(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);

  /* "amplpy/ampl.pyx":409
 *         and invalidates all entities.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_Reset(self._c_ampl))             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_Reset(__pyx_v_self->_c_ampl)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 409, __pyx_L1_error)

  /* "amplpy/ampl.pyx":404
 *         return output
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Clears all entities in the underlying AMPL interpreter, clears all maps
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":411
 *         PY_AMPL_CALL(campl.AMPL_Reset(self._c_ampl))
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stops the underlying engine, and release all any further attempt to
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_25close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_24close, "AMPL.close(self)\nStops the underlying engine, and release all any further attempt to\nexecute optimization commands without restarting it will throw an\nexception.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_25close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_25close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_24close};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_25close(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("close", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_24close(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_24close(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "amplpy/ampl.pyx":417
 *         exception.
 *         """
 *         if self._c_ampl is not NULL:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_Close(self._c_ampl))
 *             campl.AMPL_Free(&self._c_ampl);
*/
  __pyx_t_1 = (__pyx_v_self->_c_ampl != NULL);
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":418
 *         """
 *         if self._c_ampl is not NULL:
 *             PY_AMPL_CALL(campl.AMPL_Close(self._c_ampl))             # <<<<<<<<<<<<<<
 *             campl.AMPL_Free(&self._c_ampl);
 *             self._c_ampl = NULL
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_Close(__pyx_v_self->_c_ampl)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 418, __pyx_L1_error)

    /* "amplpy/ampl.pyx":419
 *         if self._c_ampl is not NULL:
 *             PY_AMPL_CALL(campl.AMPL_Close(self._c_ampl))
 *             campl.AMPL_Free(&self._c_ampl);             # <<<<<<<<<<<<<<
 *             self._c_ampl = NULL
 * 
*/
    AMPL_Free((&__pyx_v_self->_c_ampl));

    /* "amplpy/ampl.pyx":420
 *             PY_AMPL_CALL(campl.AMPL_Close(self._c_ampl))
 *             campl.AMPL_Free(&self._c_ampl);
 *             self._c_ampl = NULL             # <<<<<<<<<<<<<<
 * 
 *     def is_running(self):
*/
    __pyx_v_self->_c_ampl = NULL;

    /* "amplpy/ampl.pyx":417
 *         exception.
 *         """
 *         if self._c_ampl is not NULL:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_Close(self._c_ampl))
 *             campl.AMPL_Free(&self._c_ampl);
*/
  }

  /* "amplpy/ampl.pyx":411
 *         PY_AMPL_CALL(campl.AMPL_Reset(self._c_ampl))
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stops the underlying engine, and release all any further attempt to
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":422
 *             self._c_ampl = NULL
 * 
 *     def is_running(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the underlying engine is running.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_27is_running(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_26is_running, "AMPL.is_running(self)\nReturns true if the underlying engine is running.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_27is_running = {"is_running", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_27is_running, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_26is_running};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_27is_running(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_running (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_running", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_running", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_26is_running(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_26is_running(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  bool __pyx_v_isrunning;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_running", 0);

  /* "amplpy/ampl.pyx":427
 *         """
 *         cdef bool_c isrunning
 *         PY_AMPL_CALL(campl.AMPL_IsRunning(self._c_ampl, &isrunning))             # <<<<<<<<<<<<<<
 *         return isrunning
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_IsRunning(__pyx_v_self->_c_ampl, (&__pyx_v_isrunning))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error)

  /* "amplpy/ampl.pyx":428
 *         cdef bool_c isrunning
 *         PY_AMPL_CALL(campl.AMPL_IsRunning(self._c_ampl, &isrunning))
 *         return isrunning             # <<<<<<<<<<<<<<
 * 
 *     def solve(self, problem="", solver="", verbose=True, return_output=False, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_isrunning); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":422
 *             self._c_ampl = NULL
 * 
 *     def is_running(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the underlying engine is running.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.is_running", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":430
 *         return isrunning
 * 
 *     def solve(self, problem="", solver="", verbose=True, return_output=False, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Solve the current model or the problem specified by ``problem``.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_29solve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_28solve, "AMPL.solve(self, problem='', solver='', verbose=True, return_output=False, **kwargs)\nSolve the current model or the problem specified by ``problem``.\n\nArgs:\n    problem: Name of the problem to solve.\n\n    solver: Name of the solver to use.\n\n    verbose: Display verbose output if set to ``True``.\n\n    return_output: Return output as a string if set to ``True``.\n\n    kwargs: Pass ``solvername_options`` as additional arguments.\n\nRaises:\n    RuntimeError: if the underlying interpreter is not running.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_29solve = {"solve", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_29solve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_28solve};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_29solve(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_problem = 0;
  PyObject *__pyx_v_solver = 0;
  PyObject *__pyx_v_verbose = 0;
  PyObject *__pyx_v_return_output = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solve (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_problem,&__pyx_mstate_global->__pyx_n_u_solver,&__pyx_mstate_global->__pyx_n_u_verbose,&__pyx_mstate_global->__pyx_n_u_return_output,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 430, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "solve", 1) < 0) __PYX_ERR(0, 430, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 430, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_problem = values[0];
    __pyx_v_solver = values[1];
    __pyx_v_verbose = values[2];
    __pyx_v_return_output = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solve", 0, 0, 4, __pyx_nargs); __PYX_ERR(0, 430, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_28solve(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_problem, __pyx_v_solver, __pyx_v_verbose, __pyx_v_return_output, __pyx_v_kwargs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_28solve(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_problem, PyObject *__pyx_v_solver, PyObject *__pyx_v_verbose, PyObject *__pyx_v_return_output, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_option = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_output = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12[3];
  PyObject *__pyx_t_13 = NULL;
  char const *__pyx_t_14;
  char const *__pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("solve", 0);

  /* "amplpy/ampl.pyx":448
 *             RuntimeError: if the underlying interpreter is not running.
 *         """
 *         for option, value in kwargs.items():             # <<<<<<<<<<<<<<
 *             if option.endswith("_options"):
 *                 self.set_option(option, value)
*/
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_option, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "amplpy/ampl.pyx":449
 *         """
 *         for option, value in kwargs.items():
 *             if option.endswith("_options"):             # <<<<<<<<<<<<<<
 *                 self.set_option(option, value)
 *         if not verbose or return_output:
*/
    __pyx_t_5 = __pyx_v_option;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_options};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_9) {

      /* "amplpy/ampl.pyx":450
 *         for option, value in kwargs.items():
 *             if option.endswith("_options"):
 *                 self.set_option(option, value)             # <<<<<<<<<<<<<<
 *         if not verbose or return_output:
 *             if solver != "":
*/
      __pyx_t_5 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_option, __pyx_v_value};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_option, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 450, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "amplpy/ampl.pyx":449
 *         """
 *         for option, value in kwargs.items():
 *             if option.endswith("_options"):             # <<<<<<<<<<<<<<
 *                 self.set_option(option, value)
 *         if not verbose or return_output:
*/
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":451
 *             if option.endswith("_options"):
 *                 self.set_option(option, value)
 *         if not verbose or return_output:             # <<<<<<<<<<<<<<
 *             if solver != "":
 *                 self.set_option("solver", solver)
*/
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_verbose); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 451, __pyx_L1_error)
  __pyx_t_11 = (!__pyx_t_10);
  if (!__pyx_t_11) {
  } else {
    __pyx_t_9 = __pyx_t_11;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_return_output); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 451, __pyx_L1_error)
  __pyx_t_9 = __pyx_t_11;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_9) {

    /* "amplpy/ampl.pyx":452
 *                 self.set_option(option, value)
 *         if not verbose or return_output:
 *             if solver != "":             # <<<<<<<<<<<<<<
 *                 self.set_option("solver", solver)
 *             output = self.get_output(f"solve {problem};")
*/
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_solver, __pyx_mstate_global->__pyx_kp_u__3, Py_NE)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 452, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "amplpy/ampl.pyx":453
 *         if not verbose or return_output:
 *             if solver != "":
 *                 self.set_option("solver", solver)             # <<<<<<<<<<<<<<
 *             output = self.get_output(f"solve {problem};")
 *             if return_output:
*/
      __pyx_t_6 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_solver, __pyx_v_solver};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_option, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "amplpy/ampl.pyx":452
 *                 self.set_option(option, value)
 *         if not verbose or return_output:
 *             if solver != "":             # <<<<<<<<<<<<<<
 *                 self.set_option("solver", solver)
 *             output = self.get_output(f"solve {problem};")
*/
    }

    /* "amplpy/ampl.pyx":454
 *             if solver != "":
 *                 self.set_option("solver", solver)
 *             output = self.get_output(f"solve {problem};")             # <<<<<<<<<<<<<<
 *             if return_output:
 *                 return output
*/
    __pyx_t_6 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_problem, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u_solve;
    __pyx_t_12[1] = __pyx_t_5;
    __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u__15;
    __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_13};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_output, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_v_output = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":455
 *                 self.set_option("solver", solver)
 *             output = self.get_output(f"solve {problem};")
 *             if return_output:             # <<<<<<<<<<<<<<
 *                 return output
 *         else:
*/
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_return_output); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 455, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "amplpy/ampl.pyx":456
 *             output = self.get_output(f"solve {problem};")
 *             if return_output:
 *                 return output             # <<<<<<<<<<<<<<
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_Solve(self._c_ampl, problem.encode('utf-8'), solver.encode('utf-8')))
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_output);
      __pyx_r = __pyx_v_output;
      goto __pyx_L0;

      /* "amplpy/ampl.pyx":455
 *                 self.set_option("solver", solver)
 *             output = self.get_output(f"solve {problem};")
 *             if return_output:             # <<<<<<<<<<<<<<
 *                 return output
 *         else:
*/
    }

    /* "amplpy/ampl.pyx":451
 *             if option.endswith("_options"):
 *                 self.set_option(option, value)
 *         if not verbose or return_output:             # <<<<<<<<<<<<<<
 *             if solver != "":
 *                 self.set_option("solver", solver)
*/
    goto __pyx_L6;
  }

  /* "amplpy/ampl.pyx":458
 *                 return output
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_Solve(self._c_ampl, problem.encode('utf-8'), solver.encode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 *     def cd(self, path=None):
*/
  /*else*/ {
    __pyx_t_13 = __pyx_v_problem;
    __Pyx_INCREF(__pyx_t_13);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 458, __pyx_L1_error)
    __pyx_t_6 = __pyx_v_solver;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_13 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
    }
    __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_t_13); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 458, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_Solve(__pyx_v_self->_c_ampl, __pyx_t_14, __pyx_t_15)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __pyx_L6:;

  /* "amplpy/ampl.pyx":430
 *         return isrunning
 * 
 *     def solve(self, problem="", solver="", verbose=True, return_output=False, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Solve the current model or the problem specified by ``problem``.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_option);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":460
 *             PY_AMPL_CALL(campl.AMPL_Solve(self._c_ampl, problem.encode('utf-8'), solver.encode('utf-8')))
 * 
 *     def cd(self, path=None):             # <<<<<<<<<<<<<<
 *         """
 *         Get or set the current working directory from the underlying
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_31cd(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_30cd, "AMPL.cd(self, path=None)\nGet or set the current working directory from the underlying\ninterpreter (see https://en.wikipedia.org/wiki/Working_directory).\n\nArgs:\n    path: New working directory or None (to display the working\n    directory).\n\nReturns:\n    Current working directory.\n\nRaises:\n    RuntimeError: change directory cannot be executed.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_31cd = {"cd", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_31cd, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_30cd};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_31cd(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_path = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cd (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 460, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 460, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cd", 0) < 0) __PYX_ERR(0, 460, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 460, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_path = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cd", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 460, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.cd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_30cd(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_path);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_30cd(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_path) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_workdir_c;
  PyObject *__pyx_v_workdir = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  char const *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cd", 0);

  /* "amplpy/ampl.pyx":477
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* workdir_c
 *         if path is None:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_Cd(self._c_ampl, &workdir_c)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_path == Py_None);
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":478
 *         cdef char* workdir_c
 *         if path is None:
 *             errorinfo = campl.AMPL_Cd(self._c_ampl, &workdir_c)             # <<<<<<<<<<<<<<
 *         else:
 *             errorinfo = campl.AMPL_Cd2(self._c_ampl, path.encode('utf-8'), &workdir_c)
*/
    __pyx_v_errorinfo = AMPL_Cd(__pyx_v_self->_c_ampl, (&__pyx_v_workdir_c));

    /* "amplpy/ampl.pyx":477
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* workdir_c
 *         if path is None:             # <<<<<<<<<<<<<<
 *             errorinfo = campl.AMPL_Cd(self._c_ampl, &workdir_c)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":480
 *             errorinfo = campl.AMPL_Cd(self._c_ampl, &workdir_c)
 *         else:
 *             errorinfo = campl.AMPL_Cd2(self._c_ampl, path.encode('utf-8'), &workdir_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  /*else*/ {
    __pyx_t_3 = __pyx_v_path;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L1_error)
    __pyx_v_errorinfo = AMPL_Cd2(__pyx_v_self->_c_ampl, __pyx_t_5, (&__pyx_v_workdir_c));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":481
 *         else:
 *             errorinfo = campl.AMPL_Cd2(self._c_ampl, path.encode('utf-8'), &workdir_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         workdir = str(workdir_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":482
 *             errorinfo = campl.AMPL_Cd2(self._c_ampl, path.encode('utf-8'), &workdir_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         workdir = str(workdir_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&workdir_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L1_error)

    /* "amplpy/ampl.pyx":481
 *         else:
 *             errorinfo = campl.AMPL_Cd2(self._c_ampl, path.encode('utf-8'), &workdir_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         workdir = str(workdir_c.decode('utf-8'))
*/
  }

  /* "amplpy/ampl.pyx":483
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         workdir = str(workdir_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&workdir_c)
 * 
*/
  __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_workdir_c); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 483, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_workdir_c, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_workdir = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":484
 *             PY_AMPL_CALL(errorinfo)
 *         workdir = str(workdir_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&workdir_c)             # <<<<<<<<<<<<<<
 * 
 *         return workdir
*/
  (void)(AMPL_StringFree((&__pyx_v_workdir_c)));

  /* "amplpy/ampl.pyx":486
 *         campl.AMPL_StringFree(&workdir_c)
 * 
 *         return workdir             # <<<<<<<<<<<<<<
 * 
 *     def set_option(self, name, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_workdir);
  __pyx_r = __pyx_v_workdir;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":460
 *             PY_AMPL_CALL(campl.AMPL_Solve(self._c_ampl, problem.encode('utf-8'), solver.encode('utf-8')))
 * 
 *     def cd(self, path=None):             # <<<<<<<<<<<<<<
 *         """
 *         Get or set the current working directory from the underlying
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.cd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_workdir);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":488
 *         return workdir
 * 
 *     def set_option(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Set an AMPL option to a specified value.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_33set_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_32set_option, "AMPL.set_option(self, name, value)\nSet an AMPL option to a specified value.\n\nArgs:\n    name: Name of the option to be set (alphanumeric without spaces).\n\n    value: The value the option must be set to.\n\nRaises:\n    InvalidArgumet: if the option name is not valid.\n\n    TypeError: if the value has an invalid type.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_33set_option = {"set_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_33set_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_32set_option};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_33set_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_option (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 488, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 488, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 488, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_option", 0) < 0) __PYX_ERR(0, 488, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_option", 1, 2, 2, i); __PYX_ERR(0, 488, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 488, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 488, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_option", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 488, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_32set_option(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_32set_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  char const *__pyx_t_5;
  bool __pyx_t_6;
  char const *__pyx_t_7;
  double __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char const *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_option", 0);

  /* "amplpy/ampl.pyx":502
 *             TypeError: if the value has an invalid type.
 *         """
 *         if PyBool_Check(value):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetBoolOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, int):
*/
  __pyx_t_1 = PyBool_Check(__pyx_v_value);
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":503
 *         """
 *         if PyBool_Check(value):
 *             PY_AMPL_CALL(campl.AMPL_SetBoolOption(self._c_ampl, name.encode('utf-8'), value))             # <<<<<<<<<<<<<<
 *         elif isinstance(value, int):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
*/
    __pyx_t_3 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_6 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetBoolOption(__pyx_v_self->_c_ampl, __pyx_t_5, __pyx_t_6)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/ampl.pyx":502
 *             TypeError: if the value has an invalid type.
 *         """
 *         if PyBool_Check(value):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetBoolOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, int):
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":504
 *         if PyBool_Check(value):
 *             PY_AMPL_CALL(campl.AMPL_SetBoolOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, int):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, float):
*/
  __pyx_t_1 = PyLong_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":505
 *             PY_AMPL_CALL(campl.AMPL_SetBoolOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, int):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))             # <<<<<<<<<<<<<<
 *         elif isinstance(value, float):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
*/
    __pyx_t_3 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetDblOption(__pyx_v_self->_c_ampl, __pyx_t_7, __pyx_t_8)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/ampl.pyx":504
 *         if PyBool_Check(value):
 *             PY_AMPL_CALL(campl.AMPL_SetBoolOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, int):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, float):
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":506
 *         elif isinstance(value, int):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, float):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, str):
*/
  __pyx_t_1 = PyFloat_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":507
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, float):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))             # <<<<<<<<<<<<<<
 *         elif isinstance(value, str):
 *             PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, name.encode('utf-8'), value.encode('utf-8')))
*/
    __pyx_t_3 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetDblOption(__pyx_v_self->_c_ampl, __pyx_t_7, __pyx_t_8)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/ampl.pyx":506
 *         elif isinstance(value, int):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, float):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, str):
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":508
 *         elif isinstance(value, float):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, str):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, name.encode('utf-8'), value.encode('utf-8')))
 *         else:
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_value); 
  if (likely(__pyx_t_1)) {

    /* "amplpy/ampl.pyx":509
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, str):
 *             PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, name.encode('utf-8'), value.encode('utf-8')))             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError
*/
    __pyx_t_3 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error)
    __pyx_t_10 = __pyx_v_value;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetOption(__pyx_v_self->_c_ampl, __pyx_t_9, __pyx_t_11)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "amplpy/ampl.pyx":508
 *         elif isinstance(value, float):
 *             PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, name.encode('utf-8'), value))
 *         elif isinstance(value, str):             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, name.encode('utf-8'), value.encode('utf-8')))
 *         else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":511
 *             PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, name.encode('utf-8'), value.encode('utf-8')))
 *         else:
 *             raise TypeError             # <<<<<<<<<<<<<<
 * 
 *     def get_option(self, name):
*/
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    __PYX_ERR(0, 511, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":488
 *         return workdir
 * 
 *     def set_option(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Set an AMPL option to a specified value.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":513
 *             raise TypeError
 * 
 *     def get_option(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the specified option. If the option does not
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_35get_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_34get_option, "AMPL.get_option(self, name)\nGet the current value of the specified option. If the option does not\nexist, returns None.\n\nArgs:\n    name: Option name.\n\nReturns:\n    Value of the option.\n\nRaises:\n    InvalidArgumet: if the option name is not valid.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_35get_option = {"get_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_35get_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_34get_option};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_35get_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_option (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 513, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 513, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_option", 0) < 0) __PYX_ERR(0, 513, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_option", 1, 1, 1, i); __PYX_ERR(0, 513, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 513, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_option", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 513, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_34get_option(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_34get_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_name) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  bool __pyx_v_exists;
  char *__pyx_v_value_c;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_option", 0);

  /* "amplpy/ampl.pyx":531
 *         cdef char* value_c
 * 
 *         errorinfo = campl.AMPL_GetOption(self._c_ampl, name.encode('utf-8'), &exists, &value_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_2 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 531, __pyx_L1_error)
  __pyx_v_errorinfo = AMPL_GetOption(__pyx_v_self->_c_ampl, __pyx_t_4, (&__pyx_v_exists), (&__pyx_v_value_c));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":532
 * 
 *         errorinfo = campl.AMPL_GetOption(self._c_ampl, name.encode('utf-8'), &exists, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":533
 *         errorinfo = campl.AMPL_GetOption(self._c_ampl, name.encode('utf-8'), &exists, &value_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *         value = value_c.decode('utf-8')
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error)

    /* "amplpy/ampl.pyx":532
 * 
 *         errorinfo = campl.AMPL_GetOption(self._c_ampl, name.encode('utf-8'), &exists, &value_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  }

  /* "amplpy/ampl.pyx":535
 *             PY_AMPL_CALL(errorinfo)
 * 
 *         value = value_c.decode('utf-8')             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&value_c)
 *         if exists:
*/
  __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_value_c); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 535, __pyx_L1_error)
  __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_value_c, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":536
 * 
 *         value = value_c.decode('utf-8')
 *         campl.AMPL_StringFree(&value_c)             # <<<<<<<<<<<<<<
 *         if exists:
 *             try:
*/
  (void)(AMPL_StringFree((&__pyx_v_value_c)));

  /* "amplpy/ampl.pyx":537
 *         value = value_c.decode('utf-8')
 *         campl.AMPL_StringFree(&value_c)
 *         if exists:             # <<<<<<<<<<<<<<
 *             try:
 *                 return int(value)
*/
  __pyx_t_5 = (__pyx_v_exists != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":538
 *         campl.AMPL_StringFree(&value_c)
 *         if exists:
 *             try:             # <<<<<<<<<<<<<<
 *                 return int(value)
 *             except ValueError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "amplpy/ampl.pyx":539
 *         if exists:
 *             try:
 *                 return int(value)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 try:
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L9_try_return;

        /* "amplpy/ampl.pyx":538
 *         campl.AMPL_StringFree(&value_c)
 *         if exists:
 *             try:             # <<<<<<<<<<<<<<
 *                 return int(value)
 *             except ValueError:
*/
      }
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/ampl.pyx":540
 *             try:
 *                 return int(value)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 try:
 *                     return float(value)
*/
      __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_10) {
        __Pyx_AddTraceback("amplpy.ampl.AMPL.get_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 540, __pyx_L7_except_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_11);

        /* "amplpy/ampl.pyx":541
 *                 return int(value)
 *             except ValueError:
 *                 try:             # <<<<<<<<<<<<<<
 *                     return float(value)
 *                 except ValueError:
*/
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          /*try:*/ {

            /* "amplpy/ampl.pyx":542
 *             except ValueError:
 *                 try:
 *                     return float(value)             # <<<<<<<<<<<<<<
 *                 except ValueError:
 *                     return value
*/
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_15 = __Pyx_PyNumber_Float(__pyx_v_value); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 542, __pyx_L13_error)
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_r = __pyx_t_15;
            __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L17_try_return;

            /* "amplpy/ampl.pyx":541
 *                 return int(value)
 *             except ValueError:
 *                 try:             # <<<<<<<<<<<<<<
 *                     return float(value)
 *                 except ValueError:
*/
          }
          __pyx_L13_error:;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "amplpy/ampl.pyx":543
 *                 try:
 *                     return float(value)
 *                 except ValueError:             # <<<<<<<<<<<<<<
 *                     return value
 * 
*/
          __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
          if (__pyx_t_10) {
            __Pyx_AddTraceback("amplpy.ampl.AMPL.get_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0) __PYX_ERR(0, 543, __pyx_L15_except_error)
            __Pyx_XGOTREF(__pyx_t_15);
            __Pyx_XGOTREF(__pyx_t_16);
            __Pyx_XGOTREF(__pyx_t_17);

            /* "amplpy/ampl.pyx":544
 *                     return float(value)
 *                 except ValueError:
 *                     return value             # <<<<<<<<<<<<<<
 * 
 *     def read(self, filename):
*/
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_v_value);
            __pyx_r = __pyx_v_value;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            goto __pyx_L16_except_return;
          }
          goto __pyx_L15_except_error;

          /* "amplpy/ampl.pyx":541
 *                 return int(value)
 *             except ValueError:
 *                 try:             # <<<<<<<<<<<<<<
 *                     return float(value)
 *                 except ValueError:
*/
          __pyx_L15_except_error:;
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          goto __pyx_L7_except_error;
          __pyx_L17_try_return:;
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          goto __pyx_L8_except_return;
          __pyx_L16_except_return:;
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          goto __pyx_L8_except_return;
        }
      }
      goto __pyx_L7_except_error;

      /* "amplpy/ampl.pyx":538
 *         campl.AMPL_StringFree(&value_c)
 *         if exists:
 *             try:             # <<<<<<<<<<<<<<
 *                 return int(value)
 *             except ValueError:
*/
      __pyx_L7_except_error:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L9_try_return:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L0;
      __pyx_L8_except_return:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L0;
    }

    /* "amplpy/ampl.pyx":537
 *         value = value_c.decode('utf-8')
 *         campl.AMPL_StringFree(&value_c)
 *         if exists:             # <<<<<<<<<<<<<<
 *             try:
 *                 return int(value)
*/
  }

  /* "amplpy/ampl.pyx":513
 *             raise TypeError
 * 
 *     def get_option(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the specified option. If the option does not
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":546
 *                     return value
 * 
 *     def read(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Interprets the specified file (script or model or mixed) As a side
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_37read(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_36read, "AMPL.read(self, filename)\nInterprets the specified file (script or model or mixed) As a side\neffect, it invalidates all entities (as the passed file can contain any\narbitrary command); the lists of entities will be re-populated lazily\n(at first access).\n\nArgs:\n    filename: Full path to the file.\n\nRaises:\n    RuntimeError: in case the file does not exist.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_37read = {"read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_37read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_36read};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_37read(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 546, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 546, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "read", 0) < 0) __PYX_ERR(0, 546, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("read", 1, 1, 1, i); __PYX_ERR(0, 546, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 546, __pyx_L3_error)
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 546, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_36read(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_36read(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  char const *__pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "amplpy/ampl.pyx":559
 *             RuntimeError: in case the file does not exist.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_Read(self._c_ampl, str(filename).encode('utf-8')))             # <<<<<<<<<<<<<<
 *         self._error_handler_wrapper.check()
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_t_2); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 559, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_Read(__pyx_v_self->_c_ampl, __pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":560
 *         """
 *         PY_AMPL_CALL(campl.AMPL_Read(self._c_ampl, str(filename).encode('utf-8')))
 *         self._error_handler_wrapper.check()             # <<<<<<<<<<<<<<
 * 
 *     def read_data(self, filename):
*/
  __pyx_t_1 = __pyx_v_self->_error_handler_wrapper;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_check, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":546
 *                     return value
 * 
 *     def read(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Interprets the specified file (script or model or mixed) As a side
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":562
 *         self._error_handler_wrapper.check()
 * 
 *     def read_data(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Interprets the specified file as an AMPL data file. As a side effect,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_39read_data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_38read_data, "AMPL.read_data(self, filename)\nInterprets the specified file as an AMPL data file. As a side effect,\nit invalidates all entities (as the passed file can contain any\narbitrary command); the lists of entities will be re-populated lazily\n(at first access). After reading the file, the interpreter is put back\nto \"model\" mode.\n\nArgs:\n    filename: Full path to the file.\n\nRaises:\n    RuntimeError: in case the file does not exist.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_39read_data = {"read_data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_39read_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_38read_data};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_39read_data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_data (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 562, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 562, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "read_data", 0) < 0) __PYX_ERR(0, 562, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("read_data", 1, 1, 1, i); __PYX_ERR(0, 562, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 562, __pyx_L3_error)
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read_data", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 562, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.read_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_38read_data(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_38read_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  char const *__pyx_t_3;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_data", 0);

  /* "amplpy/ampl.pyx":576
 *             RuntimeError: in case the file does not exist.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_ReadData(self._c_ampl, str(filename).encode('utf-8')))             # <<<<<<<<<<<<<<
 *         self._error_handler_wrapper.check()
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_t_2); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ReadData(__pyx_v_self->_c_ampl, __pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":577
 *         """
 *         PY_AMPL_CALL(campl.AMPL_ReadData(self._c_ampl, str(filename).encode('utf-8')))
 *         self._error_handler_wrapper.check()             # <<<<<<<<<<<<<<
 * 
 *     def get_value(self, scalar_expression):
*/
  __pyx_t_1 = __pyx_v_self->_error_handler_wrapper;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_check, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":562
 *         self._error_handler_wrapper.check()
 * 
 *     def read_data(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Interprets the specified file as an AMPL data file. As a side effect,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.read_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":579
 *         self._error_handler_wrapper.check()
 * 
 *     def get_value(self, scalar_expression):             # <<<<<<<<<<<<<<
 *         """
 *         Get a scalar value from the underlying AMPL interpreter, as a double or
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_41get_value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_40get_value, "AMPL.get_value(self, scalar_expression)\nGet a scalar value from the underlying AMPL interpreter, as a double or\na string.\n\nArgs:\n    scalar_expression: An AMPL expression which evaluates to a scalar\n    value.\n\nReturns:\n    The value of the expression.\n\nRaises:\n    TypeError: in case scalar_expression does not evaluate to a value.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_41get_value = {"get_value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_41get_value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_40get_value};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_41get_value(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_scalar_expression = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_value (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_scalar_expression,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 579, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 579, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_value", 0) < 0) __PYX_ERR(0, 579, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_value", 1, 1, 1, i); __PYX_ERR(0, 579, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 579, __pyx_L3_error)
    }
    __pyx_v_scalar_expression = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_value", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 579, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_40get_value(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_scalar_expression);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_40get_value(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_scalar_expression) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  AMPL_VARIANT *__pyx_v_v;
  PyObject *__pyx_v_py_variant = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value", 0);

  /* "amplpy/ampl.pyx":596
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_GetValue(self._c_ampl, scalar_expression.encode('utf-8'), &v)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_2 = __pyx_v_scalar_expression;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error)
  __pyx_v_errorinfo = AMPL_GetValue(__pyx_v_self->_c_ampl, __pyx_t_4, (&__pyx_v_v));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":597
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_GetValue(self._c_ampl, scalar_expression.encode('utf-8'), &v)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":598
 *         errorinfo = campl.AMPL_GetValue(self._c_ampl, scalar_expression.encode('utf-8'), &v)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *         py_variant = to_py_variant(v)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 598, __pyx_L1_error)

    /* "amplpy/ampl.pyx":597
 *         cdef campl.AMPL_VARIANT* v
 *         errorinfo = campl.AMPL_GetValue(self._c_ampl, scalar_expression.encode('utf-8'), &v)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  }

  /* "amplpy/ampl.pyx":600
 *             PY_AMPL_CALL(errorinfo)
 * 
 *         py_variant = to_py_variant(v)             # <<<<<<<<<<<<<<
 *         campl.AMPL_VariantFree(&v)
 * 
*/
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_to_py_variant(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_variant = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":601
 * 
 *         py_variant = to_py_variant(v)
 *         campl.AMPL_VariantFree(&v)             # <<<<<<<<<<<<<<
 * 
 *         return py_variant
*/
  (void)(AMPL_VariantFree((&__pyx_v_v)));

  /* "amplpy/ampl.pyx":603
 *         campl.AMPL_VariantFree(&v)
 * 
 *         return py_variant             # <<<<<<<<<<<<<<
 * 
 *     def set_data(self, data, set_name=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_py_variant);
  __pyx_r = __pyx_v_py_variant;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":579
 *         self._error_handler_wrapper.check()
 * 
 *     def get_value(self, scalar_expression):             # <<<<<<<<<<<<<<
 *         """
 *         Get a scalar value from the underlying AMPL interpreter, as a double or
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_variant);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":605
 *         return py_variant
 * 
 *     def set_data(self, data, set_name=None):             # <<<<<<<<<<<<<<
 *         """
 *         Assign the data in the dataframe to the AMPL entities with the names
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_43set_data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_42set_data, "AMPL.set_data(self, data, set_name=None)\nAssign the data in the dataframe to the AMPL entities with the names\ncorresponding to the column names.\n\nArgs:\n    data: The dataframe containing the data to be assigned.\n\n    set_name: The name of the set to which the indices values of the\n    DataFrame are to be assigned.\n\nRaises:\n    AMPLException: if the data assignment procedure was not successful.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_43set_data = {"set_data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_43set_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_42set_data};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_43set_data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_set_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_data (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_set_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 605, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 605, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 605, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_data", 0) < 0) __PYX_ERR(0, 605, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_data", 0, 1, 2, i); __PYX_ERR(0, 605, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 605, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 605, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_data = values[0];
    __pyx_v_set_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_data", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 605, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_42set_data(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_data, __pyx_v_set_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_42set_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_set_name) {
  struct __pyx_obj_6amplpy_4ampl_DataFrame *__pyx_v_data_frame = 0;
  AMPL_DATAFRAME *__pyx_v_data_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  size_t __pyx_t_7;
  AMPL_DATAFRAME *__pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_data", 0);
  __Pyx_INCREF(__pyx_v_data);

  /* "amplpy/ampl.pyx":619
 *             AMPLException: if the data assignment procedure was not successful.
 *         """
 *         if not isinstance(data, DataFrame):             # <<<<<<<<<<<<<<
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data = DataFrame.from_pandas(data)
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_data, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "amplpy/ampl.pyx":620
 *         """
 *         if not isinstance(data, DataFrame):
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 data = DataFrame.from_pandas(data)
 *         cdef DataFrame data_frame = data
*/
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = (__pyx_t_3 != Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_4); 
    if (!__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_5); 
    __pyx_t_1 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "amplpy/ampl.pyx":621
 *         if not isinstance(data, DataFrame):
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data = DataFrame.from_pandas(data)             # <<<<<<<<<<<<<<
 *         cdef DataFrame data_frame = data
 *         cdef campl.AMPL_DATAFRAME* data_c = data_frame.get_ptr()
*/
      __pyx_t_5 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_data};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 621, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "amplpy/ampl.pyx":620
 *         """
 *         if not isinstance(data, DataFrame):
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 data = DataFrame.from_pandas(data)
 *         cdef DataFrame data_frame = data
*/
    }

    /* "amplpy/ampl.pyx":619
 *             AMPLException: if the data assignment procedure was not successful.
 *         """
 *         if not isinstance(data, DataFrame):             # <<<<<<<<<<<<<<
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data = DataFrame.from_pandas(data)
*/
  }

  /* "amplpy/ampl.pyx":622
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data = DataFrame.from_pandas(data)
 *         cdef DataFrame data_frame = data             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_DATAFRAME* data_c = data_frame.get_ptr()
 *         if set_name is None:
*/
  __pyx_t_4 = __pyx_v_data;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame))))) __PYX_ERR(0, 622, __pyx_L1_error)
  __pyx_v_data_frame = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":623
 *                 data = DataFrame.from_pandas(data)
 *         cdef DataFrame data_frame = data
 *         cdef campl.AMPL_DATAFRAME* data_c = data_frame.get_ptr()             # <<<<<<<<<<<<<<
 *         if set_name is None:
 *             PY_AMPL_CALL(campl.AMPL_SetData(self._c_ampl, data_c, ""))
*/
  __pyx_t_8 = ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame *)__pyx_v_data_frame->__pyx_vtab)->get_ptr(__pyx_v_data_frame); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L1_error)
  __pyx_v_data_c = __pyx_t_8;

  /* "amplpy/ampl.pyx":624
 *         cdef DataFrame data_frame = data
 *         cdef campl.AMPL_DATAFRAME* data_c = data_frame.get_ptr()
 *         if set_name is None:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetData(self._c_ampl, data_c, ""))
 *         else:
*/
  __pyx_t_2 = (__pyx_v_set_name == Py_None);
  if (__pyx_t_2) {

    /* "amplpy/ampl.pyx":625
 *         cdef campl.AMPL_DATAFRAME* data_c = data_frame.get_ptr()
 *         if set_name is None:
 *             PY_AMPL_CALL(campl.AMPL_SetData(self._c_ampl, data_c, ""))             # <<<<<<<<<<<<<<
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_SetData(self._c_ampl, data_c, set_name.encode('utf-8')))
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetData(__pyx_v_self->_c_ampl, __pyx_v_data_c, ((char const *)""))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 625, __pyx_L1_error)

    /* "amplpy/ampl.pyx":624
 *         cdef DataFrame data_frame = data
 *         cdef campl.AMPL_DATAFRAME* data_c = data_frame.get_ptr()
 *         if set_name is None:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetData(self._c_ampl, data_c, ""))
 *         else:
*/
    goto __pyx_L9;
  }

  /* "amplpy/ampl.pyx":627
 *             PY_AMPL_CALL(campl.AMPL_SetData(self._c_ampl, data_c, ""))
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_SetData(self._c_ampl, data_c, set_name.encode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_5 = __pyx_v_set_name;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 627, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetData(__pyx_v_self->_c_ampl, __pyx_v_data_c, __pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 627, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L9:;

  /* "amplpy/ampl.pyx":605
 *         return py_variant
 * 
 *     def set_data(self, data, set_name=None):             # <<<<<<<<<<<<<<
 *         """
 *         Assign the data in the dataframe to the AMPL entities with the names
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data_frame);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":630
 * 
 * 
 *     def set_data_arrow(self, data, set_name=None):             # <<<<<<<<<<<<<<
 *         cdef DataFrameArrow data_frame
 *         if not isinstance(data, DataFrameArrow):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_45set_data_arrow(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_44set_data_arrow, "AMPL.set_data_arrow(self, data, set_name=None)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_45set_data_arrow = {"set_data_arrow", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_45set_data_arrow, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_44set_data_arrow};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_45set_data_arrow(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_set_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_data_arrow (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_set_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 630, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 630, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 630, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_data_arrow", 0) < 0) __PYX_ERR(0, 630, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_data_arrow", 0, 1, 2, i); __PYX_ERR(0, 630, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 630, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 630, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_data = values[0];
    __pyx_v_set_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_data_arrow", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 630, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_data_arrow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_44set_data_arrow(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_data, __pyx_v_set_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_44set_data_arrow(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_set_name) {
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *__pyx_v_data_frame = 0;
  struct AMPL_DATAFRAMEARROW *__pyx_v_data_c;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  size_t __pyx_t_7;
  struct AMPL_DATAFRAMEARROW *__pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_data_arrow", 0);

  /* "amplpy/ampl.pyx":632
 *     def set_data_arrow(self, data, set_name=None):
 *         cdef DataFrameArrow data_frame
 *         if not isinstance(data, DataFrameArrow):             # <<<<<<<<<<<<<<
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data_frame = DataFrameArrow.from_pandas(data)
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_data, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "amplpy/ampl.pyx":633
 *         cdef DataFrameArrow data_frame
 *         if not isinstance(data, DataFrameArrow):
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 data_frame = DataFrameArrow.from_pandas(data)
 *         cdef campl.AMPL_DATAFRAMEARROW* data_c = data_frame.get_ptr()
*/
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = (__pyx_t_3 != Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L5_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_4); 
    if (!__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_data, __pyx_t_5); 
    __pyx_t_1 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "amplpy/ampl.pyx":634
 *         if not isinstance(data, DataFrameArrow):
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data_frame = DataFrameArrow.from_pandas(data)             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_DATAFRAMEARROW* data_c = data_frame.get_ptr()
 *         if set_name is None:
*/
      __pyx_t_5 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_data};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow))))) __PYX_ERR(0, 634, __pyx_L1_error)
      __pyx_v_data_frame = ((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "amplpy/ampl.pyx":633
 *         cdef DataFrameArrow data_frame
 *         if not isinstance(data, DataFrameArrow):
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):             # <<<<<<<<<<<<<<
 *                 data_frame = DataFrameArrow.from_pandas(data)
 *         cdef campl.AMPL_DATAFRAMEARROW* data_c = data_frame.get_ptr()
*/
    }

    /* "amplpy/ampl.pyx":632
 *     def set_data_arrow(self, data, set_name=None):
 *         cdef DataFrameArrow data_frame
 *         if not isinstance(data, DataFrameArrow):             # <<<<<<<<<<<<<<
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data_frame = DataFrameArrow.from_pandas(data)
*/
  }

  /* "amplpy/ampl.pyx":635
 *             if pd is not None and isinstance(data, (pd.DataFrame, pd.Series)):
 *                 data_frame = DataFrameArrow.from_pandas(data)
 *         cdef campl.AMPL_DATAFRAMEARROW* data_c = data_frame.get_ptr()             # <<<<<<<<<<<<<<
 *         if set_name is None:
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, ""))
*/
  if (unlikely(!__pyx_v_data_frame)) { __Pyx_RaiseUnboundLocalError("data_frame"); __PYX_ERR(0, 635, __pyx_L1_error) }
  __pyx_t_8 = ((struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow *)__pyx_v_data_frame->__pyx_vtab)->get_ptr(__pyx_v_data_frame); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 635, __pyx_L1_error)
  __pyx_v_data_c = __pyx_t_8;

  /* "amplpy/ampl.pyx":636
 *                 data_frame = DataFrameArrow.from_pandas(data)
 *         cdef campl.AMPL_DATAFRAMEARROW* data_c = data_frame.get_ptr()
 *         if set_name is None:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, ""))
 *         else:
*/
  __pyx_t_2 = (__pyx_v_set_name == Py_None);
  if (__pyx_t_2) {

    /* "amplpy/ampl.pyx":637
 *         cdef campl.AMPL_DATAFRAMEARROW* data_c = data_frame.get_ptr()
 *         if set_name is None:
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, ""))             # <<<<<<<<<<<<<<
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, set_name.encode('utf-8')))
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetDataArrow(__pyx_v_self->_c_ampl, __pyx_v_data_c, ((char const *)""))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L1_error)

    /* "amplpy/ampl.pyx":636
 *                 data_frame = DataFrameArrow.from_pandas(data)
 *         cdef campl.AMPL_DATAFRAMEARROW* data_c = data_frame.get_ptr()
 *         if set_name is None:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, ""))
 *         else:
*/
    goto __pyx_L9;
  }

  /* "amplpy/ampl.pyx":639
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, ""))
 *         else:
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, set_name.encode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 *     def read_table(self, table_name):
*/
  /*else*/ {
    __pyx_t_5 = __pyx_v_set_name;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 639, __pyx_L1_error)
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetDataArrow(__pyx_v_self->_c_ampl, __pyx_v_data_c, __pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 639, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L9:;

  /* "amplpy/ampl.pyx":630
 * 
 * 
 *     def set_data_arrow(self, data, set_name=None):             # <<<<<<<<<<<<<<
 *         cdef DataFrameArrow data_frame
 *         if not isinstance(data, DataFrameArrow):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_data_arrow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data_frame);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":641
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, set_name.encode('utf-8')))
 * 
 *     def read_table(self, table_name):             # <<<<<<<<<<<<<<
 *         """
 *         Read the table corresponding to the specified name, equivalent to the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_47read_table(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_46read_table, "AMPL.read_table(self, table_name)\nRead the table corresponding to the specified name, equivalent to the\nAMPL statement:\n\n.. code-block:: ampl\n\n    read table table_name;\n\nArgs:\n    table_name: Name of the table to be read.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_47read_table = {"read_table", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_47read_table, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_46read_table};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_47read_table(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_table_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_table (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_table_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 641, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 641, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "read_table", 0) < 0) __PYX_ERR(0, 641, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("read_table", 1, 1, 1, i); __PYX_ERR(0, 641, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 641, __pyx_L3_error)
    }
    __pyx_v_table_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read_table", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 641, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.read_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_46read_table(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_table_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_46read_table(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_table_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_table", 0);

  /* "amplpy/ampl.pyx":653
 *             table_name: Name of the table to be read.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_ReadTable(self._c_ampl, table_name.encode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 *     def write_table(self, table_name):
*/
  __pyx_t_2 = __pyx_v_table_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 653, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_ReadTable(__pyx_v_self->_c_ampl, __pyx_t_4)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":641
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, set_name.encode('utf-8')))
 * 
 *     def read_table(self, table_name):             # <<<<<<<<<<<<<<
 *         """
 *         Read the table corresponding to the specified name, equivalent to the
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.read_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":655
 *         PY_AMPL_CALL(campl.AMPL_ReadTable(self._c_ampl, table_name.encode('utf-8')))
 * 
 *     def write_table(self, table_name):             # <<<<<<<<<<<<<<
 *         """
 *         Write the table corresponding to the specified name, equivalent to the
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_49write_table(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_48write_table, "AMPL.write_table(self, table_name)\nWrite the table corresponding to the specified name, equivalent to the\nAMPL statement\n\n.. code-block:: ampl\n\n    write table table_name;\n\nArgs:\n    table_name: Name of the table to be written.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_49write_table = {"write_table", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_49write_table, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_48write_table};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_49write_table(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_table_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write_table (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_table_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 655, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 655, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write_table", 0) < 0) __PYX_ERR(0, 655, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write_table", 1, 1, 1, i); __PYX_ERR(0, 655, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 655, __pyx_L3_error)
    }
    __pyx_v_table_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_table", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 655, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.write_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_48write_table(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_table_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_48write_table(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_table_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_table", 0);

  /* "amplpy/ampl.pyx":667
 *             table_name: Name of the table to be written.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_WriteTable(self._c_ampl, table_name.encode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 *     def display(self, *ampl_expressions):
*/
  __pyx_t_2 = __pyx_v_table_name;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_WriteTable(__pyx_v_self->_c_ampl, __pyx_t_4)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":655
 *         PY_AMPL_CALL(campl.AMPL_ReadTable(self._c_ampl, table_name.encode('utf-8')))
 * 
 *     def write_table(self, table_name):             # <<<<<<<<<<<<<<
 *         """
 *         Write the table corresponding to the specified name, equivalent to the
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.write_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":669
 *         PY_AMPL_CALL(campl.AMPL_WriteTable(self._c_ampl, table_name.encode('utf-8')))
 * 
 *     def display(self, *ampl_expressions):             # <<<<<<<<<<<<<<
 *         """
 *         Writes on the current OutputHandler the outcome of the AMPL statement.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_51display(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_50display, "AMPL.display(self, *ampl_expressions)\nWrites on the current OutputHandler the outcome of the AMPL statement.\n\n.. code-block:: ampl\n\n    display e1, e2, .., en;\n\nwhere e1, ..., en are the strings passed to the procedure.\n\nArgs:\n    ampl_expressions: Expressions to be evaluated.\n\nRaises:\n    RuntimeError: if ampl_expressions do not evaluate to expressions.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_51display = {"display", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_51display, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_50display};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_51display(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ampl_expressions = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("display (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("display", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_ampl_expressions = __pyx_args;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_50display(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_ampl_expressions);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_ampl_expressions);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_50display(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_ampl_expressions) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  PyObject *__pyx_v_exprs = NULL;
  int __pyx_v_size;
  char const **__pyx_v_array;
  int __pyx_v_i;
  PyObject *__pyx_v_display = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__pyx_t_9;
  char const *__pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("display", 0);

  /* "amplpy/ampl.pyx":686
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         exprs = list(map(str, ampl_expressions))             # <<<<<<<<<<<<<<
 *         cdef int size = len(exprs)
 *         cdef const char** array = <const char**>malloc(size * sizeof(const char*))
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_map);
  __pyx_t_3 = __pyx_builtin_map; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)(&PyUnicode_Type)), __pyx_v_ampl_expressions};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_exprs = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/ampl.pyx":687
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         exprs = list(map(str, ampl_expressions))
 *         cdef int size = len(exprs)             # <<<<<<<<<<<<<<
 *         cdef const char** array = <const char**>malloc(size * sizeof(const char*))
 * 
*/
  __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_exprs); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 687, __pyx_L1_error)
  __pyx_v_size = __pyx_t_5;

  /* "amplpy/ampl.pyx":688
 *         exprs = list(map(str, ampl_expressions))
 *         cdef int size = len(exprs)
 *         cdef const char** array = <const char**>malloc(size * sizeof(const char*))             # <<<<<<<<<<<<<<
 * 
 *         for i in range(size):
*/
  __pyx_v_array = ((char const **)malloc((__pyx_v_size * (sizeof(char const *)))));

  /* "amplpy/ampl.pyx":690
 *         cdef const char** array = <const char**>malloc(size * sizeof(const char*))
 * 
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             array[i] = strdup(exprs[i].encode('utf-8'))
 * 
*/
  __pyx_t_6 = __pyx_v_size;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "amplpy/ampl.pyx":691
 * 
 *         for i in range(size):
 *             array[i] = strdup(exprs[i].encode('utf-8'))             # <<<<<<<<<<<<<<
 * 
 *         display = "display"
*/
    __pyx_t_1 = __Pyx_PyList_GET_ITEM(__pyx_v_exprs, __pyx_v_i);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_utf_8};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
    (__pyx_v_array[__pyx_v_i]) = strdup(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "amplpy/ampl.pyx":693
 *             array[i] = strdup(exprs[i].encode('utf-8'))
 * 
 *         display = "display"             # <<<<<<<<<<<<<<
 *         errorinfo = campl.AMPL_CallVisualisationCommandOnNames(self._c_ampl, display.encode('utf-8'), <const char* const*>array, size)
 *         for i in range(size):
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_display);
  __pyx_v_display = __pyx_mstate_global->__pyx_n_u_display;

  /* "amplpy/ampl.pyx":694
 * 
 *         display = "display"
 *         errorinfo = campl.AMPL_CallVisualisationCommandOnNames(self._c_ampl, display.encode('utf-8'), <const char* const*>array, size)             # <<<<<<<<<<<<<<
 *         for i in range(size):
 *             free(array[i])
*/
  __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L1_error)
  __pyx_v_errorinfo = AMPL_CallVisualisationCommandOnNames(__pyx_v_self->_c_ampl, __pyx_t_10, ((char const *const *)__pyx_v_array), __pyx_v_size);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/ampl.pyx":695
 *         display = "display"
 *         errorinfo = campl.AMPL_CallVisualisationCommandOnNames(self._c_ampl, display.encode('utf-8'), <const char* const*>array, size)
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             free(array[i])
 *         free(array)
*/
  __pyx_t_6 = __pyx_v_size;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "amplpy/ampl.pyx":696
 *         errorinfo = campl.AMPL_CallVisualisationCommandOnNames(self._c_ampl, display.encode('utf-8'), <const char* const*>array, size)
 *         for i in range(size):
 *             free(array[i])             # <<<<<<<<<<<<<<
 *         free(array)
 *         if errorinfo:
*/
    free((__pyx_v_array[__pyx_v_i]));
  }

  /* "amplpy/ampl.pyx":697
 *         for i in range(size):
 *             free(array[i])
 *         free(array)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  free(__pyx_v_array);

  /* "amplpy/ampl.pyx":698
 *             free(array[i])
 *         free(array)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  __pyx_t_11 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_11) {

    /* "amplpy/ampl.pyx":699
 *         free(array)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 * 
 *     def set_output_handler(self, output_handler):
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L1_error)

    /* "amplpy/ampl.pyx":698
 *             free(array[i])
 *         free(array)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 * 
*/
  }

  /* "amplpy/ampl.pyx":669
 *         PY_AMPL_CALL(campl.AMPL_WriteTable(self._c_ampl, table_name.encode('utf-8')))
 * 
 *     def display(self, *ampl_expressions):             # <<<<<<<<<<<<<<
 *         """
 *         Writes on the current OutputHandler the outcome of the AMPL statement.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.display", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exprs);
  __Pyx_XDECREF(__pyx_v_display);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":701
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def set_output_handler(self, output_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a new output handler.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_53set_output_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_52set_output_handler, "AMPL.set_output_handler(self, output_handler)\nSets a new output handler.\n\nArgs:\n    output_handler: The function handling the AMPL output derived from\n    interpreting user commands.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_53set_output_handler = {"set_output_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_53set_output_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_52set_output_handler};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_53set_output_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_output_handler = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_output_handler (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_output_handler,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 701, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 701, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_output_handler", 0) < 0) __PYX_ERR(0, 701, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_output_handler", 1, 1, 1, i); __PYX_ERR(0, 701, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 701, __pyx_L3_error)
    }
    __pyx_v_output_handler = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_output_handler", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 701, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_output_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_52set_output_handler(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_output_handler);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_52set_output_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_output_handler) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_output_handler", 0);

  /* "amplpy/ampl.pyx":709
 *             interpreting user commands.
 *         """
 *         self._output_handler = output_handler             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_SetOutputHandler(self._c_ampl, PyOutput, <void*>output_handler))
 * 
*/
  __Pyx_INCREF(__pyx_v_output_handler);
  __Pyx_GIVEREF(__pyx_v_output_handler);
  __Pyx_GOTREF(__pyx_v_self->_output_handler);
  __Pyx_DECREF(__pyx_v_self->_output_handler);
  __pyx_v_self->_output_handler = __pyx_v_output_handler;

  /* "amplpy/ampl.pyx":710
 *         """
 *         self._output_handler = output_handler
 *         PY_AMPL_CALL(campl.AMPL_SetOutputHandler(self._c_ampl, PyOutput, <void*>output_handler))             # <<<<<<<<<<<<<<
 * 
 *     def set_error_handler(self, error_handler):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetOutputHandler(__pyx_v_self->_c_ampl, __pyx_f_6amplpy_4ampl_PyOutput, ((void *)__pyx_v_output_handler))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 710, __pyx_L1_error)

  /* "amplpy/ampl.pyx":701
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def set_output_handler(self, output_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a new output handler.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_output_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":712
 *         PY_AMPL_CALL(campl.AMPL_SetOutputHandler(self._c_ampl, PyOutput, <void*>output_handler))
 * 
 *     def set_error_handler(self, error_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a new error handler.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_55set_error_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_54set_error_handler, "AMPL.set_error_handler(self, error_handler)\nSets a new error handler.\n\nArgs:\n    error_handler: The object handling AMPL errors and warnings.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_55set_error_handler = {"set_error_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_55set_error_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_54set_error_handler};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_55set_error_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_error_handler = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_error_handler (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_error_handler,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 712, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 712, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_error_handler", 0) < 0) __PYX_ERR(0, 712, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_error_handler", 1, 1, 1, i); __PYX_ERR(0, 712, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 712, __pyx_L3_error)
    }
    __pyx_v_error_handler = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_error_handler", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 712, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_54set_error_handler(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_error_handler);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":720
 *         """
 *         class ErrorHandlerWrapper(ErrorHandler):
 *             def __init__(self, ampl_instance, error_handler):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl_instance
 *                 self.error_handler = error_handler
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_ampl_instance = 0;
  PyObject *__pyx_v_error_handler = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_ampl_instance,&__pyx_mstate_global->__pyx_n_u_error_handler,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 720, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 720, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 720, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, i); __PYX_ERR(0, 720, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 720, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 720, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 720, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_ampl_instance = values[1];
    __pyx_v_error_handler = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 720, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper___init__(__pyx_self, __pyx_v_self, __pyx_v_ampl_instance, __pyx_v_error_handler);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl_instance, PyObject *__pyx_v_error_handler) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/ampl.pyx":721
 *         class ErrorHandlerWrapper(ErrorHandler):
 *             def __init__(self, ampl_instance, error_handler):
 *                 self.ampl = ampl_instance             # <<<<<<<<<<<<<<
 *                 self.error_handler = error_handler
 *                 self.last_exception = None
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl, __pyx_v_ampl_instance) < 0) __PYX_ERR(0, 721, __pyx_L1_error)

  /* "amplpy/ampl.pyx":722
 *             def __init__(self, ampl_instance, error_handler):
 *                 self.ampl = ampl_instance
 *                 self.error_handler = error_handler             # <<<<<<<<<<<<<<
 *                 self.last_exception = None
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_error_handler, __pyx_v_error_handler) < 0) __PYX_ERR(0, 722, __pyx_L1_error)

  /* "amplpy/ampl.pyx":723
 *                 self.ampl = ampl_instance
 *                 self.error_handler = error_handler
 *                 self.last_exception = None             # <<<<<<<<<<<<<<
 * 
 *             def error(self, exception):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception, Py_None) < 0) __PYX_ERR(0, 723, __pyx_L1_error)

  /* "amplpy/ampl.pyx":720
 *         """
 *         class ErrorHandlerWrapper(ErrorHandler):
 *             def __init__(self, ampl_instance, error_handler):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl_instance
 *                 self.error_handler = error_handler
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":725
 *                 self.last_exception = None
 * 
 *             def error(self, exception):             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.error_handler.error(exception)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_3error(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_3error = {"error", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_3error, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_3error(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_exception = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("error (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_exception,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 725, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 725, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 725, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "error", 0) < 0) __PYX_ERR(0, 725, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("error", 1, 2, 2, i); __PYX_ERR(0, 725, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 725, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 725, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_exception = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("error", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 725, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_2error(__pyx_self, __pyx_v_self, __pyx_v_exception);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_2error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("error", 0);

  /* "amplpy/ampl.pyx":726
 * 
 *             def error(self, exception):
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.error_handler.error(exception)
 *                 except Exception as exp:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "amplpy/ampl.pyx":727
 *             def error(self, exception):
 *                 try:
 *                     self.error_handler.error(exception)             # <<<<<<<<<<<<<<
 *                 except Exception as exp:
 *                     if self.last_exception is None:
*/
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_error_handler); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 727, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_exception};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_error, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 727, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "amplpy/ampl.pyx":726
 * 
 *             def error(self, exception):
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.error_handler.error(exception)
 *                 except Exception as exp:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "amplpy/ampl.pyx":728
 *                 try:
 *                     self.error_handler.error(exception)
 *                 except Exception as exp:             # <<<<<<<<<<<<<<
 *                     if self.last_exception is None:
 *                         self.last_exception = exp
*/
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 728, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_exp = __pyx_t_6;
      /*try:*/ {

        /* "amplpy/ampl.pyx":729
 *                     self.error_handler.error(exception)
 *                 except Exception as exp:
 *                     if self.last_exception is None:             # <<<<<<<<<<<<<<
 *                         self.last_exception = exp
 * 
*/
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 729, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = (__pyx_t_9 == Py_None);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_10) {

          /* "amplpy/ampl.pyx":730
 *                 except Exception as exp:
 *                     if self.last_exception is None:
 *                         self.last_exception = exp             # <<<<<<<<<<<<<<
 * 
 *             def warning(self, exception):
*/
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception, __pyx_v_exp) < 0) __PYX_ERR(0, 730, __pyx_L14_error)

          /* "amplpy/ampl.pyx":729
 *                     self.error_handler.error(exception)
 *                 except Exception as exp:
 *                     if self.last_exception is None:             # <<<<<<<<<<<<<<
 *                         self.last_exception = exp
 * 
*/
        }
      }

      /* "amplpy/ampl.pyx":728
 *                 try:
 *                     self.error_handler.error(exception)
 *                 except Exception as exp:             # <<<<<<<<<<<<<<
 *                     if self.last_exception is None:
 *                         self.last_exception = exp
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_exp); __pyx_v_exp = 0;
          goto __pyx_L15;
        }
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __pyx_t_8 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_exp); __pyx_v_exp = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
          __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
          goto __pyx_L5_except_error;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "amplpy/ampl.pyx":726
 * 
 *             def error(self, exception):
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.error_handler.error(exception)
 *                 except Exception as exp:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "amplpy/ampl.pyx":725
 *                 self.last_exception = None
 * 
 *             def error(self, exception):             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.error_handler.error(exception)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":732
 *                         self.last_exception = exp
 * 
 *             def warning(self, exception):             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.error_handler.warning(exception)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_5warning(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_5warning = {"warning", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_5warning, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_5warning(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_exception = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("warning (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_exception,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 732, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 732, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 732, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "warning", 0) < 0) __PYX_ERR(0, 732, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("warning", 1, 2, 2, i); __PYX_ERR(0, 732, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 732, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 732, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_exception = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("warning", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 732, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.warning", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_4warning(__pyx_self, __pyx_v_self, __pyx_v_exception);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_4warning(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  char const *__pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("warning", 0);

  /* "amplpy/ampl.pyx":733
 * 
 *             def warning(self, exception):
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.error_handler.warning(exception)
 *                 except Exception as exp:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "amplpy/ampl.pyx":734
 *             def warning(self, exception):
 *                 try:
 *                     self.error_handler.warning(exception)             # <<<<<<<<<<<<<<
 *                 except Exception as exp:
 *                     if self.last_exception is None:
*/
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_error_handler); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 734, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_exception};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_warning, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 734, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "amplpy/ampl.pyx":733
 * 
 *             def warning(self, exception):
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.error_handler.warning(exception)
 *                 except Exception as exp:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "amplpy/ampl.pyx":735
 *                 try:
 *                     self.error_handler.warning(exception)
 *                 except Exception as exp:             # <<<<<<<<<<<<<<
 *                     if self.last_exception is None:
 *                         if self.ampl.get_option("_throw_on_warnings") != 1.0:
*/
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.warning", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 735, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_exp = __pyx_t_6;
      /*try:*/ {

        /* "amplpy/ampl.pyx":736
 *                     self.error_handler.warning(exception)
 *                 except Exception as exp:
 *                     if self.last_exception is None:             # <<<<<<<<<<<<<<
 *                         if self.ampl.get_option("_throw_on_warnings") != 1.0:
 *                             pass
*/
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 736, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = (__pyx_t_9 == Py_None);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_10) {

          /* "amplpy/ampl.pyx":737
 *                 except Exception as exp:
 *                     if self.last_exception is None:
 *                         if self.ampl.get_option("_throw_on_warnings") != 1.0:             # <<<<<<<<<<<<<<
 *                             pass
 *                         else:
*/
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 737, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_11 = __pyx_t_12;
          __Pyx_INCREF(__pyx_t_11);
          __pyx_t_7 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_throw_on_warnings};
            __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_option, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 737, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_9);
          }
          __pyx_t_10 = (__Pyx_PyFloat_BoolNeObjC(__pyx_t_9, __pyx_mstate_global->__pyx_float_1_0, 1.0, 0, 0)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 737, __pyx_L14_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10) {
            goto __pyx_L17;
          }

          /* "amplpy/ampl.pyx":740
 *                             pass
 *                         else:
 *                             self.last_exception = exp             # <<<<<<<<<<<<<<
 * 
 *             def check(self):
*/
          /*else*/ {
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception, __pyx_v_exp) < 0) __PYX_ERR(0, 740, __pyx_L14_error)
          }
          __pyx_L17:;

          /* "amplpy/ampl.pyx":736
 *                     self.error_handler.warning(exception)
 *                 except Exception as exp:
 *                     if self.last_exception is None:             # <<<<<<<<<<<<<<
 *                         if self.ampl.get_option("_throw_on_warnings") != 1.0:
 *                             pass
*/
        }
      }

      /* "amplpy/ampl.pyx":735
 *                 try:
 *                     self.error_handler.warning(exception)
 *                 except Exception as exp:             # <<<<<<<<<<<<<<
 *                     if self.last_exception is None:
 *                         if self.ampl.get_option("_throw_on_warnings") != 1.0:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_exp); __pyx_v_exp = 0;
          goto __pyx_L15;
        }
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
          if ( unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __Pyx_XGOTREF(__pyx_t_19);
          __Pyx_XGOTREF(__pyx_t_20);
          __pyx_t_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_exp); __pyx_v_exp = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_19);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
          __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
          __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
          goto __pyx_L5_except_error;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "amplpy/ampl.pyx":733
 * 
 *             def warning(self, exception):
 *                 try:             # <<<<<<<<<<<<<<
 *                     self.error_handler.warning(exception)
 *                 except Exception as exp:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "amplpy/ampl.pyx":732
 *                         self.last_exception = exp
 * 
 *             def warning(self, exception):             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.error_handler.warning(exception)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.warning", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":742
 *                             self.last_exception = exp
 * 
 *             def check(self):             # <<<<<<<<<<<<<<
 *                 if isinstance(self.last_exception, Exception):
 *                     exp = self.last_exception
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_7check(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_7check = {"check", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_7check, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_7check(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 742, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 742, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "check", 0) < 0) __PYX_ERR(0, 742, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check", 1, 1, 1, i); __PYX_ERR(0, 742, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 742, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("check", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 742, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.check", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_6check(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_6check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check", 0);

  /* "amplpy/ampl.pyx":743
 * 
 *             def check(self):
 *                 if isinstance(self.last_exception, Exception):             # <<<<<<<<<<<<<<
 *                     exp = self.last_exception
 *                     self.last_exception = None
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyException_Check(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "amplpy/ampl.pyx":744
 *             def check(self):
 *                 if isinstance(self.last_exception, Exception):
 *                     exp = self.last_exception             # <<<<<<<<<<<<<<
 *                     self.last_exception = None
 *                     raise exp
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_exp = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":745
 *                 if isinstance(self.last_exception, Exception):
 *                     exp = self.last_exception
 *                     self.last_exception = None             # <<<<<<<<<<<<<<
 *                     raise exp
 * 
*/
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_last_exception, Py_None) < 0) __PYX_ERR(0, 745, __pyx_L1_error)

    /* "amplpy/ampl.pyx":746
 *                     exp = self.last_exception
 *                     self.last_exception = None
 *                     raise exp             # <<<<<<<<<<<<<<
 * 
 *         error_handler_wrapper = ErrorHandlerWrapper(self, error_handler)
*/
    __Pyx_Raise(__pyx_v_exp, 0, 0, 0);
    __PYX_ERR(0, 746, __pyx_L1_error)

    /* "amplpy/ampl.pyx":743
 * 
 *             def check(self):
 *                 if isinstance(self.last_exception, Exception):             # <<<<<<<<<<<<<<
 *                     exp = self.last_exception
 *                     self.last_exception = None
*/
  }

  /* "amplpy/ampl.pyx":742
 *                             self.last_exception = exp
 * 
 *             def check(self):             # <<<<<<<<<<<<<<
 *                 if isinstance(self.last_exception, Exception):
 *                     exp = self.last_exception
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler.ErrorHandlerWrapper.check", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":712
 *         PY_AMPL_CALL(campl.AMPL_SetOutputHandler(self._c_ampl, PyOutput, <void*>output_handler))
 * 
 *     def set_error_handler(self, error_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a new error handler.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_54set_error_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_error_handler) {
  PyObject *__pyx_v_ErrorHandlerWrapper = NULL;
  PyObject *__pyx_v_error_handler_wrapper = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_error_handler", 0);

  /* "amplpy/ampl.pyx":719
 *             error_handler: The object handling AMPL errors and warnings.
 *         """
 *         class ErrorHandlerWrapper(ErrorHandler):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl_instance, error_handler):
 *                 self.ampl = ampl_instance
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler);
  __Pyx_GIVEREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler)) != (0)) __PYX_ERR(0, 719, __pyx_L1_error);
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_ErrorHandlerWrapper, __pyx_mstate_global->__pyx_n_u_set_error_handler_locals_ErrorHa, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_2 != __pyx_t_1) {
    if (unlikely((PyDict_SetItemString(__pyx_t_4, "__orig_bases__", __pyx_t_1) < 0))) __PYX_ERR(0, 719, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":720
 *         """
 *         class ErrorHandlerWrapper(ErrorHandler):
 *             def __init__(self, ampl_instance, error_handler):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl_instance
 *                 self.error_handler = error_handler
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_1__init__, 0, __pyx_mstate_global->__pyx_n_u_set_error_handler_locals_ErrorHa_2, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_1) < 0) __PYX_ERR(0, 720, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":725
 *                 self.last_exception = None
 * 
 *             def error(self, exception):             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.error_handler.error(exception)
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_3error, 0, __pyx_mstate_global->__pyx_n_u_set_error_handler_locals_ErrorHa_3, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_error, __pyx_t_1) < 0) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":732
 *                         self.last_exception = exp
 * 
 *             def warning(self, exception):             # <<<<<<<<<<<<<<
 *                 try:
 *                     self.error_handler.warning(exception)
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_5warning, 0, __pyx_mstate_global->__pyx_n_u_set_error_handler_locals_ErrorHa_4, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warning, __pyx_t_1) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":742
 *                             self.last_exception = exp
 * 
 *             def check(self):             # <<<<<<<<<<<<<<
 *                 if isinstance(self.last_exception, Exception):
 *                     exp = self.last_exception
*/
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_17set_error_handler_19ErrorHandlerWrapper_7check, 0, __pyx_mstate_global->__pyx_n_u_set_error_handler_locals_ErrorHa_5, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_check, __pyx_t_1) < 0) __PYX_ERR(0, 742, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":719
 *             error_handler: The object handling AMPL errors and warnings.
 *         """
 *         class ErrorHandlerWrapper(ErrorHandler):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl_instance, error_handler):
 *                 self.ampl = ampl_instance
*/
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ErrorHandlerWrapper, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ErrorHandlerWrapper = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":748
 *                     raise exp
 * 
 *         error_handler_wrapper = ErrorHandlerWrapper(self, error_handler)             # <<<<<<<<<<<<<<
 * 
 *         self._error_handler = error_handler
*/
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)) != (0)) __PYX_ERR(0, 748, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_error_handler);
  __Pyx_GIVEREF(__pyx_v_error_handler);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_error_handler) != (0)) __PYX_ERR(0, 748, __pyx_L1_error);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_ErrorHandlerWrapper, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_error_handler_wrapper = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "amplpy/ampl.pyx":750
 *         error_handler_wrapper = ErrorHandlerWrapper(self, error_handler)
 * 
 *         self._error_handler = error_handler             # <<<<<<<<<<<<<<
 *         self._error_handler_wrapper = error_handler_wrapper
 * 
*/
  __Pyx_INCREF(__pyx_v_error_handler);
  __Pyx_GIVEREF(__pyx_v_error_handler);
  __Pyx_GOTREF(__pyx_v_self->_error_handler);
  __Pyx_DECREF(__pyx_v_self->_error_handler);
  __pyx_v_self->_error_handler = __pyx_v_error_handler;

  /* "amplpy/ampl.pyx":751
 * 
 *         self._error_handler = error_handler
 *         self._error_handler_wrapper = error_handler_wrapper             # <<<<<<<<<<<<<<
 * 
 *         PY_AMPL_CALL(campl.AMPL_SetErrorHandler(self._c_ampl, PyError, <void*>self._error_handler_wrapper))
*/
  __Pyx_INCREF(__pyx_v_error_handler_wrapper);
  __Pyx_GIVEREF(__pyx_v_error_handler_wrapper);
  __Pyx_GOTREF(__pyx_v_self->_error_handler_wrapper);
  __Pyx_DECREF(__pyx_v_self->_error_handler_wrapper);
  __pyx_v_self->_error_handler_wrapper = __pyx_v_error_handler_wrapper;

  /* "amplpy/ampl.pyx":753
 *         self._error_handler_wrapper = error_handler_wrapper
 * 
 *         PY_AMPL_CALL(campl.AMPL_SetErrorHandler(self._c_ampl, PyError, <void*>self._error_handler_wrapper))             # <<<<<<<<<<<<<<
 * 
 *     def get_output_handler(self):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetErrorHandler(__pyx_v_self->_c_ampl, __pyx_f_6amplpy_4ampl_PyError, ((void *)__pyx_v_self->_error_handler_wrapper))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 753, __pyx_L1_error)

  /* "amplpy/ampl.pyx":712
 *         PY_AMPL_CALL(campl.AMPL_SetOutputHandler(self._c_ampl, PyOutput, <void*>output_handler))
 * 
 *     def set_error_handler(self, error_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a new error handler.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.set_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ErrorHandlerWrapper);
  __Pyx_XDECREF(__pyx_v_error_handler_wrapper);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":755
 *         PY_AMPL_CALL(campl.AMPL_SetErrorHandler(self._c_ampl, PyError, <void*>self._error_handler_wrapper))
 * 
 *     def get_output_handler(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current output handler.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_57get_output_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_56get_output_handler, "AMPL.get_output_handler(self)\nGet the current output handler.\n\nReturns:\n    The current output handler.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_57get_output_handler = {"get_output_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_57get_output_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_56get_output_handler};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_57get_output_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_output_handler (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_output_handler", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_output_handler", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_56get_output_handler(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_56get_output_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  void *__pyx_v_output_handler;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_output_handler", 0);

  /* "amplpy/ampl.pyx":763
 *         """
 *         cdef void* output_handler
 *         PY_AMPL_CALL(campl.AMPL_GetOutputHandler(self._c_ampl, &output_handler))             # <<<<<<<<<<<<<<
 *         return <OutputHandler>output_handler
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_GetOutputHandler(__pyx_v_self->_c_ampl, (&__pyx_v_output_handler))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error)

  /* "amplpy/ampl.pyx":764
 *         cdef void* output_handler
 *         PY_AMPL_CALL(campl.AMPL_GetOutputHandler(self._c_ampl, &output_handler))
 *         return <OutputHandler>output_handler             # <<<<<<<<<<<<<<
 * 
 *     def get_error_handler(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)((struct __pyx_obj_6amplpy_4ampl_OutputHandler *)__pyx_v_output_handler));
  __pyx_r = ((PyObject *)__pyx_v_output_handler);
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":755
 *         PY_AMPL_CALL(campl.AMPL_SetErrorHandler(self._c_ampl, PyError, <void*>self._error_handler_wrapper))
 * 
 *     def get_output_handler(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current output handler.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_output_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":766
 *         return <OutputHandler>output_handler
 * 
 *     def get_error_handler(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current error handler.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_59get_error_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_58get_error_handler, "AMPL.get_error_handler(self)\nGet the current error handler.\n\nReturns:\n    The current error handler.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_59get_error_handler = {"get_error_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_59get_error_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_58get_error_handler};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_59get_error_handler(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_error_handler (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_error_handler", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_error_handler", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_58get_error_handler(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_58get_error_handler(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_error_handler", 0);

  /* "amplpy/ampl.pyx":773
 *             The current error handler.
 *         """
 *         return <ErrorHandler>self._error_handler             # <<<<<<<<<<<<<<
 * 
 *     def get_variables(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)((struct __pyx_obj_6amplpy_4ampl_ErrorHandler *)__pyx_v_self->_error_handler));
  __pyx_r = __pyx_v_self->_error_handler;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":766
 *         return <OutputHandler>output_handler
 * 
 *     def get_error_handler(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current error handler.
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":775
 *         return <ErrorHandler>self._error_handler
 * 
 *     def get_variables(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the variables declared.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_61get_variables(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_60get_variables, "AMPL.get_variables(self)\nGet all the variables declared.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_61get_variables = {"get_variables", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_61get_variables, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_60get_variables};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_61get_variables(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_variables (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_variables", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_variables", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_60get_variables(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_60get_variables(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_variables", 0);

  /* "amplpy/ampl.pyx":779
 *         Get all the variables declared.
 *         """
 *         return EntityMap.create(self, campl.AMPL_VARIABLE)             # <<<<<<<<<<<<<<
 * 
 *     def get_constraints(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9EntityMap_create(__pyx_v_self, AMPL_VARIABLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":775
 *         return <ErrorHandler>self._error_handler
 * 
 *     def get_variables(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the variables declared.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_variables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":781
 *         return EntityMap.create(self, campl.AMPL_VARIABLE)
 * 
 *     def get_constraints(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the constraints declared.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_63get_constraints(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_62get_constraints, "AMPL.get_constraints(self)\nGet all the constraints declared.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_63get_constraints = {"get_constraints", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_63get_constraints, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_62get_constraints};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_63get_constraints(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_constraints (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_constraints", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_constraints", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_62get_constraints(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_62get_constraints(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_constraints", 0);

  /* "amplpy/ampl.pyx":785
 *         Get all the constraints declared.
 *         """
 *         return EntityMap.create(self, campl.AMPL_CONSTRAINT)             # <<<<<<<<<<<<<<
 * 
 *     def get_objectives(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9EntityMap_create(__pyx_v_self, AMPL_CONSTRAINT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":781
 *         return EntityMap.create(self, campl.AMPL_VARIABLE)
 * 
 *     def get_constraints(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the constraints declared.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_constraints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":787
 *         return EntityMap.create(self, campl.AMPL_CONSTRAINT)
 * 
 *     def get_objectives(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the objectives declared.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_65get_objectives(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_64get_objectives, "AMPL.get_objectives(self)\nGet all the objectives declared.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_65get_objectives = {"get_objectives", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_65get_objectives, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_64get_objectives};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_65get_objectives(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_objectives (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_objectives", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_objectives", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_64get_objectives(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_64get_objectives(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_objectives", 0);

  /* "amplpy/ampl.pyx":791
 *         Get all the objectives declared.
 *         """
 *         return EntityMap.create(self, campl.AMPL_OBJECTIVE)             # <<<<<<<<<<<<<<
 * 
 *     def get_sets(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9EntityMap_create(__pyx_v_self, AMPL_OBJECTIVE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":787
 *         return EntityMap.create(self, campl.AMPL_CONSTRAINT)
 * 
 *     def get_objectives(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the objectives declared.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_objectives", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":793
 *         return EntityMap.create(self, campl.AMPL_OBJECTIVE)
 * 
 *     def get_sets(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the sets declared.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_67get_sets(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_66get_sets, "AMPL.get_sets(self)\nGet all the sets declared.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_67get_sets = {"get_sets", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_67get_sets, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_66get_sets};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_67get_sets(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sets (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_sets", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_sets", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_66get_sets(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_66get_sets(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sets", 0);

  /* "amplpy/ampl.pyx":797
 *         Get all the sets declared.
 *         """
 *         return EntityMap.create(self, campl.AMPL_SET)             # <<<<<<<<<<<<<<
 * 
 *     def get_parameters(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9EntityMap_create(__pyx_v_self, AMPL_SET); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":793
 *         return EntityMap.create(self, campl.AMPL_OBJECTIVE)
 * 
 *     def get_sets(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the sets declared.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_sets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":799
 *         return EntityMap.create(self, campl.AMPL_SET)
 * 
 *     def get_parameters(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the parameters declared.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_69get_parameters(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_68get_parameters, "AMPL.get_parameters(self)\nGet all the parameters declared.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_69get_parameters = {"get_parameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_69get_parameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_68get_parameters};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_69get_parameters(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_parameters (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_parameters", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_parameters", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_68get_parameters(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_68get_parameters(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_parameters", 0);

  /* "amplpy/ampl.pyx":803
 *         Get all the parameters declared.
 *         """
 *         return EntityMap.create(self, campl.AMPL_PARAMETER)             # <<<<<<<<<<<<<<
 * 
 *     def get_current_objective(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6amplpy_4ampl_9EntityMap_create(__pyx_v_self, AMPL_PARAMETER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":799
 *         return EntityMap.create(self, campl.AMPL_SET)
 * 
 *     def get_parameters(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the parameters declared.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":805
 *         return EntityMap.create(self, campl.AMPL_PARAMETER)
 * 
 *     def get_current_objective(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the the current objective. Returns `None` if no objective is set.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_71get_current_objective(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_70get_current_objective, "AMPL.get_current_objective(self)\nGet the the current objective. Returns `None` if no objective is set.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_71get_current_objective = {"get_current_objective", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_71get_current_objective, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_70get_current_objective};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_71get_current_objective(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_current_objective (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("get_current_objective", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("get_current_objective", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_70get_current_objective(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_70get_current_objective(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_objname_c;
  PyObject *__pyx_v_objname = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_current_objective", 0);

  /* "amplpy/ampl.pyx":811
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* objname_c
 *         errorinfo = campl.AMPL_GetCurrentObjective(self._c_ampl, &objname_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_GetCurrentObjective(__pyx_v_self->_c_ampl, (&__pyx_v_objname_c));

  /* "amplpy/ampl.pyx":812
 *         cdef char* objname_c
 *         errorinfo = campl.AMPL_GetCurrentObjective(self._c_ampl, &objname_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         objname = str(objname_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":813
 *         errorinfo = campl.AMPL_GetCurrentObjective(self._c_ampl, &objname_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         objname = str(objname_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&objname_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 813, __pyx_L1_error)

    /* "amplpy/ampl.pyx":812
 *         cdef char* objname_c
 *         errorinfo = campl.AMPL_GetCurrentObjective(self._c_ampl, &objname_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         objname = str(objname_c.decode('utf-8'))
*/
  }

  /* "amplpy/ampl.pyx":814
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         objname = str(objname_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&objname_c)
 *         if objname == "":
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_objname_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 814, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_objname_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_objname = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/ampl.pyx":815
 *             PY_AMPL_CALL(errorinfo)
 *         objname = str(objname_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&objname_c)             # <<<<<<<<<<<<<<
 *         if objname == "":
 *             return None
*/
  (void)(AMPL_StringFree((&__pyx_v_objname_c)));

  /* "amplpy/ampl.pyx":816
 *         objname = str(objname_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&objname_c)
 *         if objname == "":             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_objname, __pyx_mstate_global->__pyx_kp_u__3, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 816, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":817
 *         campl.AMPL_StringFree(&objname_c)
 *         if objname == "":
 *             return None             # <<<<<<<<<<<<<<
 *         else:
 *             return self.get_objective(objname)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":816
 *         objname = str(objname_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&objname_c)
 *         if objname == "":             # <<<<<<<<<<<<<<
 *             return None
 *         else:
*/
  }

  /* "amplpy/ampl.pyx":819
 *             return None
 *         else:
 *             return self.get_objective(objname)             # <<<<<<<<<<<<<<
 * 
 *     def _var(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_objname};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_objective, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 819, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "amplpy/ampl.pyx":805
 *         return EntityMap.create(self, campl.AMPL_PARAMETER)
 * 
 *     def get_current_objective(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the the current objective. Returns `None` if no objective is set.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_current_objective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_objname);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":821
 *             return self.get_objective(objname)
 * 
 *     def _var(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a variable.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_73_var(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_72_var, "AMPL._var(self)\nGet/Set a variable.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_73_var = {"_var", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_73_var, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_72_var};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_73_var(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_var (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_var", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_var", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_72_var(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":827
 * 
 *         class Variables(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_ampl = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_ampl,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 827, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 827, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 827, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 827, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 827, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 827, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 827, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_ampl = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 827, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables___init__(__pyx_self, __pyx_v_self, __pyx_v_ampl);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/ampl.pyx":828
 *         class Variables(object):
 *             def __init__(self, ampl):
 *                 self.ampl = ampl             # <<<<<<<<<<<<<<
 * 
 *             def __getitem__(self, name):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl, __pyx_v_ampl) < 0) __PYX_ERR(0, 828, __pyx_L1_error)

  /* "amplpy/ampl.pyx":827
 * 
 *         class Variables(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":830
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_variable(name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_3__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_3__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 830, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 830, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 830, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < 0) __PYX_ERR(0, 830, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 830, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 830, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 830, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 830, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/ampl.pyx":831
 * 
 *             def __getitem__(self, name):
 *                 return self.ampl.get_variable(name)             # <<<<<<<<<<<<<<
 * 
 *             def __setitem__(self, name, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_variable, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":830
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_variable(name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":833
 *                 return self.ampl.get_variable(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, Real):
 *                     self.ampl.get_variable(name).set_value(value)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_5__setitem__ = {"__setitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_5__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 833, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 833, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 833, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 833, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setitem__", 0) < 0) __PYX_ERR(0, 833, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, i); __PYX_ERR(0, 833, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 833, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 833, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 833, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 833, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_4__setitem__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/ampl.pyx":834
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                     self.ampl.get_variable(name).set_value(value)
 *                 else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "amplpy/ampl.pyx":835
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, Real):
 *                     self.ampl.get_variable(name).set_value(value)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.ampl.get_variable(name).set_values(value)
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_name};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_variable, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_3 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_value};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_value, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":834
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                     self.ampl.get_variable(name).set_value(value)
 *                 else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":837
 *                     self.ampl.get_variable(name).set_value(value)
 *                 else:
 *                     self.ampl.get_variable(name).set_values(value)             # <<<<<<<<<<<<<<
 * 
 *             def __iter__(self):
*/
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 837, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_name};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_variable, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_4 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_value};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":833
 *                 return self.ampl.get_variable(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, Real):
 *                     self.ampl.get_variable(name).set_value(value)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":839
 *                     self.ampl.get_variable(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_variables()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_7__iter__ = {"__iter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_7__iter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_var_9Variables_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 839, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 839, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__iter__", 0) < 0) __PYX_ERR(0, 839, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, i); __PYX_ERR(0, 839, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 839, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 839, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_6__iter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_var_9Variables_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/ampl.pyx":840
 * 
 *             def __iter__(self):
 *                 return self.ampl.get_variables()             # <<<<<<<<<<<<<<
 * 
 *         return Variables(self)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_variables, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":839
 *                     self.ampl.get_variable(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_variables()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var.Variables.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":821
 *             return self.get_objective(objname)
 * 
 *     def _var(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a variable.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_72_var(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_v_Variables = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_var", 0);

  /* "amplpy/ampl.pyx":826
 *         """
 * 
 *         class Variables(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_1 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[4]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_mstate_global->__pyx_n_u_Variables, __pyx_mstate_global->__pyx_n_u_var_locals_Variables, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_1 != __pyx_mstate_global->__pyx_tuple[4]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[4]) < 0))) __PYX_ERR(0, 826, __pyx_L1_error)
  }

  /* "amplpy/ampl.pyx":827
 * 
 *         class Variables(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_1__init__, 0, __pyx_mstate_global->__pyx_n_u_var_locals_Variables___init, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_4) < 0) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":830
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_variable(name)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_3__getitem__, 0, __pyx_mstate_global->__pyx_n_u_var_locals_Variables___getitem, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":833
 *                 return self.ampl.get_variable(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, Real):
 *                     self.ampl.get_variable(name).set_value(value)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_5__setitem__, 0, __pyx_mstate_global->__pyx_n_u_var_locals_Variables___setitem, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setitem, __pyx_t_4) < 0) __PYX_ERR(0, 833, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":839
 *                     self.ampl.get_variable(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_variables()
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_var_9Variables_7__iter__, 0, __pyx_mstate_global->__pyx_n_u_var_locals_Variables___iter, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_iter, __pyx_t_4) < 0) __PYX_ERR(0, 839, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":826
 *         """
 * 
 *         class Variables(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Variables, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_Variables = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":842
 *                 return self.ampl.get_variables()
 * 
 *         return Variables(self)             # <<<<<<<<<<<<<<
 * 
 *     def _con(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_v_Variables, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":821
 *             return self.get_objective(objname)
 * 
 *     def _var(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a variable.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._var", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Variables);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":844
 *         return Variables(self)
 * 
 *     def _con(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a constraint.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_75_con(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_74_con, "AMPL._con(self)\nGet/Set a constraint.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_75_con = {"_con", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_75_con, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_74_con};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_75_con(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_con (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_con", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_con", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_74_con(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":850
 * 
 *         class Constraints(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_ampl = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_ampl,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 850, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 850, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 850, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 850, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 850, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 850, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 850, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_ampl = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 850, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints___init__(__pyx_self, __pyx_v_self, __pyx_v_ampl);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/ampl.pyx":851
 *         class Constraints(object):
 *             def __init__(self, ampl):
 *                 self.ampl = ampl             # <<<<<<<<<<<<<<
 * 
 *             def __getitem__(self, name):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl, __pyx_v_ampl) < 0) __PYX_ERR(0, 851, __pyx_L1_error)

  /* "amplpy/ampl.pyx":850
 * 
 *         class Constraints(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":853
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_constraint(name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_3__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_3__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 853, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 853, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 853, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < 0) __PYX_ERR(0, 853, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 853, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 853, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 853, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 853, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/ampl.pyx":854
 * 
 *             def __getitem__(self, name):
 *                 return self.ampl.get_constraint(name)             # <<<<<<<<<<<<<<
 * 
 *             def __setitem__(self, name, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_constraint, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":853
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_constraint(name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":856
 *                 return self.ampl.get_constraint(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, Real):
 *                     self.ampl.get_constraint(name).set_dual(value)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_5__setitem__ = {"__setitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_5__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 856, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 856, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setitem__", 0) < 0) __PYX_ERR(0, 856, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, i); __PYX_ERR(0, 856, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 856, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 856, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 856, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 856, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_4__setitem__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/ampl.pyx":857
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                     self.ampl.get_constraint(name).set_dual(value)
 *                 else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "amplpy/ampl.pyx":858
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, Real):
 *                     self.ampl.get_constraint(name).set_dual(value)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.ampl.get_constraint(name).set_values(value)
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 858, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_name};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_constraint, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_3 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_value};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_dual, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":857
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, Real):             # <<<<<<<<<<<<<<
 *                     self.ampl.get_constraint(name).set_dual(value)
 *                 else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":860
 *                     self.ampl.get_constraint(name).set_dual(value)
 *                 else:
 *                     self.ampl.get_constraint(name).set_values(value)             # <<<<<<<<<<<<<<
 * 
 *             def __iter__(self):
*/
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_name};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_constraint, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_4 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_value};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":856
 *                 return self.ampl.get_constraint(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, Real):
 *                     self.ampl.get_constraint(name).set_dual(value)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":862
 *                     self.ampl.get_constraint(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_constraints()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_7__iter__ = {"__iter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_7__iter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_con_11Constraints_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 862, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 862, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__iter__", 0) < 0) __PYX_ERR(0, 862, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, i); __PYX_ERR(0, 862, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 862, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 862, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_6__iter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_con_11Constraints_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/ampl.pyx":863
 * 
 *             def __iter__(self):
 *                 return self.ampl.get_constraints()             # <<<<<<<<<<<<<<
 * 
 *         return Constraints(self)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_constraints, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":862
 *                     self.ampl.get_constraint(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_constraints()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con.Constraints.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":844
 *         return Variables(self)
 * 
 *     def _con(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a constraint.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_74_con(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_v_Constraints = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_con", 0);

  /* "amplpy/ampl.pyx":849
 *         """
 * 
 *         class Constraints(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_1 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[6]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_mstate_global->__pyx_n_u_Constraints, __pyx_mstate_global->__pyx_n_u_con_locals_Constraints, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_1 != __pyx_mstate_global->__pyx_tuple[6]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[6]) < 0))) __PYX_ERR(0, 849, __pyx_L1_error)
  }

  /* "amplpy/ampl.pyx":850
 * 
 *         class Constraints(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_1__init__, 0, __pyx_mstate_global->__pyx_n_u_con_locals_Constraints___init, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_4) < 0) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":853
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_constraint(name)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_3__getitem__, 0, __pyx_mstate_global->__pyx_n_u_con_locals_Constraints___getite, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 853, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":856
 *                 return self.ampl.get_constraint(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, Real):
 *                     self.ampl.get_constraint(name).set_dual(value)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_5__setitem__, 0, __pyx_mstate_global->__pyx_n_u_con_locals_Constraints___setite, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setitem, __pyx_t_4) < 0) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":862
 *                     self.ampl.get_constraint(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_constraints()
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_con_11Constraints_7__iter__, 0, __pyx_mstate_global->__pyx_n_u_con_locals_Constraints___iter, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_iter, __pyx_t_4) < 0) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":849
 *         """
 * 
 *         class Constraints(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Constraints, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_Constraints = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":865
 *                 return self.ampl.get_constraints()
 * 
 *         return Constraints(self)             # <<<<<<<<<<<<<<
 * 
 *     def _obj(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_v_Constraints, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":844
 *         return Variables(self)
 * 
 *     def _con(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a constraint.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._con", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Constraints);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":867
 *         return Constraints(self)
 * 
 *     def _obj(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get an objective.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_77_obj(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_76_obj, "AMPL._obj(self)\nGet an objective.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_77_obj = {"_obj", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_77_obj, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_76_obj};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_77_obj(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_obj (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_obj", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_obj", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_76_obj(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":873
 * 
 *         class Objectives(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_obj_10Objectives_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_ampl = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_ampl,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 873, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 873, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 873, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 873, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 873, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 873, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 873, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_ampl = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 873, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._obj.Objectives.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives___init__(__pyx_self, __pyx_v_self, __pyx_v_ampl);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/ampl.pyx":874
 *         class Objectives(object):
 *             def __init__(self, ampl):
 *                 self.ampl = ampl             # <<<<<<<<<<<<<<
 * 
 *             def __getitem__(self, name):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl, __pyx_v_ampl) < 0) __PYX_ERR(0, 874, __pyx_L1_error)

  /* "amplpy/ampl.pyx":873
 * 
 *         class Objectives(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._obj.Objectives.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":876
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_objective(name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_obj_10Objectives_3__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_3__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 876, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 876, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 876, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < 0) __PYX_ERR(0, 876, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 876, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 876, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 876, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 876, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._obj.Objectives.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/ampl.pyx":877
 * 
 *             def __getitem__(self, name):
 *                 return self.ampl.get_objective(name)             # <<<<<<<<<<<<<<
 * 
 *             def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_objective, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":876
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_objective(name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._obj.Objectives.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":879
 *                 return self.ampl.get_objective(name)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_objectives()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_5__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_obj_10Objectives_5__iter__ = {"__iter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_5__iter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_obj_10Objectives_5__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 879, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 879, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__iter__", 0) < 0) __PYX_ERR(0, 879, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, i); __PYX_ERR(0, 879, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 879, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 879, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._obj.Objectives.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives_4__iter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_obj_10Objectives_4__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/ampl.pyx":880
 * 
 *             def __iter__(self):
 *                 return self.ampl.get_objectives()             # <<<<<<<<<<<<<<
 * 
 *         return Objectives(self)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_objectives, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":879
 *                 return self.ampl.get_objective(name)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_objectives()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._obj.Objectives.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":867
 *         return Constraints(self)
 * 
 *     def _obj(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get an objective.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_76_obj(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_v_Objectives = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_obj", 0);

  /* "amplpy/ampl.pyx":872
 *         """
 * 
 *         class Objectives(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_1 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[8]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_mstate_global->__pyx_n_u_Objectives, __pyx_mstate_global->__pyx_n_u_obj_locals_Objectives, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_1 != __pyx_mstate_global->__pyx_tuple[8]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[8]) < 0))) __PYX_ERR(0, 872, __pyx_L1_error)
  }

  /* "amplpy/ampl.pyx":873
 * 
 *         class Objectives(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_obj_10Objectives_1__init__, 0, __pyx_mstate_global->__pyx_n_u_obj_locals_Objectives___init, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_4) < 0) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":876
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_objective(name)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_obj_10Objectives_3__getitem__, 0, __pyx_mstate_global->__pyx_n_u_obj_locals_Objectives___getitem, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":879
 *                 return self.ampl.get_objective(name)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_objectives()
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_obj_10Objectives_5__iter__, 0, __pyx_mstate_global->__pyx_n_u_obj_locals_Objectives___iter, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_iter, __pyx_t_4) < 0) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":872
 *         """
 * 
 *         class Objectives(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Objectives, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_Objectives = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":882
 *                 return self.ampl.get_objectives()
 * 
 *         return Objectives(self)             # <<<<<<<<<<<<<<
 * 
 *     def _set(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_v_Objectives, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":867
 *         return Constraints(self)
 * 
 *     def _obj(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get an objective.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._obj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Objectives);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":884
 *         return Objectives(self)
 * 
 *     def _set(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a set.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_79_set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_78_set, "AMPL._set(self)\nGet/Set a set.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_79_set = {"_set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_79_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_78_set};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_79_set(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_set", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_set", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_78_set(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":890
 * 
 *         class Sets(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_ampl = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_ampl,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 890, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 890, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 890, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 890, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 890, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 890, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 890, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_ampl = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 890, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets___init__(__pyx_self, __pyx_v_self, __pyx_v_ampl);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/ampl.pyx":891
 *         class Sets(object):
 *             def __init__(self, ampl):
 *                 self.ampl = ampl             # <<<<<<<<<<<<<<
 * 
 *             def __getitem__(self, name):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl, __pyx_v_ampl) < 0) __PYX_ERR(0, 891, __pyx_L1_error)

  /* "amplpy/ampl.pyx":890
 * 
 *         class Sets(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":893
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_set(name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_3__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_3__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 893, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 893, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 893, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < 0) __PYX_ERR(0, 893, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 893, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 893, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 893, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 893, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/ampl.pyx":894
 * 
 *             def __getitem__(self, name):
 *                 return self.ampl.get_set(name)             # <<<<<<<<<<<<<<
 * 
 *             def __setitem__(self, name, values):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_set, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":893
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_set(name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":896
 *                 return self.ampl.get_set(name)
 * 
 *             def __setitem__(self, name, values):             # <<<<<<<<<<<<<<
 *                 self.ampl.get_set(name).set_values(values)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_5__setitem__ = {"__setitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_5__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_values = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_values,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 896, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setitem__", 0) < 0) __PYX_ERR(0, 896, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, i); __PYX_ERR(0, 896, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 896, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 896, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 896, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
    __pyx_v_values = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 896, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_4__setitem__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_values);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_values) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/ampl.pyx":897
 * 
 *             def __setitem__(self, name, values):
 *                 self.ampl.get_set(name).set_values(values)             # <<<<<<<<<<<<<<
 * 
 *             def __iter__(self):
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_name};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_set, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_values};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":896
 *                 return self.ampl.get_set(name)
 * 
 *             def __setitem__(self, name, values):             # <<<<<<<<<<<<<<
 *                 self.ampl.get_set(name).set_values(values)
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":899
 *                 self.ampl.get_set(name).set_values(values)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_sets()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_7__iter__ = {"__iter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_7__iter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_4_set_4Sets_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 899, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 899, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__iter__", 0) < 0) __PYX_ERR(0, 899, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, i); __PYX_ERR(0, 899, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 899, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 899, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_6__iter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_4_set_4Sets_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/ampl.pyx":900
 * 
 *             def __iter__(self):
 *                 return self.ampl.get_sets()             # <<<<<<<<<<<<<<
 * 
 *         return Sets(self)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_sets, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":899
 *                 self.ampl.get_set(name).set_values(values)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_sets()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set.Sets.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":884
 *         return Objectives(self)
 * 
 *     def _set(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a set.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_78_set(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_v_Sets = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set", 0);

  /* "amplpy/ampl.pyx":889
 *         """
 * 
 *         class Sets(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_1 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[10]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_mstate_global->__pyx_n_u_Sets, __pyx_mstate_global->__pyx_n_u_set_locals_Sets, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_1 != __pyx_mstate_global->__pyx_tuple[10]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[10]) < 0))) __PYX_ERR(0, 889, __pyx_L1_error)
  }

  /* "amplpy/ampl.pyx":890
 * 
 *         class Sets(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_1__init__, 0, __pyx_mstate_global->__pyx_n_u_set_locals_Sets___init, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_4) < 0) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":893
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_set(name)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_3__getitem__, 0, __pyx_mstate_global->__pyx_n_u_set_locals_Sets___getitem, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 893, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":896
 *                 return self.ampl.get_set(name)
 * 
 *             def __setitem__(self, name, values):             # <<<<<<<<<<<<<<
 *                 self.ampl.get_set(name).set_values(values)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_5__setitem__, 0, __pyx_mstate_global->__pyx_n_u_set_locals_Sets___setitem, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setitem, __pyx_t_4) < 0) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":899
 *                 self.ampl.get_set(name).set_values(values)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_sets()
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_4_set_4Sets_7__iter__, 0, __pyx_mstate_global->__pyx_n_u_set_locals_Sets___iter, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_iter, __pyx_t_4) < 0) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":889
 *         """
 * 
 *         class Sets(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Sets, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_Sets = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":902
 *                 return self.ampl.get_sets()
 * 
 *         return Sets(self)             # <<<<<<<<<<<<<<
 * 
 *     def _param(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_v_Sets, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":884
 *         return Objectives(self)
 * 
 *     def _set(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a set.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Sets);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":904
 *         return Sets(self)
 * 
 *     def _param(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a parameter.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_81_param(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_80_param, "AMPL._param(self)\nGet/Set a parameter.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_81_param = {"_param", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_81_param, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_80_param};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_81_param(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_param (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_param", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_param", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_80_param(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":910
 * 
 *         class Parameters(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_ampl = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_ampl,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 910, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 910, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 910, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 910, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 910, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 910, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 910, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_ampl = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 910, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters___init__(__pyx_self, __pyx_v_self, __pyx_v_ampl);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/ampl.pyx":911
 *         class Parameters(object):
 *             def __init__(self, ampl):
 *                 self.ampl = ampl             # <<<<<<<<<<<<<<
 * 
 *             def __getitem__(self, name):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl, __pyx_v_ampl) < 0) __PYX_ERR(0, 911, __pyx_L1_error)

  /* "amplpy/ampl.pyx":910
 * 
 *         class Parameters(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":913
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_parameter(name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_3__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_3__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 913, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 913, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 913, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < 0) __PYX_ERR(0, 913, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 913, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 913, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 913, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 913, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/ampl.pyx":914
 * 
 *             def __getitem__(self, name):
 *                 return self.ampl.get_parameter(name)             # <<<<<<<<<<<<<<
 * 
 *             def __setitem__(self, name, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_parameter, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":913
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_parameter(name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":916
 *                 return self.ampl.get_parameter(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, (Real, str)):
 *                     self.ampl.get_parameter(name).set(value)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_5__setitem__ = {"__setitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_5__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 916, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 916, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 916, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 916, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setitem__", 0) < 0) __PYX_ERR(0, 916, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, i); __PYX_ERR(0, 916, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 916, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 916, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 916, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 916, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_4__setitem__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/ampl.pyx":917
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, (Real, str)):             # <<<<<<<<<<<<<<
 *                     self.ampl.get_parameter(name).set(value)
 *                 else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyUnicode_Check(__pyx_v_value); 
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "amplpy/ampl.pyx":918
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, (Real, str)):
 *                     self.ampl.get_parameter(name).set(value)             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.ampl.get_parameter(name).set_values(value)
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_name};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_parameter, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_4 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_value};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":917
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, (Real, str)):             # <<<<<<<<<<<<<<
 *                     self.ampl.get_parameter(name).set(value)
 *                 else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":920
 *                     self.ampl.get_parameter(name).set(value)
 *                 else:
 *                     self.ampl.get_parameter(name).set_values(value)             # <<<<<<<<<<<<<<
 * 
 *             def __iter__(self):
*/
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_name};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_parameter, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_value};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_values, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":916
 *                 return self.ampl.get_parameter(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, (Real, str)):
 *                     self.ampl.get_parameter(name).set(value)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":922
 *                     self.ampl.get_parameter(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_parameters()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_7__iter__ = {"__iter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_7__iter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_6_param_10Parameters_7__iter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 922, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 922, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__iter__", 0) < 0) __PYX_ERR(0, 922, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, i); __PYX_ERR(0, 922, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 922, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__iter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 922, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_6__iter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_6_param_10Parameters_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "amplpy/ampl.pyx":923
 * 
 *             def __iter__(self):
 *                 return self.ampl.get_parameters()             # <<<<<<<<<<<<<<
 * 
 *         return Parameters(self)
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_parameters, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":922
 *                     self.ampl.get_parameter(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_parameters()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param.Parameters.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":904
 *         return Sets(self)
 * 
 *     def _param(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a parameter.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_80_param(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_v_Parameters = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_param", 0);

  /* "amplpy/ampl.pyx":909
 *         """
 * 
 *         class Parameters(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_1 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[12]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_mstate_global->__pyx_n_u_Parameters, __pyx_mstate_global->__pyx_n_u_param_locals_Parameters, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_1 != __pyx_mstate_global->__pyx_tuple[12]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[12]) < 0))) __PYX_ERR(0, 909, __pyx_L1_error)
  }

  /* "amplpy/ampl.pyx":910
 * 
 *         class Parameters(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_1__init__, 0, __pyx_mstate_global->__pyx_n_u_param_locals_Parameters___init, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_4) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":913
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_parameter(name)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_3__getitem__, 0, __pyx_mstate_global->__pyx_n_u_param_locals_Parameters___getit, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":916
 *                 return self.ampl.get_parameter(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, (Real, str)):
 *                     self.ampl.get_parameter(name).set(value)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_5__setitem__, 0, __pyx_mstate_global->__pyx_n_u_param_locals_Parameters___setit, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setitem, __pyx_t_4) < 0) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":922
 *                     self.ampl.get_parameter(name).set_values(value)
 * 
 *             def __iter__(self):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_parameters()
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_6_param_10Parameters_7__iter__, 0, __pyx_mstate_global->__pyx_n_u_param_locals_Parameters___iter, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_iter, __pyx_t_4) < 0) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":909
 *         """
 * 
 *         class Parameters(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Parameters, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_Parameters = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":925
 *                 return self.ampl.get_parameters()
 * 
 *         return Parameters(self)             # <<<<<<<<<<<<<<
 * 
 *     def _option(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_v_Parameters, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":904
 *         return Sets(self)
 * 
 *     def _param(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a parameter.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._param", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Parameters);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":927
 *         return Parameters(self)
 * 
 *     def _option(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set an option.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_83_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_82_option, "AMPL._option(self)\nGet/Set an option.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_83_option = {"_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_83_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_82_option};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_83_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_option (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_option", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_option", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_82_option(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":933
 * 
 *         class Options(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_7_option_7Options_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_ampl = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_ampl,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 933, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 933, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 933, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 933, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 933, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 933, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 933, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_ampl = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 933, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option.Options.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options___init__(__pyx_self, __pyx_v_self, __pyx_v_ampl);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ampl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "amplpy/ampl.pyx":934
 *         class Options(object):
 *             def __init__(self, ampl):
 *                 self.ampl = ampl             # <<<<<<<<<<<<<<
 * 
 *             def __getitem__(self, name):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl, __pyx_v_ampl) < 0) __PYX_ERR(0, 934, __pyx_L1_error)

  /* "amplpy/ampl.pyx":933
 * 
 *         class Options(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option.Options.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":936
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_option(name)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_7_option_7Options_3__getitem__ = {"__getitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_3__getitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_3__getitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 936, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 936, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 936, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__getitem__", 0) < 0) __PYX_ERR(0, 936, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, i); __PYX_ERR(0, 936, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 936, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 936, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 936, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option.Options.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_2__getitem__(__pyx_self, __pyx_v_self, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_2__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "amplpy/ampl.pyx":937
 * 
 *             def __getitem__(self, name):
 *                 return self.ampl.get_option(name)             # <<<<<<<<<<<<<<
 * 
 *             def __setitem__(self, name, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_option, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":936
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_option(name)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option.Options.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":939
 *                 return self.ampl.get_option(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_7_option_7Options_5__setitem__ = {"__setitem__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_5__setitem__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_7_option_7Options_5__setitem__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_value,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 939, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 939, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 939, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 939, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setitem__", 0) < 0) __PYX_ERR(0, 939, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, i); __PYX_ERR(0, 939, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 939, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 939, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 939, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 939, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option.Options.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_4__setitem__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_value);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___2generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/ampl.pyx":942
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.ampl.set_option(name, value)
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_16_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 942, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___2generator12, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_option_locals_Options___setitem, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option.Options.__setitem__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___2generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 942, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 942, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_genexpr_arg_0 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 942, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_genexpr_arg_0, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_k, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_builtins); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_bool); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_v, __pyx_t_9); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_10) {
      __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_cur_scope->__pyx_v_v); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __pyx_t_9;
      __pyx_t_9 = 0;
    } else {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_v);
      __pyx_t_5 = __pyx_cur_scope->__pyx_v_v;
    }
    __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11[0] = __pyx_t_6;
    __pyx_t_11[1] = __pyx_mstate_global->__pyx_kp_u__16;
    __pyx_t_11[2] = __pyx_t_9;
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":939
 *                 return self.ampl.get_option(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_4__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___2generator12 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "amplpy/ampl.pyx":940
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                     if name.endswith("_options"):
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
*/
  __pyx_t_1 = PyDict_Check(__pyx_v_value); 
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":941
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):             # <<<<<<<<<<<<<<
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
 *                 else:
*/
    __pyx_t_3 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_options};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 941, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "amplpy/ampl.pyx":942
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.ampl.set_option(name, value)
*/
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = __pyx_pf_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___genexpr(NULL, __pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_Generator_GetInlinedResult(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__14, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_name, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_option, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/ampl.pyx":941
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):             # <<<<<<<<<<<<<<
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
 *                 else:
*/
    }

    /* "amplpy/ampl.pyx":940
 * 
 *             def __setitem__(self, name, value):
 *                 if isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                     if name.endswith("_options"):
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":944
 *                         self.ampl.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
 *                 else:
 *                     self.ampl.set_option(name, value)             # <<<<<<<<<<<<<<
 * 
 *         return Options(self)
*/
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ampl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_name, __pyx_v_value};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_option, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":939
 *                 return self.ampl.get_option(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option.Options.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_4AMPL_7_option_7Options_11__setitem___2generator12);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":927
 *         return Parameters(self)
 * 
 *     def _option(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set an option.
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_82_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_v_Options = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_option", 0);

  /* "amplpy/ampl.pyx":932
 *         """
 * 
 *         class Options(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_1 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[14]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_mstate_global->__pyx_n_u_Options, __pyx_mstate_global->__pyx_n_u_option_locals_Options, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_1 != __pyx_mstate_global->__pyx_tuple[14]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[14]) < 0))) __PYX_ERR(0, 932, __pyx_L1_error)
  }

  /* "amplpy/ampl.pyx":933
 * 
 *         class Options(object):
 *             def __init__(self, ampl):             # <<<<<<<<<<<<<<
 *                 self.ampl = ampl
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_7_option_7Options_1__init__, 0, __pyx_mstate_global->__pyx_n_u_option_locals_Options___init, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_4) < 0) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":936
 *                 self.ampl = ampl
 * 
 *             def __getitem__(self, name):             # <<<<<<<<<<<<<<
 *                 return self.ampl.get_option(name)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_7_option_7Options_3__getitem__, 0, __pyx_mstate_global->__pyx_n_u_option_locals_Options___getitem, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":939
 *                 return self.ampl.get_option(name)
 * 
 *             def __setitem__(self, name, value):             # <<<<<<<<<<<<<<
 *                 if isinstance(value, dict):
 *                     if name.endswith("_options"):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_7_option_7Options_5__setitem__, 0, __pyx_mstate_global->__pyx_n_u_option_locals_Options___setitem_2, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setitem, __pyx_t_4) < 0) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "amplpy/ampl.pyx":932
 *         """
 * 
 *         class Options(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Options, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_Options = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":946
 *                     self.ampl.set_option(name, value)
 * 
 *         return Options(self)             # <<<<<<<<<<<<<<
 * 
 *     def _set_option(self, options_dict):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_v_Options, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":927
 *         return Parameters(self)
 * 
 *     def _option(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set an option.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._option", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":948
 *         return Options(self)
 * 
 *     def _set_option(self, options_dict):             # <<<<<<<<<<<<<<
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_85_set_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_84_set_option, "AMPL._set_option(self, options_dict)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_85_set_option = {"_set_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_85_set_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_84_set_option};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_85_set_option(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_options_dict = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_option (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_options_dict,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 948, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_set_option", 0) < 0) __PYX_ERR(0, 948, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_set_option", 1, 1, 1, i); __PYX_ERR(0, 948, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 948, __pyx_L3_error)
    }
    __pyx_v_options_dict = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_option", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 948, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_84_set_option(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_options_dict);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_11_set_option_2generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/ampl.pyx":952
 *             if isinstance(value, dict):
 *                 if name.endswith("_options"):
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))             # <<<<<<<<<<<<<<
 *             else:
 *                 self.set_option(name, value)
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_11_set_option_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_17_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 952, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_4AMPL_11_set_option_2generator13, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_set_option_locals_genexpr, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set_option.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_11_set_option_2generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 952, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 952, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_genexpr_arg_0 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 952, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_genexpr_arg_0, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_k);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_k, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_k, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_builtins); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_bool); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_v, __pyx_t_9); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_10) {
      __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_cur_scope->__pyx_v_v); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 952, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __pyx_t_9;
      __pyx_t_9 = 0;
    } else {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_v);
      __pyx_t_5 = __pyx_cur_scope->__pyx_v_v;
    }
    __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11[0] = __pyx_t_6;
    __pyx_t_11[1] = __pyx_mstate_global->__pyx_kp_u__16;
    __pyx_t_11[2] = __pyx_t_9;
    __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 952, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":948
 *         return Options(self)
 * 
 *     def _set_option(self, options_dict):             # <<<<<<<<<<<<<<
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_84_set_option(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_options_dict) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_11_set_option_2generator13 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  size_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_option", 0);

  /* "amplpy/ampl.pyx":949
 * 
 *     def _set_option(self, options_dict):
 *         for name, value in options_dict.items():             # <<<<<<<<<<<<<<
 *             if isinstance(value, dict):
 *                 if name.endswith("_options"):
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_options_dict == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 949, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_options_dict, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "amplpy/ampl.pyx":950
 *     def _set_option(self, options_dict):
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 if name.endswith("_options"):
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
*/
    __pyx_t_8 = PyDict_Check(__pyx_v_value); 
    if (__pyx_t_8) {

      /* "amplpy/ampl.pyx":951
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):
 *                 if name.endswith("_options"):             # <<<<<<<<<<<<<<
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
 *             else:
*/
      __pyx_t_5 = __pyx_v_name;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_9 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_options};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 951, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 951, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_8) {

        /* "amplpy/ampl.pyx":952
 *             if isinstance(value, dict):
 *                 if name.endswith("_options"):
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))             # <<<<<<<<<<<<<<
 *             else:
 *                 self.set_option(name, value)
*/
        __pyx_t_5 = ((PyObject *)__pyx_v_self);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_10 = __pyx_pf_6amplpy_4ampl_4AMPL_11_set_option_genexpr(NULL, __pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 952, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_Generator_GetInlinedResult(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 952, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__14, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 952, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_9 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_name, __pyx_t_10};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_option, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 952, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":951
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):
 *                 if name.endswith("_options"):             # <<<<<<<<<<<<<<
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
 *             else:
*/
      }

      /* "amplpy/ampl.pyx":950
 *     def _set_option(self, options_dict):
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):             # <<<<<<<<<<<<<<
 *                 if name.endswith("_options"):
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
*/
      goto __pyx_L5;
    }

    /* "amplpy/ampl.pyx":954
 *                     self.set_option(name, " ".join(f"{k}={int(v) if isinstance(v, builtins.bool) else v}" for k, v in value.items()))
 *             else:
 *                 self.set_option(name, value)             # <<<<<<<<<<<<<<
 * 
 *     var = property(_var)
*/
    /*else*/ {
      __pyx_t_10 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_10);
      __pyx_t_9 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_v_name, __pyx_v_value};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_option, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 954, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":948
 *         return Options(self)
 * 
 *     def _set_option(self, options_dict):             # <<<<<<<<<<<<<<
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._set_option", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_4AMPL_11_set_option_2generator13);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":963
 *     option = property(_option, _set_option)
 * 
 *     def export_model(self, filename=""):             # <<<<<<<<<<<<<<
 *         """
 *         Create a .mod file with the model that has been loaded.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_87export_model(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_86export_model, "AMPL.export_model(self, filename='')\nCreate a .mod file with the model that has been loaded.\n\nArgs:\n    filename: Path to the file (Relative to the current working\n    directory or absolute).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_87export_model = {"export_model", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_87export_model, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_86export_model};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_87export_model(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("export_model (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 963, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "export_model", 0) < 0) __PYX_ERR(0, 963, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 963, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("export_model", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 963, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.export_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_86export_model(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_86export_model(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_output_c;
  PyObject *__pyx_v_output = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("export_model", 0);

  /* "amplpy/ampl.pyx":973
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 1, 0, 0, &output_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_2 = __pyx_v_filename;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L1_error)
  __pyx_v_errorinfo = AMPL_Snapshot(__pyx_v_self->_c_ampl, __pyx_t_4, 1, 0, 0, (&__pyx_v_output_c));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":974
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 1, 0, 0, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":975
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 1, 0, 0, &output_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 975, __pyx_L1_error)

    /* "amplpy/ampl.pyx":974
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 1, 0, 0, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  }

  /* "amplpy/ampl.pyx":976
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&output_c)
 * 
*/
  __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_output_c); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 976, __pyx_L1_error)
  __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_output_c, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_output = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":977
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)             # <<<<<<<<<<<<<<
 * 
 *         return output
*/
  (void)(AMPL_StringFree((&__pyx_v_output_c)));

  /* "amplpy/ampl.pyx":979
 *         campl.AMPL_StringFree(&output_c)
 * 
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def export_data(self, filename=""):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":963
 *     option = property(_option, _set_option)
 * 
 *     def export_model(self, filename=""):             # <<<<<<<<<<<<<<
 *         """
 *         Create a .mod file with the model that has been loaded.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.export_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":981
 *         return output
 * 
 *     def export_data(self, filename=""):             # <<<<<<<<<<<<<<
 *         """
 *         Create a .dat file with the data that has been loaded.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_89export_data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_88export_data, "AMPL.export_data(self, filename='')\nCreate a .dat file with the data that has been loaded.\n\nArgs:\n    filename: Path to the file (Relative to the current working\n    directory or absolute).");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_89export_data = {"export_data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_89export_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_88export_data};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_89export_data(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("export_data (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 981, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 981, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "export_data", 0) < 0) __PYX_ERR(0, 981, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 981, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("export_data", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 981, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.export_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_88export_data(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_88export_data(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_output_c;
  PyObject *__pyx_v_output = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("export_data", 0);

  /* "amplpy/ampl.pyx":991
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 0, 1, 0, &output_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_2 = __pyx_v_filename;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 991, __pyx_L1_error)
  __pyx_v_errorinfo = AMPL_Snapshot(__pyx_v_self->_c_ampl, __pyx_t_4, 0, 1, 0, (&__pyx_v_output_c));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":992
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 0, 1, 0, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  __pyx_t_5 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_5) {

    /* "amplpy/ampl.pyx":993
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 0, 1, 0, &output_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 993, __pyx_L1_error)

    /* "amplpy/ampl.pyx":992
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), 0, 1, 0, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  }

  /* "amplpy/ampl.pyx":994
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&output_c)
 * 
*/
  __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_output_c); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 994, __pyx_L1_error)
  __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_output_c, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_output = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":995
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)             # <<<<<<<<<<<<<<
 * 
 *         return output
*/
  (void)(AMPL_StringFree((&__pyx_v_output_c)));

  /* "amplpy/ampl.pyx":997
 *         campl.AMPL_StringFree(&output_c)
 * 
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def snapshot(self, filename="", model=True, data=True, options=True):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":981
 *         return output
 * 
 *     def export_data(self, filename=""):             # <<<<<<<<<<<<<<
 *         """
 *         Create a .dat file with the data that has been loaded.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.export_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":999
 *         return output
 * 
 *     def snapshot(self, filename="", model=True, data=True, options=True):             # <<<<<<<<<<<<<<
 *         """
 *         Create a snapshot file that replicates the current session.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_91snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_90snapshot, "AMPL.snapshot(self, filename='', model=True, data=True, options=True)\nCreate a snapshot file that replicates the current session.\n\nArgs:\n    filename: Path to the file (Relative to the current working\n    directory or absolute).\n\n    model: include model declaration if set to ``True``.\n\n    data: include data declaration if set to ``True``.\n\n    options: include options if set to ``True``.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_91snapshot = {"snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_91snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_90snapshot};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_91snapshot(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_model = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("snapshot (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_options_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 999, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "snapshot", 0) < 0) __PYX_ERR(0, 999, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 999, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_filename = values[0];
    __pyx_v_model = values[1];
    __pyx_v_data = values[2];
    __pyx_v_options = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("snapshot", 0, 0, 4, __pyx_nargs); __PYX_ERR(0, 999, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_90snapshot(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename, __pyx_v_model, __pyx_v_data, __pyx_v_options);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_90snapshot(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_model, PyObject *__pyx_v_data, PyObject *__pyx_v_options) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  int __pyx_v_model_c;
  int __pyx_v_data_c;
  int __pyx_v_options_c;
  char *__pyx_v_output_c;
  PyObject *__pyx_v_output = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  char const *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("snapshot", 0);

  /* "amplpy/ampl.pyx":1014
 *         """
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef int model_c = model             # <<<<<<<<<<<<<<
 *         cdef int data_c = data
 *         cdef int options_c = options
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_model); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error)
  __pyx_v_model_c = __pyx_t_1;

  /* "amplpy/ampl.pyx":1015
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef int model_c = model
 *         cdef int data_c = data             # <<<<<<<<<<<<<<
 *         cdef int options_c = options
 *         cdef char* output_c
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_data); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error)
  __pyx_v_data_c = __pyx_t_1;

  /* "amplpy/ampl.pyx":1016
 *         cdef int model_c = model
 *         cdef int data_c = data
 *         cdef int options_c = options             # <<<<<<<<<<<<<<
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), model_c, data_c, options_c, &output_c)
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_options); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1016, __pyx_L1_error)
  __pyx_v_options_c = __pyx_t_1;

  /* "amplpy/ampl.pyx":1018
 *         cdef int options_c = options
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), model_c, data_c, options_c, &output_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_t_3 = __pyx_v_filename;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L1_error)
  __pyx_v_errorinfo = AMPL_Snapshot(__pyx_v_self->_c_ampl, __pyx_t_5, __pyx_v_model_c, __pyx_v_data_c, __pyx_v_options_c, (&__pyx_v_output_c));
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1019
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), model_c, data_c, options_c, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  __pyx_t_6 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_6) {

    /* "amplpy/ampl.pyx":1020
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), model_c, data_c, options_c, &output_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error)

    /* "amplpy/ampl.pyx":1019
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_Snapshot(self._c_ampl, filename.encode('utf-8'), model_c, data_c, options_c, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  }

  /* "amplpy/ampl.pyx":1021
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&output_c)
 * 
*/
  __pyx_t_7 = __Pyx_ssize_strlen(__pyx_v_output_c); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1021, __pyx_L1_error)
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_output_c, 0, __pyx_t_7, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_output = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1022
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)             # <<<<<<<<<<<<<<
 * 
 *         return output
*/
  (void)(AMPL_StringFree((&__pyx_v_output_c)));

  /* "amplpy/ampl.pyx":1024
 *         campl.AMPL_StringFree(&output_c)
 * 
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def write(self, filename, auxfiles=""):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":999
 *         return output
 * 
 *     def snapshot(self, filename="", model=True, data=True, options=True):             # <<<<<<<<<<<<<<
 *         """
 *         Create a snapshot file that replicates the current session.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.snapshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1026
 *         return output
 * 
 *     def write(self, filename, auxfiles=""):             # <<<<<<<<<<<<<<
 *         """
 *         Invoke write command with filename as argument and
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_93write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_92write, "AMPL.write(self, filename, auxfiles='')\nInvoke write command with filename as argument and\nset auxfiles if non-empty.\n\nArgs:\n    filename: outuput filename.\n    auxfiles: auxfiles to export.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_93write = {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_93write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_92write};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_93write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_auxfiles = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,&__pyx_mstate_global->__pyx_n_u_auxfiles,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1026, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1026, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1026, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write", 0) < 0) __PYX_ERR(0, 1026, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, i); __PYX_ERR(0, 1026, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1026, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1026, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
    }
    __pyx_v_filename = values[0];
    __pyx_v_auxfiles = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1026, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_92write(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename, __pyx_v_auxfiles);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_92write(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_auxfiles) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  char const *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "amplpy/ampl.pyx":1035
 *             auxfiles: auxfiles to export.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_Write(self._c_ampl, filename.encode('utf-8'), auxfiles.encode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = __pyx_v_filename;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error)
  __pyx_t_5 = __pyx_v_auxfiles;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_Write(__pyx_v_self->_c_ampl, __pyx_t_4, __pyx_t_6)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1026
 *         return output
 * 
 *     def write(self, filename, auxfiles=""):             # <<<<<<<<<<<<<<
 *         """
 *         Invoke write command with filename as argument and
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1037
 *         PY_AMPL_CALL(campl.AMPL_Write(self._c_ampl, filename.encode('utf-8'), auxfiles.encode('utf-8')))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def solve_result(self):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_12solve_result_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_12solve_result_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_12solve_result___get__(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_12solve_result___get__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "amplpy/ampl.pyx":1060
 *         +---------+-----------+---------------------------------------------+
 *         """
 *         return self.get_value("solve_result")             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_solve_result};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_value, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":1037
 *         PY_AMPL_CALL(campl.AMPL_Write(self._c_ampl, filename.encode('utf-8'), auxfiles.encode('utf-8')))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def solve_result(self):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.solve_result.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1062
 *         return self.get_value("solve_result")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def solve_result_num(self):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_16solve_result_num_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_16solve_result_num_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_16solve_result_num___get__(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_16solve_result_num___get__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "amplpy/ampl.pyx":1085
 *         +---------+-----------+---------------------------------------------+
 *         """
 *         return self.get_value("solve_result_num")             # <<<<<<<<<<<<<<
 * 
 *     def get_iis(self, flat=True):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_solve_result_num};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_value, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":1062
 *         return self.get_value("solve_result")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def solve_result_num(self):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.solve_result_num.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1087
 *         return self.get_value("solve_result_num")
 * 
 *     def get_iis(self, flat=True):             # <<<<<<<<<<<<<<
 *         """
 *         Get IIS attributes for all variables and constraints.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_95get_iis(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_94get_iis, "AMPL.get_iis(self, flat=True)\nGet IIS attributes for all variables and constraints.\n\nArgs:\n    flat: Return flat dictionaries if set to True, or nested dictionaries otherwise.\n\nReturns:\n    Tuple with a dictionary for variables in the IIS and another for the constraints.\n\nUsage example:\n\n.. code-block:: python\n\n    from amplpy import AMPL\n    ampl = AMPL()\n    ampl.eval(\n        r\"\"\"\n    var x >= 0;\n    var y >= 0;\n    maximize obj: x+y;\n    s.t. s: x+y <= -5;\n    \"\"\"\n    )\n    ampl.option[\"presolve\"] = 0  # disable AMPL presolve\n    ampl.solve(solver=\"gurobi\", gurobi_options=\"outlev=1 iis=1\")\n    if ampl.solve_result == \"infeasible\":\n        var_iis, con_iis = ampl.get_iis()\n        print(var_iis, con_iis)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_95get_iis = {"get_iis", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_95get_iis, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_94get_iis};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_95get_iis(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_flat = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_iis (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_flat,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1087, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1087, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_iis", 0) < 0) __PYX_ERR(0, 1087, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1087, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_flat = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_iis", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1087, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_iis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_94get_iis(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_flat);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_94get_iis(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_flat) {
  PyObject *__pyx_v_iis_var = NULL;
  PyObject *__pyx_v_iis_con = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_iis", 0);

  /* "amplpy/ampl.pyx":1117
 *                 print(var_iis, con_iis)
 *         """
 *         iis_var = self.get_data(             # <<<<<<<<<<<<<<
 *             "{i in 1.._nvars: _var[i].iis != 'non'} (_varname[i], _var[i].iis)"
 *         ).to_list(skip_index=True)
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_i_in_1__nvars__var_i_iis_non__v};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_data, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);

  /* "amplpy/ampl.pyx":1119
 *         iis_var = self.get_data(
 *             "{i in 1.._nvars: _var[i].iis != 'non'} (_varname[i], _var[i].iis)"
 *         ).to_list(skip_index=True)             # <<<<<<<<<<<<<<
 *         iis_con = self.get_data(
 *             "{i in 1.._ncons: _con[i].iis != 'non'} (_conname[i], _con[i].iis)"
*/
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_skip_index, Py_True, __pyx_t_4, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_iis_var = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":1120
 *             "{i in 1.._nvars: _var[i].iis != 'non'} (_varname[i], _var[i].iis)"
 *         ).to_list(skip_index=True)
 *         iis_con = self.get_data(             # <<<<<<<<<<<<<<
 *             "{i in 1.._ncons: _con[i].iis != 'non'} (_conname[i], _con[i].iis)"
 *         ).to_list(skip_index=True)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_i_in_1__ncons__con_i_iis_non__c};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_data, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_3 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_3);

  /* "amplpy/ampl.pyx":1122
 *         iis_con = self.get_data(
 *             "{i in 1.._ncons: _con[i].iis != 'non'} (_conname[i], _con[i].iis)"
 *         ).to_list(skip_index=True)             # <<<<<<<<<<<<<<
 *         if flat is False:
 *             iis_var = nested_dict_of_suffixes(iis_var)
*/
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_skip_index, Py_True, __pyx_t_2, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 1122, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_iis_con = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":1123
 *             "{i in 1.._ncons: _con[i].iis != 'non'} (_conname[i], _con[i].iis)"
 *         ).to_list(skip_index=True)
 *         if flat is False:             # <<<<<<<<<<<<<<
 *             iis_var = nested_dict_of_suffixes(iis_var)
 *             iis_con = nested_dict_of_suffixes(iis_con)
*/
  __pyx_t_6 = (__pyx_v_flat == Py_False);
  if (__pyx_t_6) {

    /* "amplpy/ampl.pyx":1124
 *         ).to_list(skip_index=True)
 *         if flat is False:
 *             iis_var = nested_dict_of_suffixes(iis_var)             # <<<<<<<<<<<<<<
 *             iis_con = nested_dict_of_suffixes(iis_con)
 *         else:
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nested_dict_of_suffixes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_iis_var};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_iis_var, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":1125
 *         if flat is False:
 *             iis_var = nested_dict_of_suffixes(iis_var)
 *             iis_con = nested_dict_of_suffixes(iis_con)             # <<<<<<<<<<<<<<
 *         else:
 *             iis_var = dict(iis_var)
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_nested_dict_of_suffixes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_iis_con};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1125, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_iis_con, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":1123
 *             "{i in 1.._ncons: _con[i].iis != 'non'} (_conname[i], _con[i].iis)"
 *         ).to_list(skip_index=True)
 *         if flat is False:             # <<<<<<<<<<<<<<
 *             iis_var = nested_dict_of_suffixes(iis_var)
 *             iis_con = nested_dict_of_suffixes(iis_con)
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":1127
 *             iis_con = nested_dict_of_suffixes(iis_con)
 *         else:
 *             iis_var = dict(iis_var)             # <<<<<<<<<<<<<<
 *             iis_con = dict(iis_con)
 *         return iis_var, iis_con
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF((PyObject *)(&PyDict_Type));
    __pyx_t_2 = ((PyObject *)(&PyDict_Type)); 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_iis_var};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_iis_var, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "amplpy/ampl.pyx":1128
 *         else:
 *             iis_var = dict(iis_var)
 *             iis_con = dict(iis_con)             # <<<<<<<<<<<<<<
 *         return iis_var, iis_con
 * 
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF((PyObject *)(&PyDict_Type));
    __pyx_t_4 = ((PyObject *)(&PyDict_Type)); 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_iis_con};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_iis_con, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":1129
 *             iis_var = dict(iis_var)
 *             iis_con = dict(iis_con)
 *         return iis_var, iis_con             # <<<<<<<<<<<<<<
 * 
 *     def get_solution(self, flat=True, zeros=False):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_iis_var);
  __Pyx_GIVEREF(__pyx_v_iis_var);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_iis_var) != (0)) __PYX_ERR(0, 1129, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_iis_con);
  __Pyx_GIVEREF(__pyx_v_iis_con);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_iis_con) != (0)) __PYX_ERR(0, 1129, __pyx_L1_error);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":1087
 *         return self.get_value("solve_result_num")
 * 
 *     def get_iis(self, flat=True):             # <<<<<<<<<<<<<<
 *         """
 *         Get IIS attributes for all variables and constraints.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_iis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_iis_var);
  __Pyx_XDECREF(__pyx_v_iis_con);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1131
 *         return iis_var, iis_con
 * 
 *     def get_solution(self, flat=True, zeros=False):             # <<<<<<<<<<<<<<
 *         """
 *         Get solution values for all variables.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_97get_solution(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_96get_solution, "AMPL.get_solution(self, flat=True, zeros=False)\nGet solution values for all variables.\n\nArgs:\n    flat: Return a flat dictionary if set to True, or a nested dictionary otherwise.\n\n    zeros: Include zeros in the solution if set to True.\n\nReturns:\n    Returns a dictionary with the solution.\n\nUsage example:\n\n.. code-block:: python\n\n    ampl.solve(solver=\"gurobi\", gurobi_options=\"outlev=0\")\n    if ampl.solve_result == \"solved\":\n        print(ampl.get_solution())");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_97get_solution = {"get_solution", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_97get_solution, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_96get_solution};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_97get_solution(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_flat = 0;
  PyObject *__pyx_v_zeros = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_solution (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_flat,&__pyx_mstate_global->__pyx_n_u_zeros,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1131, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1131, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1131, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_solution", 0) < 0) __PYX_ERR(0, 1131, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1131, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1131, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_flat = values[0];
    __pyx_v_zeros = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_solution", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 1131, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_solution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_96get_solution(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_flat, __pyx_v_zeros);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_96get_solution(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_flat, PyObject *__pyx_v_zeros) {
  PyObject *__pyx_v_stmt = NULL;
  PyObject *__pyx_v_lst_solution = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_solution", 0);

  /* "amplpy/ampl.pyx":1151
 *                 print(ampl.get_solution())
 *         """
 *         if zeros:             # <<<<<<<<<<<<<<
 *             stmt = "{i in 1.._nvars} (_varname[i], _var[i].val)"
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_zeros); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1151, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1152
 *         """
 *         if zeros:
 *             stmt = "{i in 1.._nvars} (_varname[i], _var[i].val)"             # <<<<<<<<<<<<<<
 *         else:
 *             stmt = "{i in 1.._nvars: _var[i].val != 0} (_varname[i], _var[i].val)"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_i_in_1__nvars__varname_i__var_i);
    __pyx_v_stmt = __pyx_mstate_global->__pyx_kp_u_i_in_1__nvars__varname_i__var_i;

    /* "amplpy/ampl.pyx":1151
 *                 print(ampl.get_solution())
 *         """
 *         if zeros:             # <<<<<<<<<<<<<<
 *             stmt = "{i in 1.._nvars} (_varname[i], _var[i].val)"
 *         else:
*/
    goto __pyx_L3;
  }

  /* "amplpy/ampl.pyx":1154
 *             stmt = "{i in 1.._nvars} (_varname[i], _var[i].val)"
 *         else:
 *             stmt = "{i in 1.._nvars: _var[i].val != 0} (_varname[i], _var[i].val)"             # <<<<<<<<<<<<<<
 *         lst_solution = self.get_data(stmt).to_list(skip_index=True)
 *         if flat:
*/
  /*else*/ {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_i_in_1__nvars__var_i_val_0__var);
    __pyx_v_stmt = __pyx_mstate_global->__pyx_kp_u_i_in_1__nvars__var_i_val_0__var;
  }
  __pyx_L3:;

  /* "amplpy/ampl.pyx":1155
 *         else:
 *             stmt = "{i in 1.._nvars: _var[i].val != 0} (_varname[i], _var[i].val)"
 *         lst_solution = self.get_data(stmt).to_list(skip_index=True)             # <<<<<<<<<<<<<<
 *         if flat:
 *             return dict(lst_solution)
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_stmt};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_data, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_3 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_skip_index, Py_True, __pyx_t_5, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 1155, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_to_list, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v_lst_solution = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1156
 *             stmt = "{i in 1.._nvars: _var[i].val != 0} (_varname[i], _var[i].val)"
 *         lst_solution = self.get_data(stmt).to_list(skip_index=True)
 *         if flat:             # <<<<<<<<<<<<<<
 *             return dict(lst_solution)
 *         return nested_dict_of_suffixes(lst_solution)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flat); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1156, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1157
 *         lst_solution = self.get_data(stmt).to_list(skip_index=True)
 *         if flat:
 *             return dict(lst_solution)             # <<<<<<<<<<<<<<
 *         return nested_dict_of_suffixes(lst_solution)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __Pyx_INCREF((PyObject *)(&PyDict_Type));
    __pyx_t_5 = ((PyObject *)(&PyDict_Type)); 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_lst_solution};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1156
 *             stmt = "{i in 1.._nvars: _var[i].val != 0} (_varname[i], _var[i].val)"
 *         lst_solution = self.get_data(stmt).to_list(skip_index=True)
 *         if flat:             # <<<<<<<<<<<<<<
 *             return dict(lst_solution)
 *         return nested_dict_of_suffixes(lst_solution)
*/
  }

  /* "amplpy/ampl.pyx":1158
 *         if flat:
 *             return dict(lst_solution)
 *         return nested_dict_of_suffixes(lst_solution)             # <<<<<<<<<<<<<<
 * 
 *     def _start_recording(self, filename):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_nested_dict_of_suffixes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_lst_solution};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":1131
 *         return iis_var, iis_con
 * 
 *     def get_solution(self, flat=True, zeros=False):             # <<<<<<<<<<<<<<
 *         """
 *         Get solution values for all variables.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.get_solution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_stmt);
  __Pyx_XDECREF(__pyx_v_lst_solution);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1160
 *         return nested_dict_of_suffixes(lst_solution)
 * 
 *     def _start_recording(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Start recording the session to a file for debug purposes.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_99_start_recording(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_98_start_recording, "AMPL._start_recording(self, filename)\nStart recording the session to a file for debug purposes.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_99_start_recording = {"_start_recording", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_99_start_recording, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_98_start_recording};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_99_start_recording(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_start_recording (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1160, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1160, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_start_recording", 0) < 0) __PYX_ERR(0, 1160, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_start_recording", 1, 1, 1, i); __PYX_ERR(0, 1160, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1160, __pyx_L3_error)
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_start_recording", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1160, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._start_recording", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_98_start_recording(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_98_start_recording(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  char const *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_recording", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "amplpy/ampl.pyx":1164
 *         Start recording the session to a file for debug purposes.
 *         """
 *         filename = str(filename)             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, "_log_file_name", filename.encode('utf-8')))
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log_input_only", 1))
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":1165
 *         """
 *         filename = str(filename)
 *         PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, "_log_file_name", filename.encode('utf-8')))             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log_input_only", 1))
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 1))
*/
  __pyx_t_2 = __pyx_v_filename;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_utf_8};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L1_error)
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetOption(__pyx_v_self->_c_ampl, ((char const *)"_log_file_name"), __pyx_t_4)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":1166
 *         filename = str(filename)
 *         PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, "_log_file_name", filename.encode('utf-8')))
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log_input_only", 1))             # <<<<<<<<<<<<<<
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 1))
 * 
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetDblOption(__pyx_v_self->_c_ampl, ((char const *)"_log_input_only"), 1.0)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1166, __pyx_L1_error)

  /* "amplpy/ampl.pyx":1167
 *         PY_AMPL_CALL(campl.AMPL_SetOption(self._c_ampl, "_log_file_name", filename.encode('utf-8')))
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log_input_only", 1))
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 1))             # <<<<<<<<<<<<<<
 * 
 *     def _stop_recording(self):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetDblOption(__pyx_v_self->_c_ampl, ((char const *)"_log"), 1.0)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1167, __pyx_L1_error)

  /* "amplpy/ampl.pyx":1160
 *         return nested_dict_of_suffixes(lst_solution)
 * 
 *     def _start_recording(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Start recording the session to a file for debug purposes.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._start_recording", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1169
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 1))
 * 
 *     def _stop_recording(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stop recording the session.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_101_stop_recording(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_100_stop_recording, "AMPL._stop_recording(self)\nStop recording the session.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_101_stop_recording = {"_stop_recording", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_101_stop_recording, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_100_stop_recording};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_101_stop_recording(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_stop_recording (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_stop_recording", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_stop_recording", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_100_stop_recording(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_100_stop_recording(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stop_recording", 0);

  /* "amplpy/ampl.pyx":1173
 *         Stop recording the session.
 *         """
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 0))             # <<<<<<<<<<<<<<
 * 
 *     def _load_session(self, filename):
*/
  __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(AMPL_SetDblOption(__pyx_v_self->_c_ampl, ((char const *)"_log"), 0.0)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L1_error)

  /* "amplpy/ampl.pyx":1169
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 1))
 * 
 *     def _stop_recording(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stop recording the session.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL._stop_recording", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1175
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 0))
 * 
 *     def _load_session(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Load a recorded session.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_103_load_session(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_102_load_session, "AMPL._load_session(self, filename)\nLoad a recorded session.");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_103_load_session = {"_load_session", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_103_load_session, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_102_load_session};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_103_load_session(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_load_session (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_filename,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1175, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1175, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_load_session", 0) < 0) __PYX_ERR(0, 1175, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_load_session", 1, 1, 1, i); __PYX_ERR(0, 1175, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1175, __pyx_L3_error)
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_load_session", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1175, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL._load_session", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_102_load_session(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_102_load_session(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  char const *__pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_load_session", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "amplpy/ampl.pyx":1179
 *         Load a recorded session.
 *         """
 *         filename = str(filename)             # <<<<<<<<<<<<<<
 *         try:
 *             self.eval(open(filename).read())
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "amplpy/ampl.pyx":1180
 *         """
 *         filename = str(filename)
 *         try:             # <<<<<<<<<<<<<<
 *             self.eval(open(filename).read())
 *         except RuntimeError as exp:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "amplpy/ampl.pyx":1181
 *         filename = str(filename)
 *         try:
 *             self.eval(open(filename).read())             # <<<<<<<<<<<<<<
 *         except RuntimeError as exp:
 *             print(exp)
*/
      __pyx_t_5 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_9 = NULL;
      __Pyx_INCREF(__pyx_builtin_open);
      __pyx_t_10 = __pyx_builtin_open; 
      __pyx_t_11 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_filename};
        __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1181, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __pyx_t_7 = __pyx_t_8;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_11 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_read, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1181, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_11 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "amplpy/ampl.pyx":1180
 *         """
 *         filename = str(filename)
 *         try:             # <<<<<<<<<<<<<<
 *             self.eval(open(filename).read())
 *         except RuntimeError as exp:
*/
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "amplpy/ampl.pyx":1182
 *         try:
 *             self.eval(open(filename).read())
 *         except RuntimeError as exp:             # <<<<<<<<<<<<<<
 *             print(exp)
 * 
*/
    __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_RuntimeError);
    if (__pyx_t_12) {
      __Pyx_AddTraceback("amplpy.ampl.AMPL._load_session", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 1182, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_exp = __pyx_t_6;
      /*try:*/ {

        /* "amplpy/ampl.pyx":1183
 *             self.eval(open(filename).read())
 *         except RuntimeError as exp:
 *             print(exp)             # <<<<<<<<<<<<<<
 * 
 *     def to_ampls(self, driver, options=None):
*/
        __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_builtin_print);
        __pyx_t_10 = __pyx_builtin_print; 
        __pyx_t_11 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_exp};
          __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1183, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }

      /* "amplpy/ampl.pyx":1182
 *         try:
 *             self.eval(open(filename).read())
 *         except RuntimeError as exp:             # <<<<<<<<<<<<<<
 *             print(exp)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_exp); __pyx_v_exp = 0;
          goto __pyx_L15;
        }
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
          if ( unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __Pyx_XGOTREF(__pyx_t_19);
          __Pyx_XGOTREF(__pyx_t_20);
          __pyx_t_12 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_exp); __pyx_v_exp = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_XGIVEREF(__pyx_t_19);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
          __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
          __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
          goto __pyx_L5_except_error;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "amplpy/ampl.pyx":1180
 *         """
 *         filename = str(filename)
 *         try:             # <<<<<<<<<<<<<<
 *             self.eval(open(filename).read())
 *         except RuntimeError as exp:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L8_try_end:;
  }

  /* "amplpy/ampl.pyx":1175
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 0))
 * 
 *     def _load_session(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Load a recorded session.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("amplpy.ampl.AMPL._load_session", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1185
 *             print(exp)
 * 
 *     def to_ampls(self, driver, options=None):             # <<<<<<<<<<<<<<
 *         if driver == "gurobi":
 *             try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_105to_ampls(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_104to_ampls, "AMPL.to_ampls(self, driver, options=None)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_105to_ampls = {"to_ampls", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_105to_ampls, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_104to_ampls};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_105to_ampls(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_driver = 0;
  PyObject *__pyx_v_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_ampls (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_driver,&__pyx_mstate_global->__pyx_n_u_options_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1185, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1185, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1185, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_ampls", 0) < 0) __PYX_ERR(0, 1185, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_ampls", 0, 1, 2, i); __PYX_ERR(0, 1185, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1185, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1185, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_driver = values[0];
    __pyx_v_options = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_ampls", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1185, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_104to_ampls(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_driver, __pyx_v_options);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_104to_ampls(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_driver, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_export_gurobi_model = NULL;
  PyObject *__pyx_v_export_cplex_model = NULL;
  PyObject *__pyx_v_export_scip_model = NULL;
  PyObject *__pyx_v_export_copt_model = NULL;
  PyObject *__pyx_v_export_highs_model = NULL;
  PyObject *__pyx_v_export_xpress_model = NULL;
  PyObject *__pyx_v_solver_list = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  PyObject *__pyx_t_13[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_ampls", 0);

  /* "amplpy/ampl.pyx":1186
 * 
 *     def to_ampls(self, driver, options=None):
 *         if driver == "gurobi":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_gurobi import export_gurobi_model
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_driver, __pyx_mstate_global->__pyx_n_u_gurobi, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1186, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1187
 *     def to_ampls(self, driver, options=None):
 *         if driver == "gurobi":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_gurobi import export_gurobi_model
 *             except ImportError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "amplpy/ampl.pyx":1188
 *         if driver == "gurobi":
 *             try:
 *                 from amplpy_gurobi import export_gurobi_model             # <<<<<<<<<<<<<<
 *             except ImportError:
 *                 raise ImportError("amplpy_gurobi package not found")
*/
        __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1188, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_export_gurobi_model);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_export_gurobi_model);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_export_gurobi_model) != (0)) __PYX_ERR(0, 1188, __pyx_L4_error);
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_amplpy_gurobi, __pyx_t_5, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1188, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_export_gurobi_model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1188, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_export_gurobi_model = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":1187
 *     def to_ampls(self, driver, options=None):
 *         if driver == "gurobi":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_gurobi import export_gurobi_model
 *             except ImportError:
*/
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "amplpy/ampl.pyx":1189
 *             try:
 *                 from amplpy_gurobi import export_gurobi_model
 *             except ImportError:             # <<<<<<<<<<<<<<
 *                 raise ImportError("amplpy_gurobi package not found")
 *             return export_gurobi_model(self, options)
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 1189, __pyx_L6_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "amplpy/ampl.pyx":1190
 *                 from amplpy_gurobi import export_gurobi_model
 *             except ImportError:
 *                 raise ImportError("amplpy_gurobi package not found")             # <<<<<<<<<<<<<<
 *             return export_gurobi_model(self, options)
 *         elif driver == "cplex":
*/
        __pyx_t_10 = NULL;
        __Pyx_INCREF(__pyx_builtin_ImportError);
        __pyx_t_11 = __pyx_builtin_ImportError; 
        __pyx_t_12 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_amplpy_gurobi_package_not_found};
          __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1190, __pyx_L6_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1190, __pyx_L6_except_error)
      }
      goto __pyx_L6_except_error;

      /* "amplpy/ampl.pyx":1187
 *     def to_ampls(self, driver, options=None):
 *         if driver == "gurobi":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_gurobi import export_gurobi_model
 *             except ImportError:
*/
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L9_try_end:;
    }

    /* "amplpy/ampl.pyx":1191
 *             except ImportError:
 *                 raise ImportError("amplpy_gurobi package not found")
 *             return export_gurobi_model(self, options)             # <<<<<<<<<<<<<<
 *         elif driver == "cplex":
 *             try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_export_gurobi_model);
    __pyx_t_6 = __pyx_v_export_gurobi_model; 
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_options};
      __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1186
 * 
 *     def to_ampls(self, driver, options=None):
 *         if driver == "gurobi":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_gurobi import export_gurobi_model
*/
  }

  /* "amplpy/ampl.pyx":1192
 *                 raise ImportError("amplpy_gurobi package not found")
 *             return export_gurobi_model(self, options)
 *         elif driver == "cplex":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_cplex import export_cplex_model
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_driver, __pyx_mstate_global->__pyx_n_u_cplex, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1192, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1193
 *             return export_gurobi_model(self, options)
 *         elif driver == "cplex":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_cplex import export_cplex_model
 *             except ImportError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      /*try:*/ {

        /* "amplpy/ampl.pyx":1194
 *         elif driver == "cplex":
 *             try:
 *                 from amplpy_cplex import export_cplex_model             # <<<<<<<<<<<<<<
 *             except ImportError:
 *                 raise ImportError("amplpy_cplex package not found")
*/
        __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1194, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_export_cplex_model);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_export_cplex_model);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_mstate_global->__pyx_n_u_export_cplex_model) != (0)) __PYX_ERR(0, 1194, __pyx_L12_error);
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_amplpy_cplex, __pyx_t_8, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1194, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_export_cplex_model); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1194, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_v_export_cplex_model = __pyx_t_8;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":1193
 *             return export_gurobi_model(self, options)
 *         elif driver == "cplex":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_cplex import export_cplex_model
 *             except ImportError:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L17_try_end;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "amplpy/ampl.pyx":1195
 *             try:
 *                 from amplpy_cplex import export_cplex_model
 *             except ImportError:             # <<<<<<<<<<<<<<
 *                 raise ImportError("amplpy_cplex package not found")
 *             return export_cplex_model(self, options)
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_5) < 0) __PYX_ERR(0, 1195, __pyx_L14_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "amplpy/ampl.pyx":1196
 *                 from amplpy_cplex import export_cplex_model
 *             except ImportError:
 *                 raise ImportError("amplpy_cplex package not found")             # <<<<<<<<<<<<<<
 *             return export_cplex_model(self, options)
 *         elif driver == "scip":
*/
        __pyx_t_11 = NULL;
        __Pyx_INCREF(__pyx_builtin_ImportError);
        __pyx_t_10 = __pyx_builtin_ImportError; 
        __pyx_t_12 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_amplpy_cplex_package_not_found};
          __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L14_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1196, __pyx_L14_except_error)
      }
      goto __pyx_L14_except_error;

      /* "amplpy/ampl.pyx":1193
 *             return export_gurobi_model(self, options)
 *         elif driver == "cplex":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_cplex import export_cplex_model
 *             except ImportError:
*/
      __pyx_L14_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      goto __pyx_L1_error;
      __pyx_L17_try_end:;
    }

    /* "amplpy/ampl.pyx":1197
 *             except ImportError:
 *                 raise ImportError("amplpy_cplex package not found")
 *             return export_cplex_model(self, options)             # <<<<<<<<<<<<<<
 *         elif driver == "scip":
 *             try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = NULL;
    __Pyx_INCREF(__pyx_v_export_cplex_model);
    __pyx_t_6 = __pyx_v_export_cplex_model; 
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_8, ((PyObject *)__pyx_v_self), __pyx_v_options};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1192
 *                 raise ImportError("amplpy_gurobi package not found")
 *             return export_gurobi_model(self, options)
 *         elif driver == "cplex":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_cplex import export_cplex_model
*/
  }

  /* "amplpy/ampl.pyx":1198
 *                 raise ImportError("amplpy_cplex package not found")
 *             return export_cplex_model(self, options)
 *         elif driver == "scip":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_scip import export_scip_model
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_driver, __pyx_mstate_global->__pyx_n_u_scip, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1198, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1199
 *             return export_cplex_model(self, options)
 *         elif driver == "scip":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_scip import export_scip_model
 *             except ImportError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "amplpy/ampl.pyx":1200
 *         elif driver == "scip":
 *             try:
 *                 from amplpy_scip import export_scip_model             # <<<<<<<<<<<<<<
 *             except ImportError:
 *                 raise ImportError("amplpy_scip package not found")
*/
        __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1200, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_export_scip_model);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_export_scip_model);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_export_scip_model) != (0)) __PYX_ERR(0, 1200, __pyx_L20_error);
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_amplpy_scip, __pyx_t_5, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1200, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_export_scip_model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1200, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_export_scip_model = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":1199
 *             return export_cplex_model(self, options)
 *         elif driver == "scip":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_scip import export_scip_model
 *             except ImportError:
*/
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L25_try_end;
      __pyx_L20_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "amplpy/ampl.pyx":1201
 *             try:
 *                 from amplpy_scip import export_scip_model
 *             except ImportError:             # <<<<<<<<<<<<<<
 *                 raise ImportError("amplpy_scip package not found")
 *             return export_scip_model(self, options)
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 1201, __pyx_L22_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "amplpy/ampl.pyx":1202
 *                 from amplpy_scip import export_scip_model
 *             except ImportError:
 *                 raise ImportError("amplpy_scip package not found")             # <<<<<<<<<<<<<<
 *             return export_scip_model(self, options)
 *         elif driver == "copt":
*/
        __pyx_t_10 = NULL;
        __Pyx_INCREF(__pyx_builtin_ImportError);
        __pyx_t_11 = __pyx_builtin_ImportError; 
        __pyx_t_12 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_amplpy_scip_package_not_found};
          __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1202, __pyx_L22_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1202, __pyx_L22_except_error)
      }
      goto __pyx_L22_except_error;

      /* "amplpy/ampl.pyx":1199
 *             return export_cplex_model(self, options)
 *         elif driver == "scip":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_scip import export_scip_model
 *             except ImportError:
*/
      __pyx_L22_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L25_try_end:;
    }

    /* "amplpy/ampl.pyx":1203
 *             except ImportError:
 *                 raise ImportError("amplpy_scip package not found")
 *             return export_scip_model(self, options)             # <<<<<<<<<<<<<<
 *         elif driver == "copt":
 *             try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_export_scip_model);
    __pyx_t_6 = __pyx_v_export_scip_model; 
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_options};
      __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1198
 *                 raise ImportError("amplpy_cplex package not found")
 *             return export_cplex_model(self, options)
 *         elif driver == "scip":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_scip import export_scip_model
*/
  }

  /* "amplpy/ampl.pyx":1204
 *                 raise ImportError("amplpy_scip package not found")
 *             return export_scip_model(self, options)
 *         elif driver == "copt":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_copt import export_copt_model
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_driver, __pyx_mstate_global->__pyx_n_u_copt, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1204, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1205
 *             return export_scip_model(self, options)
 *         elif driver == "copt":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_copt import export_copt_model
 *             except ImportError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      /*try:*/ {

        /* "amplpy/ampl.pyx":1206
 *         elif driver == "copt":
 *             try:
 *                 from amplpy_copt import export_copt_model             # <<<<<<<<<<<<<<
 *             except ImportError:
 *                 raise ImportError("amplpy_copt package not found")
*/
        __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1206, __pyx_L28_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_export_copt_model);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_export_copt_model);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_mstate_global->__pyx_n_u_export_copt_model) != (0)) __PYX_ERR(0, 1206, __pyx_L28_error);
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_amplpy_copt, __pyx_t_8, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L28_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_export_copt_model); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1206, __pyx_L28_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_v_export_copt_model = __pyx_t_8;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":1205
 *             return export_scip_model(self, options)
 *         elif driver == "copt":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_copt import export_copt_model
 *             except ImportError:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L33_try_end;
      __pyx_L28_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "amplpy/ampl.pyx":1207
 *             try:
 *                 from amplpy_copt import export_copt_model
 *             except ImportError:             # <<<<<<<<<<<<<<
 *                 raise ImportError("amplpy_copt package not found")
 *             return export_copt_model(self, options)
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_5) < 0) __PYX_ERR(0, 1207, __pyx_L30_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "amplpy/ampl.pyx":1208
 *                 from amplpy_copt import export_copt_model
 *             except ImportError:
 *                 raise ImportError("amplpy_copt package not found")             # <<<<<<<<<<<<<<
 *             return export_copt_model(self, options)
 *         elif driver == "highs":
*/
        __pyx_t_11 = NULL;
        __Pyx_INCREF(__pyx_builtin_ImportError);
        __pyx_t_10 = __pyx_builtin_ImportError; 
        __pyx_t_12 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_amplpy_copt_package_not_found};
          __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1208, __pyx_L30_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1208, __pyx_L30_except_error)
      }
      goto __pyx_L30_except_error;

      /* "amplpy/ampl.pyx":1205
 *             return export_scip_model(self, options)
 *         elif driver == "copt":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_copt import export_copt_model
 *             except ImportError:
*/
      __pyx_L30_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      goto __pyx_L1_error;
      __pyx_L33_try_end:;
    }

    /* "amplpy/ampl.pyx":1209
 *             except ImportError:
 *                 raise ImportError("amplpy_copt package not found")
 *             return export_copt_model(self, options)             # <<<<<<<<<<<<<<
 *         elif driver == "highs":
 *             try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = NULL;
    __Pyx_INCREF(__pyx_v_export_copt_model);
    __pyx_t_6 = __pyx_v_export_copt_model; 
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_8, ((PyObject *)__pyx_v_self), __pyx_v_options};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1204
 *                 raise ImportError("amplpy_scip package not found")
 *             return export_scip_model(self, options)
 *         elif driver == "copt":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_copt import export_copt_model
*/
  }

  /* "amplpy/ampl.pyx":1210
 *                 raise ImportError("amplpy_copt package not found")
 *             return export_copt_model(self, options)
 *         elif driver == "highs":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_highs import export_highs_model
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_driver, __pyx_mstate_global->__pyx_n_u_highs, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1210, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1211
 *             return export_copt_model(self, options)
 *         elif driver == "highs":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_highs import export_highs_model
 *             except ImportError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "amplpy/ampl.pyx":1212
 *         elif driver == "highs":
 *             try:
 *                 from amplpy_highs import export_highs_model             # <<<<<<<<<<<<<<
 *             except ImportError:
 *                 raise ImportError("amplpy_highs package not found")
*/
        __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1212, __pyx_L36_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_export_highs_model);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_export_highs_model);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_export_highs_model) != (0)) __PYX_ERR(0, 1212, __pyx_L36_error);
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_amplpy_highs, __pyx_t_5, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1212, __pyx_L36_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_export_highs_model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1212, __pyx_L36_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_v_export_highs_model = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":1211
 *             return export_copt_model(self, options)
 *         elif driver == "highs":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_highs import export_highs_model
 *             except ImportError:
*/
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L41_try_end;
      __pyx_L36_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "amplpy/ampl.pyx":1213
 *             try:
 *                 from amplpy_highs import export_highs_model
 *             except ImportError:             # <<<<<<<<<<<<<<
 *                 raise ImportError("amplpy_highs package not found")
 *             return export_highs_model(self, options)
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 1213, __pyx_L38_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_8);

        /* "amplpy/ampl.pyx":1214
 *                 from amplpy_highs import export_highs_model
 *             except ImportError:
 *                 raise ImportError("amplpy_highs package not found")             # <<<<<<<<<<<<<<
 *             return export_highs_model(self, options)
 *         elif driver == "xpress":
*/
        __pyx_t_10 = NULL;
        __Pyx_INCREF(__pyx_builtin_ImportError);
        __pyx_t_11 = __pyx_builtin_ImportError; 
        __pyx_t_12 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_amplpy_highs_package_not_found};
          __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1214, __pyx_L38_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1214, __pyx_L38_except_error)
      }
      goto __pyx_L38_except_error;

      /* "amplpy/ampl.pyx":1211
 *             return export_copt_model(self, options)
 *         elif driver == "highs":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_highs import export_highs_model
 *             except ImportError:
*/
      __pyx_L38_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L41_try_end:;
    }

    /* "amplpy/ampl.pyx":1215
 *             except ImportError:
 *                 raise ImportError("amplpy_highs package not found")
 *             return export_highs_model(self, options)             # <<<<<<<<<<<<<<
 *         elif driver == "xpress":
 *             try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_export_highs_model);
    __pyx_t_6 = __pyx_v_export_highs_model; 
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_options};
      __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1210
 *                 raise ImportError("amplpy_copt package not found")
 *             return export_copt_model(self, options)
 *         elif driver == "highs":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_highs import export_highs_model
*/
  }

  /* "amplpy/ampl.pyx":1216
 *                 raise ImportError("amplpy_highs package not found")
 *             return export_highs_model(self, options)
 *         elif driver == "xpress":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_xpress import export_xpress_model
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_driver, __pyx_mstate_global->__pyx_n_u_xpress, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1216, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1217
 *             return export_highs_model(self, options)
 *         elif driver == "xpress":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_xpress import export_xpress_model
 *             except ImportError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      /*try:*/ {

        /* "amplpy/ampl.pyx":1218
 *         elif driver == "xpress":
 *             try:
 *                 from amplpy_xpress import export_xpress_model             # <<<<<<<<<<<<<<
 *             except ImportError:
 *                 raise ImportError("amplpy_xpress package not found")
*/
        __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1218, __pyx_L44_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_export_xpress_model);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_export_xpress_model);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_mstate_global->__pyx_n_u_export_xpress_model) != (0)) __PYX_ERR(0, 1218, __pyx_L44_error);
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_amplpy_xpress, __pyx_t_8, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1218, __pyx_L44_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_export_xpress_model); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1218, __pyx_L44_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_8);
        __pyx_v_export_xpress_model = __pyx_t_8;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "amplpy/ampl.pyx":1217
 *             return export_highs_model(self, options)
 *         elif driver == "xpress":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_xpress import export_xpress_model
 *             except ImportError:
*/
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L49_try_end;
      __pyx_L44_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "amplpy/ampl.pyx":1219
 *             try:
 *                 from amplpy_xpress import export_xpress_model
 *             except ImportError:             # <<<<<<<<<<<<<<
 *                 raise ImportError("amplpy_xpress package not found")
 *             return export_xpress_model(self, options)
*/
      __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
      if (__pyx_t_7) {
        __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_5) < 0) __PYX_ERR(0, 1219, __pyx_L46_except_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_5);

        /* "amplpy/ampl.pyx":1220
 *                 from amplpy_xpress import export_xpress_model
 *             except ImportError:
 *                 raise ImportError("amplpy_xpress package not found")             # <<<<<<<<<<<<<<
 *             return export_xpress_model(self, options)
 *         solver_list = "copt, cplex, gurobi, highs, scip, xpress"
*/
        __pyx_t_11 = NULL;
        __Pyx_INCREF(__pyx_builtin_ImportError);
        __pyx_t_10 = __pyx_builtin_ImportError; 
        __pyx_t_12 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_amplpy_xpress_package_not_found};
          __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1220, __pyx_L46_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1220, __pyx_L46_except_error)
      }
      goto __pyx_L46_except_error;

      /* "amplpy/ampl.pyx":1217
 *             return export_highs_model(self, options)
 *         elif driver == "xpress":
 *             try:             # <<<<<<<<<<<<<<
 *                 from amplpy_xpress import export_xpress_model
 *             except ImportError:
*/
      __pyx_L46_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      goto __pyx_L1_error;
      __pyx_L49_try_end:;
    }

    /* "amplpy/ampl.pyx":1221
 *             except ImportError:
 *                 raise ImportError("amplpy_xpress package not found")
 *             return export_xpress_model(self, options)             # <<<<<<<<<<<<<<
 *         solver_list = "copt, cplex, gurobi, highs, scip, xpress"
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = NULL;
    __Pyx_INCREF(__pyx_v_export_xpress_model);
    __pyx_t_6 = __pyx_v_export_xpress_model; 
    __pyx_t_12 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_12 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_8, ((PyObject *)__pyx_v_self), __pyx_v_options};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1216
 *                 raise ImportError("amplpy_highs package not found")
 *             return export_highs_model(self, options)
 *         elif driver == "xpress":             # <<<<<<<<<<<<<<
 *             try:
 *                 from amplpy_xpress import export_xpress_model
*/
  }

  /* "amplpy/ampl.pyx":1222
 *                 raise ImportError("amplpy_xpress package not found")
 *             return export_xpress_model(self, options)
 *         solver_list = "copt, cplex, gurobi, highs, scip, xpress"             # <<<<<<<<<<<<<<
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")
 * 
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_copt_cplex_gurobi_highs_scip_xpr);
  __pyx_v_solver_list = __pyx_mstate_global->__pyx_kp_u_copt_cplex_gurobi_highs_scip_xpr;

  /* "amplpy/ampl.pyx":1223
 *             return export_xpress_model(self, options)
 *         solver_list = "copt, cplex, gurobi, highs, scip, xpress"
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")             # <<<<<<<<<<<<<<
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):
*/
  __pyx_t_6 = NULL;
  __Pyx_INCREF(__pyx_builtin_ValueError);
  __pyx_t_8 = __pyx_builtin_ValueError; 
  __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_driver, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_13[0] = __pyx_t_9;
  __pyx_t_13[1] = __pyx_mstate_global->__pyx_kp_u_is_not_supported_please_choose;
  __pyx_t_13[2] = __pyx_v_solver_list;
  __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 39 + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_solver_list), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_solver_list));
  if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_12 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_10};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_ERR(0, 1223, __pyx_L1_error)

  /* "amplpy/ampl.pyx":1185
 *             print(exp)
 * 
 *     def to_ampls(self, driver, options=None):             # <<<<<<<<<<<<<<
 *         if driver == "gurobi":
 *             try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.to_ampls", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_export_gurobi_model);
  __Pyx_XDECREF(__pyx_v_export_cplex_model);
  __Pyx_XDECREF(__pyx_v_export_scip_model);
  __Pyx_XDECREF(__pyx_v_export_copt_model);
  __Pyx_XDECREF(__pyx_v_export_highs_model);
  __Pyx_XDECREF(__pyx_v_export_xpress_model);
  __Pyx_XDECREF(__pyx_v_solver_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1225
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):             # <<<<<<<<<<<<<<
 *         if isinstance(model, dict):
 *             self.eval(
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_107import_ampls_solution(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_106import_ampls_solution, "AMPL.import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_107import_ampls_solution = {"import_ampls_solution", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_107import_ampls_solution, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_106import_ampls_solution};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_107import_ampls_solution(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_model = 0;
  PyObject *__pyx_v_number = 0;
  PyObject *__pyx_v_import_entities = 0;
  PyObject *__pyx_v_keep_files = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("import_ampls_solution (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_number,&__pyx_mstate_global->__pyx_n_u_import_entities,&__pyx_mstate_global->__pyx_n_u_keep_files,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1225, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1225, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1225, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1225, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1225, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "import_ampls_solution", 0) < 0) __PYX_ERR(0, 1225, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("import_ampls_solution", 0, 1, 4, i); __PYX_ERR(0, 1225, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1225, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1225, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1225, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1225, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_model = values[0];
    __pyx_v_number = values[1];
    __pyx_v_import_entities = values[2];
    __pyx_v_keep_files = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("import_ampls_solution", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 1225, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.import_ampls_solution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_106import_ampls_solution(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v_model, __pyx_v_number, __pyx_v_import_entities, __pyx_v_keep_files);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_21import_ampls_solution_2generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "amplpy/ampl.pyx":1229
 *             self.eval(
 *                 "".join(
 *                     "let {} := {};".format(name, value) for name, value in model.items()             # <<<<<<<<<<<<<<
 *                 )
 *             )
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_21import_ampls_solution_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_18_genexpr(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1229, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6amplpy_4ampl_4AMPL_21import_ampls_solution_2generator14, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_import_ampls_solution_locals_gen, __pyx_mstate_global->__pyx_n_u_amplpy_ampl); if (unlikely(!gen)) __PYX_ERR(0, 1229, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.import_ampls_solution.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_21import_ampls_solution_2generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1229, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_genexpr_arg_0 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 1229, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_genexpr_arg_0, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_5 = __pyx_mstate_global->__pyx_kp_u_let;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_name, __pyx_cur_scope->__pyx_v_value};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1229, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1225
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):             # <<<<<<<<<<<<<<
 *         if isinstance(model, dict):
 *             self.eval(
*/

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_106import_ampls_solution(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_number, PyObject *__pyx_v_import_entities, PyObject *__pyx_v_keep_files) {
  PyObject *__pyx_v_shutil = NULL;
  PyObject *__pyx_gb_6amplpy_4ampl_4AMPL_21import_ampls_solution_2generator14 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7[3];
  PyObject *__pyx_t_8[4];
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_ampls_solution", 0);

  /* "amplpy/ampl.pyx":1226
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):
 *         if isinstance(model, dict):             # <<<<<<<<<<<<<<
 *             self.eval(
 *                 "".join(
*/
  __pyx_t_1 = PyDict_Check(__pyx_v_model); 
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1227
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):
 *         if isinstance(model, dict):
 *             self.eval(             # <<<<<<<<<<<<<<
 *                 "".join(
 *                     "let {} := {};".format(name, value) for name, value in model.items()
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_3);

    /* "amplpy/ampl.pyx":1229
 *             self.eval(
 *                 "".join(
 *                     "let {} := {};".format(name, value) for name, value in model.items()             # <<<<<<<<<<<<<<
 *                 )
 *             )
*/
    __pyx_t_4 = __pyx_pf_6amplpy_4ampl_4AMPL_21import_ampls_solution_genexpr(NULL, __pyx_v_model); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "amplpy/ampl.pyx":1228
 *         if isinstance(model, dict):
 *             self.eval(
 *                 "".join(             # <<<<<<<<<<<<<<
 *                     "let {} := {};".format(name, value) for name, value in model.items()
 *                 )
*/
    __pyx_t_5 = __Pyx_Generator_GetInlinedResult(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/ampl.pyx":1232
 *                 )
 *             )
 *             return             # <<<<<<<<<<<<<<
 *         if isinstance(model, str):
 *             if number is None:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1226
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):
 *         if isinstance(model, dict):             # <<<<<<<<<<<<<<
 *             self.eval(
 *                 "".join(
*/
  }

  /* "amplpy/ampl.pyx":1233
 *             )
 *             return
 *         if isinstance(model, str):             # <<<<<<<<<<<<<<
 *             if number is None:
 *                 self.eval(f'solution "{model}.sol";')
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_model); 
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1234
 *             return
 *         if isinstance(model, str):
 *             if number is None:             # <<<<<<<<<<<<<<
 *                 self.eval(f'solution "{model}.sol";')
 *             else:
*/
    __pyx_t_1 = (__pyx_v_number == Py_None);
    if (__pyx_t_1) {

      /* "amplpy/ampl.pyx":1235
 *         if isinstance(model, str):
 *             if number is None:
 *                 self.eval(f'solution "{model}.sol";')             # <<<<<<<<<<<<<<
 *             else:
 *                 self.eval(f'solution "{model}{number}.sol";')
*/
      __pyx_t_4 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_model, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_solution;
      __pyx_t_7[1] = __pyx_t_3;
      __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_sol;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 6, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1235, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/ampl.pyx":1234
 *             return
 *         if isinstance(model, str):
 *             if number is None:             # <<<<<<<<<<<<<<
 *                 self.eval(f'solution "{model}.sol";')
 *             else:
*/
      goto __pyx_L5;
    }

    /* "amplpy/ampl.pyx":1237
 *                 self.eval(f'solution "{model}.sol";')
 *             else:
 *                 self.eval(f'solution "{model}{number}.sol";')             # <<<<<<<<<<<<<<
 *             return
 *         import shutil
*/
    /*else*/ {
      __pyx_t_5 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_model, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_number, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_solution;
      __pyx_t_8[1] = __pyx_t_4;
      __pyx_t_8[2] = __pyx_t_3;
      __pyx_t_8[3] = __pyx_mstate_global->__pyx_kp_u_sol;
      __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 6, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_9};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L5:;

    /* "amplpy/ampl.pyx":1238
 *             else:
 *                 self.eval(f'solution "{model}{number}.sol";')
 *             return             # <<<<<<<<<<<<<<
 *         import shutil
 *         model.write_sol()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "amplpy/ampl.pyx":1233
 *             )
 *             return
 *         if isinstance(model, str):             # <<<<<<<<<<<<<<
 *             if number is None:
 *                 self.eval(f'solution "{model}.sol";')
*/
  }

  /* "amplpy/ampl.pyx":1239
 *                 self.eval(f'solution "{model}{number}.sol";')
 *             return
 *         import shutil             # <<<<<<<<<<<<<<
 *         model.write_sol()
 *         self.eval(f'solution "{model._solfile}";')
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_shutil, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_shutil = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1240
 *             return
 *         import shutil
 *         model.write_sol()             # <<<<<<<<<<<<<<
 *         self.eval(f'solution "{model._solfile}";')
 *         if import_entities:
*/
  __pyx_t_9 = __pyx_v_model;
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_write_sol, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1241
 *         import shutil
 *         model.write_sol()
 *         self.eval(f'solution "{model._solfile}";')             # <<<<<<<<<<<<<<
 *         if import_entities:
 *             self.eval(model.getRecordedEntities())
*/
  __pyx_t_9 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_solfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_solution;
  __pyx_t_7[1] = __pyx_t_3;
  __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__17;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1242
 *         model.write_sol()
 *         self.eval(f'solution "{model._solfile}";')
 *         if import_entities:             # <<<<<<<<<<<<<<
 *             self.eval(model.getRecordedEntities())
 *         if not keep_files:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_import_entities); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1242, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1243
 *         self.eval(f'solution "{model._solfile}";')
 *         if import_entities:
 *             self.eval(model.getRecordedEntities())             # <<<<<<<<<<<<<<
 *         if not keep_files:
 *             shutil.rmtree(model._tmpdir)
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_v_model;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_getRecordedEntities, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1243, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_9};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_eval, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1243, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/ampl.pyx":1242
 *         model.write_sol()
 *         self.eval(f'solution "{model._solfile}";')
 *         if import_entities:             # <<<<<<<<<<<<<<
 *             self.eval(model.getRecordedEntities())
 *         if not keep_files:
*/
  }

  /* "amplpy/ampl.pyx":1244
 *         if import_entities:
 *             self.eval(model.getRecordedEntities())
 *         if not keep_files:             # <<<<<<<<<<<<<<
 *             shutil.rmtree(model._tmpdir)
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_keep_files); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1244, __pyx_L1_error)
  __pyx_t_10 = (!__pyx_t_1);
  if (__pyx_t_10) {

    /* "amplpy/ampl.pyx":1245
 *             self.eval(model.getRecordedEntities())
 *         if not keep_files:
 *             shutil.rmtree(model._tmpdir)             # <<<<<<<<<<<<<<
 * 
 *     def to_string(self):
*/
    __pyx_t_9 = __pyx_v_shutil;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_tmpdir); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_rmtree, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/ampl.pyx":1244
 *         if import_entities:
 *             self.eval(model.getRecordedEntities())
 *         if not keep_files:             # <<<<<<<<<<<<<<
 *             shutil.rmtree(model._tmpdir)
 * 
*/
  }

  /* "amplpy/ampl.pyx":1225
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):             # <<<<<<<<<<<<<<
 *         if isinstance(model, dict):
 *             self.eval(
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.import_ampls_solution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shutil);
  __Pyx_XDECREF(__pyx_gb_6amplpy_4ampl_4AMPL_21import_ampls_solution_2generator14);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1247
 *             shutil.rmtree(model._tmpdir)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_109to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_108to_string, "AMPL.to_string(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_109to_string = {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_109to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_108to_string};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_109to_string(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_string (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_string", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_string", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_108to_string(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_108to_string(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  AMPL_ERRORINFO *__pyx_v_errorinfo;
  char *__pyx_v_output_c;
  PyObject *__pyx_v_output = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_string", 0);

  /* "amplpy/ampl.pyx":1250
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_ToString(self._c_ampl, &output_c)             # <<<<<<<<<<<<<<
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
*/
  __pyx_v_errorinfo = AMPL_ToString(__pyx_v_self->_c_ampl, (&__pyx_v_output_c));

  /* "amplpy/ampl.pyx":1251
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_ToString(self._c_ampl, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  __pyx_t_1 = (__pyx_v_errorinfo != 0);
  if (__pyx_t_1) {

    /* "amplpy/ampl.pyx":1252
 *         errorinfo = campl.AMPL_ToString(self._c_ampl, &output_c)
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)             # <<<<<<<<<<<<<<
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)
*/
    __pyx_f_6amplpy_4ampl_PY_AMPL_CALL(__pyx_v_errorinfo); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1252, __pyx_L1_error)

    /* "amplpy/ampl.pyx":1251
 *         cdef char* output_c
 *         errorinfo = campl.AMPL_ToString(self._c_ampl, &output_c)
 *         if errorinfo:             # <<<<<<<<<<<<<<
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
*/
  }

  /* "amplpy/ampl.pyx":1253
 *         if errorinfo:
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))             # <<<<<<<<<<<<<<
 *         campl.AMPL_StringFree(&output_c)
 * 
*/
  __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_output_c); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1253, __pyx_L1_error)
  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_output_c, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_output = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/ampl.pyx":1254
 *             PY_AMPL_CALL(errorinfo)
 *         output = str(output_c.decode('utf-8'))
 *         campl.AMPL_StringFree(&output_c)             # <<<<<<<<<<<<<<
 * 
 *         return output
*/
  (void)(AMPL_StringFree((&__pyx_v_output_c)));

  /* "amplpy/ampl.pyx":1256
 *         campl.AMPL_StringFree(&output_c)
 * 
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":1247
 *             shutil.rmtree(model._tmpdir)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.to_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "amplpy/ampl.pyx":1258
 *         return output
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_111__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_111__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_110__str__(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_110__str__(struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "amplpy/ampl.pyx":1259
 * 
 *     def __str__(self):
 *         return self.to_string()             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_to_string, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "amplpy/ampl.pyx":1258
 *         return output
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.to_string()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("amplpy.ampl.AMPL.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_113__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_112__reduce_cython__, "AMPL.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_113__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_113__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_112__reduce_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_113__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_112__reduce_cython__(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_112__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__c_ampl_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_115__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4AMPL_114__setstate_cython__, "AMPL.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_4AMPL_115__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_115__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_114__setstate_cython__};
static PyObject *__pyx_pw_6amplpy_4ampl_4AMPL_115__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < 0) __PYX_ERR(8, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(8, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(8, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.AMPL.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4AMPL_114__setstate_cython__(((struct __pyx_obj_6amplpy_4ampl_AMPL *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4AMPL_114__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6amplpy_4ampl_AMPL *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self__c_ampl_cannot_be_converted, 0, 0);
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("amplpy.ampl.AMPL.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_ErrorHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_5__pyx_unpickle_ErrorHandler(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_4__pyx_unpickle_ErrorHandler, "__pyx_unpickle_ErrorHandler(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_5__pyx_unpickle_ErrorHandler = {"__pyx_unpickle_ErrorHandler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_5__pyx_unpickle_ErrorHandler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4__pyx_unpickle_ErrorHandler};
static PyObject *__pyx_pw_6amplpy_4ampl_5__pyx_unpickle_ErrorHandler(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ErrorHandler (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 1, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_ErrorHandler", 0) < 0) __PYX_ERR(8, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ErrorHandler", 1, 3, 3, i); __PYX_ERR(8, 1, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(8, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(8, 1, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(8, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ErrorHandler", 1, 3, 3, __pyx_nargs); __PYX_ERR(8, 1, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_ErrorHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_4__pyx_unpickle_ErrorHandler(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_4__pyx_unpickle_ErrorHandler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ErrorHandler", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[15], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = ErrorHandler.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(8, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = ErrorHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(8, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = ErrorHandler.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = ErrorHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = ErrorHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(8, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_6amplpy_4ampl___pyx_unpickle_ErrorHandler__set_state(((struct __pyx_obj_6amplpy_4ampl_ErrorHandler *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = ErrorHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_ErrorHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_ErrorHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/

static PyObject *__pyx_f_6amplpy_4ampl___pyx_unpickle_ErrorHandler__set_state(struct __pyx_obj_6amplpy_4ampl_ErrorHandler *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ErrorHandler__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(8, 12, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 > 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(8, 13, __pyx_L1_error)
    }
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_ErrorHandler__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_AMPLException(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_7__pyx_unpickle_AMPLException(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_6__pyx_unpickle_AMPLException, "__pyx_unpickle_AMPLException(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_7__pyx_unpickle_AMPLException = {"__pyx_unpickle_AMPLException", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_7__pyx_unpickle_AMPLException, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6__pyx_unpickle_AMPLException};
static PyObject *__pyx_pw_6amplpy_4ampl_7__pyx_unpickle_AMPLException(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_AMPLException (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 1, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_AMPLException", 0) < 0) __PYX_ERR(8, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AMPLException", 1, 3, 3, i); __PYX_ERR(8, 1, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(8, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(8, 1, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(8, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_AMPLException", 1, 3, 3, __pyx_nargs); __PYX_ERR(8, 1, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_AMPLException", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_6__pyx_unpickle_AMPLException(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_6__pyx_unpickle_AMPLException(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_AMPLException", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[15], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = AMPLException.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(8, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = AMPLException.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(8, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = AMPLException.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_AMPLException__set_state(<AMPLException> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = AMPLException.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_AMPLException__set_state(<AMPLException> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = AMPLException.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_AMPLException__set_state(<AMPLException> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_AMPLException__set_state(AMPLException __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(8, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_6amplpy_4ampl___pyx_unpickle_AMPLException__set_state(((struct __pyx_obj_6amplpy_4ampl_AMPLException *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = AMPLException.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_AMPLException__set_state(<AMPLException> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_AMPLException__set_state(<AMPLException> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_AMPLException__set_state(AMPLException __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_AMPLException(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_AMPLException", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_AMPLException__set_state(<AMPLException> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_AMPLException__set_state(AMPLException __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/

static PyObject *__pyx_f_6amplpy_4ampl___pyx_unpickle_AMPLException__set_state(struct __pyx_obj_6amplpy_4ampl_AMPLException *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_AMPLException__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_AMPLException__set_state(AMPLException __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(8, 12, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 > 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_AMPLException__set_state(AMPLException __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(8, 13, __pyx_L1_error)
    }
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_AMPLException__set_state(AMPLException __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_AMPLException__set_state(<AMPLException> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_AMPLException__set_state(AMPLException __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_AMPLException__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_OutputHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_6amplpy_4ampl_9__pyx_unpickle_OutputHandler(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6amplpy_4ampl_8__pyx_unpickle_OutputHandler, "__pyx_unpickle_OutputHandler(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_6amplpy_4ampl_9__pyx_unpickle_OutputHandler = {"__pyx_unpickle_OutputHandler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9__pyx_unpickle_OutputHandler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8__pyx_unpickle_OutputHandler};
static PyObject *__pyx_pw_6amplpy_4ampl_9__pyx_unpickle_OutputHandler(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_OutputHandler (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(8, 1, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 1, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_OutputHandler", 0) < 0) __PYX_ERR(8, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_OutputHandler", 1, 3, 3, i); __PYX_ERR(8, 1, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(8, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(8, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(8, 1, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(8, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_OutputHandler", 1, 3, 3, __pyx_nargs); __PYX_ERR(8, 1, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_OutputHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6amplpy_4ampl_8__pyx_unpickle_OutputHandler(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6amplpy_4ampl_8__pyx_unpickle_OutputHandler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_OutputHandler", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[15], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = OutputHandler.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(8, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = OutputHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(8, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = OutputHandler.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_OutputHandler__set_state(<OutputHandler> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_OutputHandler);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = OutputHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_OutputHandler__set_state(<OutputHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = OutputHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_OutputHandler__set_state(<OutputHandler> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_OutputHandler__set_state(OutputHandler __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(8, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_6amplpy_4ampl___pyx_unpickle_OutputHandler__set_state(((struct __pyx_obj_6amplpy_4ampl_OutputHandler *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
 *     __pyx_result = OutputHandler.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_OutputHandler__set_state(<OutputHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_OutputHandler__set_state(<OutputHandler> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_OutputHandler__set_state(OutputHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_OutputHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_OutputHandler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_OutputHandler__set_state(<OutputHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_OutputHandler__set_state(OutputHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/

static PyObject *__pyx_f_6amplpy_4ampl___pyx_unpickle_OutputHandler__set_state(struct __pyx_obj_6amplpy_4ampl_OutputHandler *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_OutputHandler__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_OutputHandler__set_state(OutputHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(8, 12, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 > 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_OutputHandler__set_state(OutputHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(8, 13, __pyx_L1_error)
    }
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __Pyx_PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_OutputHandler__set_state(OutputHandler __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_OutputHandler__set_state(<OutputHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_OutputHandler__set_state(OutputHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("amplpy.ampl.__pyx_unpickle_OutputHandler__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */
static struct __pyx_vtabstruct_6amplpy_4ampl_Row __pyx_vtable_6amplpy_4ampl_Row;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Row(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Row *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_Row *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_Row;
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_Row(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_Row) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyObject *__pyx_sq_item_6amplpy_4ampl_Row(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Row[] = {
  {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Row_7to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Row_6to_string},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Row_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Row_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Row_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Row_10__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Row_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_Row},
  {Py_sq_item, (void *)__pyx_sq_item_6amplpy_4ampl_Row},
  {Py_mp_subscript, (void *)__pyx_pw_6amplpy_4ampl_3Row_5__getitem__},
  {Py_tp_str, (void *)__pyx_pw_6amplpy_4ampl_3Row_1__str__},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Represents a row in a :class:`~amplpy.DataFrame`.\n    ")},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_3Row_3__iter__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Row},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Row},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Row_spec = {
  "amplpy.ampl.Row",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Row),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_Row_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_Row = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6amplpy_4ampl_Row, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Row = {
  0, /*mp_length*/
  __pyx_pw_6amplpy_4ampl_3Row_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_Row = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Row", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Row), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Row, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_Row, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Row, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6amplpy_4ampl_3Row_1__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    Represents a row in a :class:`~amplpy.DataFrame`.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_3Row_3__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Row, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Row, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Column __pyx_vtable_6amplpy_4ampl_Column;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Column(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Column *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_Column *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_Column;
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_Column(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_Column) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Column[] = {
  {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_5to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_4to_string},
  {"to_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_7to_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_6to_list},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Column_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Column_10__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Column_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_Column},
  {Py_tp_str, (void *)__pyx_pw_6amplpy_4ampl_6Column_1__str__},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Represents a column in a :class:`~amplpy.DataFrame`.\n    ")},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_6Column_3__iter__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Column},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Column},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Column_spec = {
  "amplpy.ampl.Column",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Column),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_Column_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_Column = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Column", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Column), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Column, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6amplpy_4ampl_6Column_1__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    Represents a column in a :class:`~amplpy.DataFrame`.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_6Column_3__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Column, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Column, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_DataFrame __pyx_vtable_6amplpy_4ampl_DataFrame;

static PyObject *__pyx_tp_new_6amplpy_4ampl_DataFrame(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_DataFrame *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_DataFrame;
  if (unlikely(__pyx_pw_6amplpy_4ampl_9DataFrame_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_DataFrame(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_DataFrame) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_9DataFrame_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_DataFrame[] = {
  {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_5to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_4to_string},
  {"_get_num_cols", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_11_get_num_cols, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_10_get_num_cols},
  {"_get_num_rows", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_13_get_num_rows, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_12_get_num_rows},
  {"_get_num_indices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_15_get_num_indices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_14_get_num_indices},
  {"_add_row", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_17_add_row, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_16_add_row},
  {"_add_column", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_19_add_column, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_18_add_column},
  {"_get_column", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_21_get_column, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_20_get_column},
  {"_set_column", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_23_set_column, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_22_set_column},
  {"_get_row", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_25_get_row, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_24_get_row},
  {"_get_row_by_index", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_27_get_row_by_index, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_26_get_row_by_index},
  {"_get_headers", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_29_get_headers, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_28_get_headers},
  {"_set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_31_set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_30_set_values},
  {"to_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_33to_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_32to_dict},
  {"to_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_35to_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_34to_list},
  {"to_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_37to_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_36to_pandas},
  {"from_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_39from_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_38from_dict},
  {"from_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_41from_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_40from_pandas},
  {"from_numpy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_43from_numpy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_42from_numpy},
  {"_from_data_frame_ref", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_45_from_data_frame_ref, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_44_from_data_frame_ref},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_47__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_46__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9DataFrame_49__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9DataFrame_48__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_DataFrame_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_DataFrame},
  {Py_tp_str, (void *)__pyx_pw_6amplpy_4ampl_9DataFrame_7__str__},
  {Py_tp_doc, (void *)PyDoc_STR("\n    A DataFrame object, used to communicate data to and from the AMPL entities.\n\n    .. warning::\n        DataFrame objects should not be instantiated manually. For best performance\n        using Python native types or Pandas DataFrames. The API takes care of the conversion\n        for you in the most efficient way it finds.\n\n    An object of this class can be used to do the following tasks:\n\n    - Assign values to AMPL entities (once the DataFrame is populated, use\n      :func:`~amplpy.AMPL.set_data` to assign its\n      values to the modelling entities in its columns)\n    - Get values from AMPL, decoupling the values from the AMPL entities they\n      originate via\n      :func:`~amplpy.Entity.get_values`.\n\n    A DataFrame object can be created in various ways:\n\n    - Get values from AMPL, decoupling the values from the AMPL entities they originate from\n      (via :func:`~amplpy.Entity.get_values`)\n    - From Pandas dataframes with :func:`~amplpy.DataFrame.from_pandas`\n    - From Numpy matrices with :func:`~amplpy.DataFrame.from_numpy`\n    - From Python dictionaries with :func:`~amplpy.DataFrame.from_dict`\n\n    and can be converted to various object types:\n\n    - Pandas dataframes with :func:`~amplpy.DataFrame.to_pandas`\n    - Python dictionary with :func:`~amplpy.DataFrame.to_dict`\n    - Python list with :func:`~amplpy.DataFrame.to_list`\n    ")},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_9DataFrame_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_DataFrame},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_DataFrame},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_DataFrame_spec = {
  "amplpy.ampl.DataFrame",
  sizeof(struct __pyx_obj_6amplpy_4ampl_DataFrame),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_DataFrame_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_DataFrame = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""DataFrame", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_DataFrame), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_DataFrame, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6amplpy_4ampl_9DataFrame_7__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    A DataFrame object, used to communicate data to and from the AMPL entities.\n\n    .. warning::\n        DataFrame objects should not be instantiated manually. For best performance\n        using Python native types or Pandas DataFrames. The API takes care of the conversion\n        for you in the most efficient way it finds.\n\n    An object of this class can be used to do the following tasks:\n\n    - Assign values to AMPL entities (once the DataFrame is populated, use\n      :func:`~amplpy.AMPL.set_data` to assign its\n      values to the modelling entities in its columns)\n    - Get values from AMPL, decoupling the values from the AMPL entities they\n      originate via\n      :func:`~amplpy.Entity.get_values`.\n\n    A DataFrame object can be created in various ways:\n\n    - Get values from AMPL, decoupling the values from the AMPL entities they originate from\n      (via :func:`~amplpy.Entity.get_values`)\n    - From Pandas dataframes with :func:`~amplpy.DataFrame.from_pandas`\n    - From Numpy matrices with :func:`~amplpy.DataFrame.from_numpy`\n    - From Python dictionaries with :func:`~amplpy.DataFrame.from_dict`\n\n    and can be converted to various object types:\n\n    - Pandas dataframes with :func:`~amplpy.DataFrame.to_pandas`\n    - Python dictionary with :func:`~amplpy.DataFrame.to_dict`\n    - Python list with :func:`~amplpy.DataFrame.to_list`\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_9DataFrame_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_DataFrame, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_DataFrame, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_DataFrameArrow __pyx_vtable_6amplpy_4ampl_DataFrameArrow;

static PyObject *__pyx_tp_new_6amplpy_4ampl_DataFrameArrow(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_DataFrameArrow;
  p->_capsule_schema = Py_None; Py_INCREF(Py_None);
  p->_capsule_array = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6amplpy_4ampl_14DataFrameArrow_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_DataFrameArrow(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *p = (struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_DataFrameArrow) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_14DataFrameArrow_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_capsule_schema);
  Py_CLEAR(p->_capsule_array);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_6amplpy_4ampl_DataFrameArrow(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *p = (struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_capsule_schema) {
    e = (*v)(p->_capsule_schema, a); if (e) return e;
  }
  if (p->_capsule_array) {
    e = (*v)(p->_capsule_array, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl_DataFrameArrow(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *p = (struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *)o;
  tmp = ((PyObject*)p->_capsule_schema);
  p->_capsule_schema = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_capsule_array);
  p->_capsule_array = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_DataFrameArrow[] = {
  {"from_polars", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_5from_polars, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_4from_polars},
  {"from_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_7from_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_6from_pandas},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_14DataFrameArrow_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_14DataFrameArrow_10__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_DataFrameArrow_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_DataFrameArrow},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_DataFrameArrow},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_DataFrameArrow},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_DataFrameArrow},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_DataFrameArrow},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_DataFrameArrow_spec = {
  "amplpy.ampl.DataFrameArrow",
  sizeof(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_DataFrameArrow_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_DataFrameArrow = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""DataFrameArrow", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_DataFrameArrow, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_DataFrameArrow, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_DataFrameArrow, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_DataFrameArrow, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_DataFrameArrow, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Entity __pyx_vtable_6amplpy_4ampl_Entity;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Entity(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Entity *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_Entity *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_Entity;
  p->_ampl = ((struct __pyx_obj_6amplpy_4ampl_AMPL *)Py_None); Py_INCREF(Py_None);
  p->_entity = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_Entity(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl_Entity *p = (struct __pyx_obj_6amplpy_4ampl_Entity *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_Entity) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_6Entity_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_ampl);
  Py_CLEAR(p->_entity);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_6amplpy_4ampl_Entity(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl_Entity *p = (struct __pyx_obj_6amplpy_4ampl_Entity *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_ampl) {
    e = (*v)(((PyObject *)p->_ampl), a); if (e) return e;
  }
  if (p->_entity) {
    e = (*v)(p->_entity, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl_Entity(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl_Entity *p = (struct __pyx_obj_6amplpy_4ampl_Entity *)o;
  tmp = ((PyObject*)p->_ampl);
  p->_ampl = ((struct __pyx_obj_6amplpy_4ampl_AMPL *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_entity);
  p->_entity = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_6amplpy_4ampl_Entity(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Entity[] = {
  {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_3to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_2to_string},
  {"get", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_11get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_10get},
  {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_13find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_12find},
  {"instances", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_15instances, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_14instances},
  {"name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_17name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_16name},
  {"indexarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_19indexarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_18indexarity},
  {"is_scalar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_21is_scalar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_20is_scalar},
  {"num_instances", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_23num_instances, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_22num_instances},
  {"get_indexing_sets", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_25get_indexing_sets, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_24get_indexing_sets},
  {"xref", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_27xref, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_26xref},
  {"get_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_29get_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_28get_values},
  {"to_pandas", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_31to_pandas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_30to_pandas},
  {"to_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_33to_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_32to_dict},
  {"to_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_35to_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_34to_list},
  {"set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_37set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_36set_values},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_39__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_38__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_6Entity_41__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_6Entity_40__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Entity_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_Entity},
  {Py_sq_item, (void *)__pyx_sq_item_6amplpy_4ampl_Entity},
  {Py_mp_subscript, (void *)__pyx_pw_6amplpy_4ampl_6Entity_9__getitem__},
  {Py_tp_str, (void *)__pyx_pw_6amplpy_4ampl_6Entity_5__str__},
  {Py_tp_doc, (void *)PyDoc_STR("\n    An AMPL entity such as a parameter or a variable.\n\n    An entity can either represent a single instance of an AMPL algebraic\n    entity or, if the corresponding declaration has an indexing expression, a\n    mapping from keys to instances. In the derived classes, it has methods to\n    access instance-level properties which can be used in case the represented\n    entity is scalar.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), use the function\n    :func:`~amplpy.Entity.get_values`.\n\n    The algebraic entities which currently have an equivalent class in the API\n    are:\n\n    - Variables (see :class:`~amplpy.Variable`)\n    - Constraints (see :class:`~amplpy.Constraint`)\n    - Objectives (see :class:`~amplpy.Objective`)\n    - Sets (see :class:`~amplpy.Set`)\n    - Parameters (see :class:`~amplpy.Parameter`)\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_Entity},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_Entity},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_6Entity_7__iter__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Entity},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Entity},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Entity_spec = {
  "amplpy.ampl.Entity",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Entity),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_Entity_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_Entity = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6amplpy_4ampl_Entity, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Entity = {
  0, /*mp_length*/
  __pyx_pw_6amplpy_4ampl_6Entity_9__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_Entity = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Entity", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Entity), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Entity, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_Entity, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Entity, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6amplpy_4ampl_6Entity_5__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    An AMPL entity such as a parameter or a variable.\n\n    An entity can either represent a single instance of an AMPL algebraic\n    entity or, if the corresponding declaration has an indexing expression, a\n    mapping from keys to instances. In the derived classes, it has methods to\n    access instance-level properties which can be used in case the represented\n    entity is scalar.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), use the function\n    :func:`~amplpy.Entity.get_values`.\n\n    The algebraic entities which currently have an equivalent class in the API\n    are:\n\n    - Variables (see :class:`~amplpy.Variable`)\n    - Constraints (see :class:`~amplpy.Constraint`)\n    - Objectives (see :class:`~amplpy.Objective`)\n    - Sets (see :class:`~amplpy.Set`)\n    - Parameters (see :class:`~amplpy.Parameter`)\n    "), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_Entity, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_Entity, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_6Entity_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Entity, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Entity, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Constraint __pyx_vtable_6amplpy_4ampl_Constraint;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Constraint(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Constraint *p;
  PyObject *o = __pyx_tp_new_6amplpy_4ampl_Entity(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6amplpy_4ampl_Constraint *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6amplpy_4ampl_Entity*)__pyx_vtabptr_6amplpy_4ampl_Constraint;
  return o;
}

static int __pyx_mp_ass_subscript_6amplpy_4ampl_Constraint(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6amplpy_4ampl_10Constraint_1__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Constraint[] = {
  {"is_logical", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_3is_logical, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_2is_logical},
  {"drop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_5drop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_4drop},
  {"restore", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_7restore, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_6restore},
  {"body", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_9body, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_8body},
  {"astatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_11astatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_10astatus},
  {"defvar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_13defvar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_12defvar},
  {"dinit", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_15dinit, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_14dinit},
  {"dinit0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_17dinit0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_16dinit0},
  {"dual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_19dual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_18dual},
  {"lb", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_21lb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_20lb},
  {"ub", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_23ub, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_22ub},
  {"lbs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_25lbs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_24lbs},
  {"ubs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_27ubs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_26ubs},
  {"ldual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_29ldual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_28ldual},
  {"udual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_31udual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_30udual},
  {"lslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_33lslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_32lslack},
  {"uslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_35uslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_34uslack},
  {"slack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_37slack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_36slack},
  {"sstatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_39sstatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_38sstatus},
  {"status", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_41status, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_40status},
  {"set_dual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_43set_dual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_42set_dual},
  {"val", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_45val, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_44val},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_47__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_46__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_10Constraint_49__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_10Constraint_48__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Constraint_slots[] = {
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_6amplpy_4ampl_Constraint},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Bases: :class:`~amplpy.Entity`.\n\n    This class represents an algebraic or logical constraint. In case the\n    constraint is scalar, its values can be accessed via functions like\n    :func:`~amplpy.Constraint.body` and :func:`~amplpy.Constraint.dual`.\n    All the AMPL suffixes for constraints (see\n    http://www.ampl.com/NEW/suffbuiltin.html)\n    are available through methods of this class with the same name (and methods\n    of ConstraintInstance for indexed constraints).\n\n    Note that, since this class represents both algebraic and logical\n    constraints, some suffixes might not be available for every entity.\n\n    An TypeError is thrown if one of such methods is called for\n    a non-scalar constraint and if a method corresponding to a suffix which is\n    not supported by the type of the constraint is called.\n    A runtime error is thrown if any property of an entity which has been\n    deleted from the underlying interpreter is accessed.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), see\n    :func:`~amplpy.Entity.get_values`\n    and the :class:`~amplpy.DataFrame` class.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_Entity},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_Entity},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Constraint},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Constraint},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Constraint_spec = {
  "amplpy.ampl.Constraint",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Constraint),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_Constraint_slots,
};
#else

static PyMappingMethods __pyx_tp_as_mapping_Constraint = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_9__getitem__, /*mp_subscript*/
  #else
  0, /*mp_subscript*/
  #endif
  __pyx_mp_ass_subscript_6amplpy_4ampl_Constraint, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_Constraint = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Constraint", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Constraint), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Entity, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Constraint, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_5__str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Bases: :class:`~amplpy.Entity`.\n\n    This class represents an algebraic or logical constraint. In case the\n    constraint is scalar, its values can be accessed via functions like\n    :func:`~amplpy.Constraint.body` and :func:`~amplpy.Constraint.dual`.\n    All the AMPL suffixes for constraints (see\n    http://www.ampl.com/NEW/suffbuiltin.html)\n    are available through methods of this class with the same name (and methods\n    of ConstraintInstance for indexed constraints).\n\n    Note that, since this class represents both algebraic and logical\n    constraints, some suffixes might not be available for every entity.\n\n    An TypeError is thrown if one of such methods is called for\n    a non-scalar constraint and if a method corresponding to a suffix which is\n    not supported by the type of the constraint is called.\n    A runtime error is thrown if any property of an entity which has been\n    deleted from the underlying interpreter is accessed.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), see\n    :func:`~amplpy.Entity.get_values`\n    and the :class:`~amplpy.DataFrame` class.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_Entity, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_Entity, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_7__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Constraint, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Constraint, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Environment __pyx_vtable_6amplpy_4ampl_Environment;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Environment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Environment *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_Environment *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_Environment;
  if (unlikely(__pyx_pw_6amplpy_4ampl_11Environment_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_Environment(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_Environment) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_11Environment_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyObject *__pyx_sq_item_6amplpy_4ampl_Environment(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_6amplpy_4ampl_Environment(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6amplpy_4ampl_11Environment_9__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Environment[] = {
  {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_13to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_12to_string},
  {"set_bin_dir", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_15set_bin_dir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_14set_bin_dir},
  {"get_bin_dir", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_17get_bin_dir, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_16get_bin_dir},
  {"set_bin_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_19set_bin_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_18set_bin_name},
  {"get_bin_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_21get_bin_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_20get_bin_name},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_23__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_22__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11Environment_25__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11Environment_24__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Environment_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_Environment},
  {Py_sq_item, (void *)__pyx_sq_item_6amplpy_4ampl_Environment},
  {Py_mp_subscript, (void *)__pyx_pw_6amplpy_4ampl_11Environment_11__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_6amplpy_4ampl_Environment},
  {Py_tp_str, (void *)__pyx_pw_6amplpy_4ampl_11Environment_5__str__},
  {Py_tp_doc, (void *)PyDoc_STR("\n    This class provides access to the environment variables and provides\n    facilities to specify where to load the underlying AMPL interpreter.\n    ")},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_11Environment_7__iter__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Environment},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Environment},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Environment_spec = {
  "amplpy.ampl.Environment",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Environment),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_Environment_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_Environment = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6amplpy_4ampl_Environment, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Environment = {
  0, /*mp_length*/
  __pyx_pw_6amplpy_4ampl_11Environment_11__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_6amplpy_4ampl_Environment, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_Environment = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Environment", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Environment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Environment, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_Environment, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Environment, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6amplpy_4ampl_11Environment_5__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    This class provides access to the environment variables and provides\n    facilities to specify where to load the underlying AMPL interpreter.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_11Environment_7__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Environment, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Environment, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl_ErrorHandler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_ErrorHandler(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_ErrorHandler) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_ErrorHandler[] = {
  {"error", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_1error, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_error},
  {"warning", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_3warning, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_2warning},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_12ErrorHandler_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_12ErrorHandler_6__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_ErrorHandler_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_ErrorHandler},
  {Py_tp_doc, (void *)PyDoc_STR("\n    A basic interface for AMPL error handlers. If an application needs to\n    implement customized error handling, it must implement this interface and\n    then register an instance with the AMPL API using the\n    :func:`~amplpy.AMPL.set_error_handler` method.\n    The underlying AMPL interpreter will then report all errors and warnings\n    through this interface as :class:`~amplpy.AMPLException` objects.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_ErrorHandler},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_ErrorHandler},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_ErrorHandler_spec = {
  "amplpy.ampl.ErrorHandler",
  sizeof(struct __pyx_obj_6amplpy_4ampl_ErrorHandler),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_ErrorHandler_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_ErrorHandler = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""ErrorHandler", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_ErrorHandler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_ErrorHandler, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    A basic interface for AMPL error handlers. If an application needs to\n    implement customized error handling, it must implement this interface and\n    then register an instance with the AMPL API using the\n    :func:`~amplpy.AMPL.set_error_handler` method.\n    The underlying AMPL interpreter will then report all errors and warnings\n    through this interface as :class:`~amplpy.AMPLException` objects.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_ErrorHandler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_ErrorHandler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static int __pyx_tp_traverse_6amplpy_4ampl_AMPLException(PyObject *o, visitproc v, void *a) {
  int e;
  {
    traverseproc traverse = __Pyx_PyType_GetSlot((((PyTypeObject*)PyExc_Exception)), tp_traverse, traverseproc);
    if (!traverse); else { e = traverse(o,v,a); if (e) return e; }
  }
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl_AMPLException(PyObject *o) {
  {
    inquiry clear = __Pyx_PyType_GetSlot((((PyTypeObject*)PyExc_Exception)), tp_clear, inquiry);
    if (clear) clear(o);
  }
  return 0;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_AMPLException[] = {
  {"get_source_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_3get_source_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_2get_source_name},
  {"get_line_number", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_5get_line_number, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_4get_line_number},
  {"get_offset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_7get_offset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_6get_offset},
  {"get_message", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_9get_message, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_8get_message},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_12__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13AMPLException_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13AMPLException_14__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_AMPLException_slots[] = {
  {Py_tp_str, (void *)__pyx_pw_6amplpy_4ampl_13AMPLException_11__str__},
  {Py_tp_doc, (void *)PyDoc_STR("AMPLException(source_name, line_number, offset, message)\nRepresent an exception generated by AMPL.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_AMPLException},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_AMPLException},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_AMPLException},
  {Py_tp_init, (void *)__pyx_pw_6amplpy_4ampl_13AMPLException_1__init__},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_AMPLException_spec = {
  "amplpy.ampl.AMPLException",
  sizeof(struct __pyx_obj_6amplpy_4ampl_AMPLException),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl_AMPLException_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_AMPLException = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""AMPLException", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_AMPLException), /*tp_basicsize*/
  0, /*tp_itemsize*/
  0, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6amplpy_4ampl_13AMPLException_11__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("AMPLException(source_name, line_number, offset, message)\nRepresent an exception generated by AMPL."), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_AMPLException, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_AMPLException, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_AMPLException, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6amplpy_4ampl_13AMPLException_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  0, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_EnvIterator __pyx_vtable_6amplpy_4ampl_EnvIterator;

static PyObject *__pyx_tp_new_6amplpy_4ampl_EnvIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_EnvIterator *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_EnvIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_EnvIterator;
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_EnvIterator(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_EnvIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyObject *__pyx_specialmethod___pyx_pw_6amplpy_4ampl_11EnvIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6amplpy_4ampl_11EnvIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_EnvIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6amplpy_4ampl_11EnvIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11EnvIterator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11EnvIterator_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11EnvIterator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11EnvIterator_6__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_EnvIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_EnvIterator},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_11EnvIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6amplpy_4ampl_11EnvIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_EnvIterator},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_EnvIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_EnvIterator_spec = {
  "amplpy.ampl.EnvIterator",
  sizeof(struct __pyx_obj_6amplpy_4ampl_EnvIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_EnvIterator_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_EnvIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""EnvIterator", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_EnvIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_EnvIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_11EnvIterator_1__iter__, /*tp_iter*/
  __pyx_pw_6amplpy_4ampl_11EnvIterator_3__next__, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_EnvIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_EnvIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_EntityMap __pyx_vtable_6amplpy_4ampl_EntityMap;

static PyObject *__pyx_tp_new_6amplpy_4ampl_EntityMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_EntityMap *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_EntityMap *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_EntityMap;
  p->_ampl = ((struct __pyx_obj_6amplpy_4ampl_AMPL *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_EntityMap(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl_EntityMap *p = (struct __pyx_obj_6amplpy_4ampl_EntityMap *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_EntityMap) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_9EntityMap_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_ampl);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_6amplpy_4ampl_EntityMap(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl_EntityMap *p = (struct __pyx_obj_6amplpy_4ampl_EntityMap *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_ampl) {
    e = (*v)(((PyObject *)p->_ampl), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl_EntityMap(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl_EntityMap *p = (struct __pyx_obj_6amplpy_4ampl_EntityMap *)o;
  tmp = ((PyObject*)p->_ampl);
  p->_ampl = ((struct __pyx_obj_6amplpy_4ampl_AMPL *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_6amplpy_4ampl_EntityMap(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_specialmethod___pyx_pw_6amplpy_4ampl_9EntityMap_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6amplpy_4ampl_9EntityMap_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_EntityMap[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6amplpy_4ampl_9EntityMap_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9EntityMap_9size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9EntityMap_8size},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9EntityMap_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9EntityMap_12__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9EntityMap_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9EntityMap_14__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_EntityMap_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_EntityMap},
  {Py_sq_length, (void *)__pyx_pw_6amplpy_4ampl_9EntityMap_11__len__},
  {Py_sq_item, (void *)__pyx_sq_item_6amplpy_4ampl_EntityMap},
  {Py_mp_length, (void *)__pyx_pw_6amplpy_4ampl_9EntityMap_11__len__},
  {Py_mp_subscript, (void *)__pyx_pw_6amplpy_4ampl_9EntityMap_7__getitem__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_EntityMap},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_EntityMap},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_9EntityMap_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6amplpy_4ampl_9EntityMap_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_EntityMap},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_EntityMap},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_EntityMap_spec = {
  "amplpy.ampl.EntityMap",
  sizeof(struct __pyx_obj_6amplpy_4ampl_EntityMap),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_EntityMap_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_EntityMap = {
  __pyx_pw_6amplpy_4ampl_9EntityMap_11__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6amplpy_4ampl_EntityMap, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_EntityMap = {
  __pyx_pw_6amplpy_4ampl_9EntityMap_11__len__, /*mp_length*/
  __pyx_pw_6amplpy_4ampl_9EntityMap_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_EntityMap = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""EntityMap", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_EntityMap), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_EntityMap, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_EntityMap, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_EntityMap, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_EntityMap, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_EntityMap, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_9EntityMap_3__iter__, /*tp_iter*/
  __pyx_pw_6amplpy_4ampl_9EntityMap_5__next__, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_EntityMap, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_EntityMap, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_InstanceIterator __pyx_vtable_6amplpy_4ampl_InstanceIterator;

static PyObject *__pyx_tp_new_6amplpy_4ampl_InstanceIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_InstanceIterator *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_InstanceIterator;
  p->_ampl = ((struct __pyx_obj_6amplpy_4ampl_AMPL *)Py_None); Py_INCREF(Py_None);
  p->_entity = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_InstanceIterator(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl_InstanceIterator *p = (struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_InstanceIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_16InstanceIterator_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_ampl);
  Py_CLEAR(p->_entity);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_6amplpy_4ampl_InstanceIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl_InstanceIterator *p = (struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_ampl) {
    e = (*v)(((PyObject *)p->_ampl), a); if (e) return e;
  }
  if (p->_entity) {
    e = (*v)(p->_entity, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl_InstanceIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl_InstanceIterator *p = (struct __pyx_obj_6amplpy_4ampl_InstanceIterator *)o;
  tmp = ((PyObject*)p->_ampl);
  p->_ampl = ((struct __pyx_obj_6amplpy_4ampl_AMPL *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_entity);
  p->_entity = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_6amplpy_4ampl_InstanceIterator(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_specialmethod___pyx_pw_6amplpy_4ampl_16InstanceIterator_5__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6amplpy_4ampl_16InstanceIterator_5__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_InstanceIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6amplpy_4ampl_16InstanceIterator_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_16InstanceIterator_9size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_16InstanceIterator_8size},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_16InstanceIterator_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_16InstanceIterator_12__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_16InstanceIterator_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_16InstanceIterator_14__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_InstanceIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_InstanceIterator},
  {Py_sq_length, (void *)__pyx_pw_6amplpy_4ampl_16InstanceIterator_11__len__},
  {Py_sq_item, (void *)__pyx_sq_item_6amplpy_4ampl_InstanceIterator},
  {Py_mp_length, (void *)__pyx_pw_6amplpy_4ampl_16InstanceIterator_11__len__},
  {Py_mp_subscript, (void *)__pyx_pw_6amplpy_4ampl_16InstanceIterator_7__getitem__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_InstanceIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_InstanceIterator},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_16InstanceIterator_3__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6amplpy_4ampl_16InstanceIterator_5__next__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_InstanceIterator},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_InstanceIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_InstanceIterator_spec = {
  "amplpy.ampl.InstanceIterator",
  sizeof(struct __pyx_obj_6amplpy_4ampl_InstanceIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_InstanceIterator_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_InstanceIterator = {
  __pyx_pw_6amplpy_4ampl_16InstanceIterator_11__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6amplpy_4ampl_InstanceIterator, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_InstanceIterator = {
  __pyx_pw_6amplpy_4ampl_16InstanceIterator_11__len__, /*mp_length*/
  __pyx_pw_6amplpy_4ampl_16InstanceIterator_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_InstanceIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""InstanceIterator", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_InstanceIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_InstanceIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_InstanceIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_InstanceIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_InstanceIterator, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_InstanceIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_16InstanceIterator_3__iter__, /*tp_iter*/
  __pyx_pw_6amplpy_4ampl_16InstanceIterator_5__next__, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_InstanceIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_InstanceIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_MemberRangeIterator __pyx_vtable_6amplpy_4ampl_MemberRangeIterator;

static PyObject *__pyx_tp_new_6amplpy_4ampl_MemberRangeIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_MemberRangeIterator;
  p->_entity = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_MemberRangeIterator(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *p = (struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_MemberRangeIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_1__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_entity);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_6amplpy_4ampl_MemberRangeIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *p = (struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_entity) {
    e = (*v)(p->_entity, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl_MemberRangeIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *p = (struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator *)o;
  tmp = ((PyObject*)p->_entity);
  p->_entity = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_6amplpy_4ampl_19MemberRangeIterator_9__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_9__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_MemberRangeIterator[] = {
  {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_3size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_19MemberRangeIterator_2size},
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6amplpy_4ampl_19MemberRangeIterator_9__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_19MemberRangeIterator_10__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_19MemberRangeIterator_12__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_MemberRangeIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_MemberRangeIterator},
  {Py_sq_length, (void *)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_5__len__},
  {Py_mp_length, (void *)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_5__len__},
  {Py_tp_doc, (void *)PyDoc_STR("Iterator for set members.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_MemberRangeIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_MemberRangeIterator},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_7__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6amplpy_4ampl_19MemberRangeIterator_9__next__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_MemberRangeIterator},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_MemberRangeIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_MemberRangeIterator_spec = {
  "amplpy.ampl.MemberRangeIterator",
  sizeof(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_MemberRangeIterator_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_MemberRangeIterator = {
  __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_5__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_MemberRangeIterator = {
  __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_5__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_MemberRangeIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""MemberRangeIterator", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_MemberRangeIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_MemberRangeIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_MemberRangeIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MemberRangeIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("Iterator for set members."), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_MemberRangeIterator, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_MemberRangeIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_7__iter__, /*tp_iter*/
  __pyx_pw_6amplpy_4ampl_19MemberRangeIterator_9__next__, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_MemberRangeIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_MemberRangeIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_ColIterator __pyx_vtable_6amplpy_4ampl_ColIterator;

static PyObject *__pyx_tp_new_6amplpy_4ampl_ColIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_ColIterator *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_ColIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_ColIterator;
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_ColIterator(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_ColIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyObject *__pyx_specialmethod___pyx_pw_6amplpy_4ampl_11ColIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6amplpy_4ampl_11ColIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_ColIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6amplpy_4ampl_11ColIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11ColIterator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11ColIterator_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11ColIterator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11ColIterator_6__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_ColIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_ColIterator},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_11ColIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6amplpy_4ampl_11ColIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_ColIterator},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_ColIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_ColIterator_spec = {
  "amplpy.ampl.ColIterator",
  sizeof(struct __pyx_obj_6amplpy_4ampl_ColIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_ColIterator_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_ColIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""ColIterator", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_ColIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_ColIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_11ColIterator_1__iter__, /*tp_iter*/
  __pyx_pw_6amplpy_4ampl_11ColIterator_3__next__, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_ColIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_ColIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_RowIterator __pyx_vtable_6amplpy_4ampl_RowIterator;

static PyObject *__pyx_tp_new_6amplpy_4ampl_RowIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_RowIterator *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_RowIterator *)o);
  p->__pyx_vtab = __pyx_vtabptr_6amplpy_4ampl_RowIterator;
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_RowIterator(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_RowIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyObject *__pyx_specialmethod___pyx_pw_6amplpy_4ampl_11RowIterator_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_6amplpy_4ampl_11RowIterator_3__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_RowIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_6amplpy_4ampl_11RowIterator_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11RowIterator_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11RowIterator_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_11RowIterator_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_11RowIterator_6__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_RowIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_RowIterator},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_11RowIterator_1__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_6amplpy_4ampl_11RowIterator_3__next__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_RowIterator},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_RowIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_RowIterator_spec = {
  "amplpy.ampl.RowIterator",
  sizeof(struct __pyx_obj_6amplpy_4ampl_RowIterator),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_RowIterator_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_RowIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""RowIterator", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_RowIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_RowIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_11RowIterator_1__iter__, /*tp_iter*/
  __pyx_pw_6amplpy_4ampl_11RowIterator_3__next__, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_RowIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_RowIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Objective __pyx_vtable_6amplpy_4ampl_Objective;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Objective(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Objective *p;
  PyObject *o = __pyx_tp_new_6amplpy_4ampl_Entity(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6amplpy_4ampl_Objective *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6amplpy_4ampl_Entity*)__pyx_vtabptr_6amplpy_4ampl_Objective;
  return o;
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Objective[] = {
  {"value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_1value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_value},
  {"astatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_3astatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_2astatus},
  {"sstatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_5sstatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_4sstatus},
  {"exitcode", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_7exitcode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_6exitcode},
  {"message", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_9message, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_8message},
  {"result", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_11result, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_10result},
  {"drop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_13drop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_12drop},
  {"restore", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_15restore, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_14restore},
  {"minimization", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_17minimization, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_16minimization},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_19__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_18__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Objective_21__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Objective_20__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Objective_slots[] = {
  {Py_tp_doc, (void *)PyDoc_STR("\n    Bases: :class:`~amplpy.Entity`.\n\n    Represents an AMPL objective. Note that, in case of a scalar objective, all\n    the properties (corresponding to AMPL suffixes) of the objective instance\n    can be accessed through methods like :func:`~amplpy.Objective.value`.\n    The methods have the same name of the corresponding AMPL suffixes.\n    See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available\n    suffixes.\n\n    All these methods throw a TypeError if called for a non scalar\n    objective and an RuntimeError if called on an entity which has been deleted\n    in the underlying intepreter.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), see\n    :func:`~amplpy.Entity.get_values`\n    and the :class:`~amplpy.DataFrame` class.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_Entity},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_Entity},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Objective},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Objective},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Objective_spec = {
  "amplpy.ampl.Objective",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Objective),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_Objective_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_Objective = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Objective", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Objective), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Entity, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_5__str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Bases: :class:`~amplpy.Entity`.\n\n    Represents an AMPL objective. Note that, in case of a scalar objective, all\n    the properties (corresponding to AMPL suffixes) of the objective instance\n    can be accessed through methods like :func:`~amplpy.Objective.value`.\n    The methods have the same name of the corresponding AMPL suffixes.\n    See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available\n    suffixes.\n\n    All these methods throw a TypeError if called for a non scalar\n    objective and an RuntimeError if called on an entity which has been deleted\n    in the underlying intepreter.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), see\n    :func:`~amplpy.Entity.get_values`\n    and the :class:`~amplpy.DataFrame` class.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_Entity, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_Entity, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_7__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Objective, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Objective, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl_OutputHandler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_OutputHandler(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_OutputHandler) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_OutputHandler[] = {
  {"output", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13OutputHandler_1output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13OutputHandler_output},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13OutputHandler_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13OutputHandler_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_13OutputHandler_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_13OutputHandler_4__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_OutputHandler_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_OutputHandler},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Interface to handle the outputs from the calls to any\n    function that causes the underlying AMPL interpreter to display a message.\n    If an application needs to\n    implement customised output handling, it must implement this interface and\n    then register an instance with the AMPL API using the\n    :func:`~amplpy.AMPL.set_output_handler`\n    method.\n\n    Note that errors and warnings are not passed through this interface,\n    see :class:`~amplpy.ErrorHandler` for more information.\n    ")},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_OutputHandler},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_OutputHandler},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_OutputHandler_spec = {
  "amplpy.ampl.OutputHandler",
  sizeof(struct __pyx_obj_6amplpy_4ampl_OutputHandler),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6amplpy_4ampl_OutputHandler_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_OutputHandler = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""OutputHandler", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_OutputHandler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_OutputHandler, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  PyDoc_STR("\n    Interface to handle the outputs from the calls to any\n    function that causes the underlying AMPL interpreter to display a message.\n    If an application needs to\n    implement customised output handling, it must implement this interface and\n    then register an instance with the AMPL API using the\n    :func:`~amplpy.AMPL.set_output_handler`\n    method.\n\n    Note that errors and warnings are not passed through this interface,\n    see :class:`~amplpy.ErrorHandler` for more information.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_OutputHandler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_OutputHandler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Parameter __pyx_vtable_6amplpy_4ampl_Parameter;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Parameter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Parameter *p;
  PyObject *o = __pyx_tp_new_6amplpy_4ampl_Entity(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6amplpy_4ampl_Parameter *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6amplpy_4ampl_Entity*)__pyx_vtabptr_6amplpy_4ampl_Parameter;
  return o;
}

static PyObject *__pyx_sq_item_6amplpy_4ampl_Parameter(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_6amplpy_4ampl_Parameter(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6amplpy_4ampl_9Parameter_1__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Parameter[] = {
  {"is_symbolic", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_3is_symbolic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_2is_symbolic},
  {"has_default", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_5has_default, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_4has_default},
  {"value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_9value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_8value},
  {"set", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_11set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_10set},
  {"set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_13set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_12set_values},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_14__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_9Parameter_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_9Parameter_16__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Parameter_slots[] = {
  {Py_sq_item, (void *)__pyx_sq_item_6amplpy_4ampl_Parameter},
  {Py_mp_subscript, (void *)__pyx_pw_6amplpy_4ampl_9Parameter_7__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_6amplpy_4ampl_Parameter},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Represents an AMPL parameter. The values can be float or string (in case of\n    symbolic parameters).\n\n    Data can be assigned to the set using the methods\n    :func:`~amplpy.Parameter.set` and\n    :func:`~amplpy.Parameter.set_values`\n    or using\n    :func:`~amplpy.AMPL.set_data`\n    and an object of class :class:`~amplpy.DataFrame`.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_Entity},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_Entity},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Parameter},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Parameter},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Parameter_spec = {
  "amplpy.ampl.Parameter",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Parameter),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_Parameter_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_Parameter = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6amplpy_4ampl_Parameter, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Parameter = {
  0, /*mp_length*/
  __pyx_pw_6amplpy_4ampl_9Parameter_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_6amplpy_4ampl_Parameter, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_Parameter = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Parameter", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Parameter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Entity, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_Parameter, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Parameter, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_5__str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Represents an AMPL parameter. The values can be float or string (in case of\n    symbolic parameters).\n\n    Data can be assigned to the set using the methods\n    :func:`~amplpy.Parameter.set` and\n    :func:`~amplpy.Parameter.set_values`\n    or using\n    :func:`~amplpy.AMPL.set_data`\n    and an object of class :class:`~amplpy.DataFrame`.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_Entity, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_Entity, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_7__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Parameter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Parameter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Set __pyx_vtable_6amplpy_4ampl_Set;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Set(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Set *p;
  PyObject *o = __pyx_tp_new_6amplpy_4ampl_Entity(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6amplpy_4ampl_Set *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6amplpy_4ampl_Entity*)__pyx_vtabptr_6amplpy_4ampl_Set;
  return o;
}

static int __pyx_mp_ass_subscript_6amplpy_4ampl_Set(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6amplpy_4ampl_3Set_1__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Set[] = {
  {"instances", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_5instances, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_4instances},
  {"arity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_7arity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_6arity},
  {"get_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_9get_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_8get_values},
  {"members", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_11members, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_10members},
  {"size", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_13size, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_12size},
  {"contains", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_15contains, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_14contains},
  {"set_values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_17set_values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_16set_values},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_19__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_18__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_3Set_21__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_3Set_20__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Set_slots[] = {
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_6amplpy_4ampl_Set},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Represents an AMPL set. In case of not indexed sets, this class exposes\n    iterators for accessing its elements. The members of the set are tuples.\n    All these methods throw a TypeError if called for an indexed set.\n\n    In case of indexed sets, you can gain access to the instances using the\n    operator [].\n\n    All the accessors in this class throw an RuntimeError if the instance has\n    been deleted in the underlying AMPL interpreter.\n\n    Data can be assigned to the set using the methods\n    :func:`~amplpy.Set.set_values`\n    (for non-indexed sets only) or using\n    :func:`~amplpy.AMPL.set_data`\n    and an object of class\n    :class:`~amplpy.DataFrame`.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_Entity},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_Entity},
  {Py_tp_iter, (void *)__pyx_pw_6amplpy_4ampl_3Set_3__iter__},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Set},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Set},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Set_spec = {
  "amplpy.ampl.Set",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Set),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_Set_slots,
};
#else

static PyMappingMethods __pyx_tp_as_mapping_Set = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_9__getitem__, /*mp_subscript*/
  #else
  0, /*mp_subscript*/
  #endif
  __pyx_mp_ass_subscript_6amplpy_4ampl_Set, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_Set = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Set", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Set), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Entity, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Set, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_5__str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Represents an AMPL set. In case of not indexed sets, this class exposes\n    iterators for accessing its elements. The members of the set are tuples.\n    All these methods throw a TypeError if called for an indexed set.\n\n    In case of indexed sets, you can gain access to the instances using the\n    operator [].\n\n    All the accessors in this class throw an RuntimeError if the instance has\n    been deleted in the underlying AMPL interpreter.\n\n    Data can be assigned to the set using the methods\n    :func:`~amplpy.Set.set_values`\n    (for non-indexed sets only) or using\n    :func:`~amplpy.AMPL.set_data`\n    and an object of class\n    :class:`~amplpy.DataFrame`.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_Entity, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_Entity, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6amplpy_4ampl_3Set_3__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Set, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Set, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6amplpy_4ampl_Variable __pyx_vtable_6amplpy_4ampl_Variable;

static PyObject *__pyx_tp_new_6amplpy_4ampl_Variable(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_Variable *p;
  PyObject *o = __pyx_tp_new_6amplpy_4ampl_Entity(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6amplpy_4ampl_Variable *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6amplpy_4ampl_Entity*)__pyx_vtabptr_6amplpy_4ampl_Variable;
  return o;
}

static int __pyx_mp_ass_subscript_6amplpy_4ampl_Variable(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6amplpy_4ampl_8Variable_1__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, tp_as_mapping, mp_ass_subscript, objobjargproc);
    if (f)
    return f(o, i, v);
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_Variable[] = {
  {"value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_3value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_2value},
  {"fix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_5fix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_4fix},
  {"unfix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_7unfix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_6unfix},
  {"set_value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_9set_value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_8set_value},
  {"astatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_11astatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_10astatus},
  {"defeqn", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_13defeqn, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_12defeqn},
  {"dual", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_15dual, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_14dual},
  {"init", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_17init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_16init},
  {"init0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_19init0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_18init0},
  {"lb", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_21lb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_20lb},
  {"ub", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_23ub, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_22ub},
  {"lb0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_25lb0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_24lb0},
  {"ub0", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_27ub0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_26ub0},
  {"lb1", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_29lb1, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_28lb1},
  {"ub1", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_31ub1, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_30ub1},
  {"lb2", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_33lb2, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_32lb2},
  {"ub2", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_35ub2, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_34ub2},
  {"lrc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_37lrc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_36lrc},
  {"urc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_39urc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_38urc},
  {"lslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_41lslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_40lslack},
  {"uslack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_43uslack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_42uslack},
  {"rc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_45rc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_44rc},
  {"slack", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_47slack, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_46slack},
  {"sstatus", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_49sstatus, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_48sstatus},
  {"status", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_51status, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_50status},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_53__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_52__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_8Variable_55__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_8Variable_54__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_Variable_slots[] = {
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_6amplpy_4ampl_Variable},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Bases: :class:`~amplpy.Entity`.\n\n    Represents an AMPL decision variable. Note that, in case of a scalar\n    variable, all the properties of the variable instance can be accessed\n    through methods like :func:`~amplpy.Variable.value`. The methods have the\n    same name of the corresponding AMPL suffixes.\n    See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available\n    suffixes.\n\n    All these methods throw a TypeError if called for a non scalar\n    objective and an RuntimeError if called on an entity which has been deleted\n    in the underlying intepreter.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), see\n    :func:`~amplpy.Entity.get_values`\n    and the :class:`~amplpy.DataFrame` class.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_Entity},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_Entity},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_Variable},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_Variable},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_Variable_spec = {
  "amplpy.ampl.Variable",
  sizeof(struct __pyx_obj_6amplpy_4ampl_Variable),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_Variable_slots,
};
#else

static PyMappingMethods __pyx_tp_as_mapping_Variable = {
  0, /*mp_length*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_9__getitem__, /*mp_subscript*/
  #else
  0, /*mp_subscript*/
  #endif
  __pyx_mp_ass_subscript_6amplpy_4ampl_Variable, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6amplpy_4ampl_Variable = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""Variable", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_Variable), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_Entity, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Variable, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_5__str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("\n    Bases: :class:`~amplpy.Entity`.\n\n    Represents an AMPL decision variable. Note that, in case of a scalar\n    variable, all the properties of the variable instance can be accessed\n    through methods like :func:`~amplpy.Variable.value`. The methods have the\n    same name of the corresponding AMPL suffixes.\n    See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available\n    suffixes.\n\n    All these methods throw a TypeError if called for a non scalar\n    objective and an RuntimeError if called on an entity which has been deleted\n    in the underlying intepreter.\n\n    To gain access to all the values in an entity (for all instances and all\n    suffixes for that entities), see\n    :func:`~amplpy.Entity.get_values`\n    and the :class:`~amplpy.DataFrame` class.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_Entity, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_Entity, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_6amplpy_4ampl_6Entity_7__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_Variable, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_Variable, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl_AMPL(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6amplpy_4ampl_AMPL *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_6amplpy_4ampl_AMPL *)o);
  p->_output_handler = Py_None; Py_INCREF(Py_None);
  p->_error_handler = Py_None; Py_INCREF(Py_None);
  p->_error_handler_wrapper = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl_AMPL(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl_AMPL *p = (struct __pyx_obj_6amplpy_4ampl_AMPL *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl_AMPL) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6amplpy_4ampl_4AMPL_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_output_handler);
  Py_CLEAR(p->_error_handler);
  Py_CLEAR(p->_error_handler_wrapper);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_6amplpy_4ampl_AMPL(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl_AMPL *p = (struct __pyx_obj_6amplpy_4ampl_AMPL *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_output_handler) {
    e = (*v)(p->_output_handler, a); if (e) return e;
  }
  if (p->_error_handler) {
    e = (*v)(p->_error_handler, a); if (e) return e;
  }
  if (p->_error_handler_wrapper) {
    e = (*v)(p->_error_handler_wrapper, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl_AMPL(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl_AMPL *p = (struct __pyx_obj_6amplpy_4ampl_AMPL *)o;
  tmp = ((PyObject*)p->_output_handler);
  p->_output_handler = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_error_handler);
  p->_error_handler = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_error_handler_wrapper);
  p->_error_handler_wrapper = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6amplpy_4ampl_4AMPL_solve_result(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6amplpy_4ampl_4AMPL_12solve_result_1__get__(o);
}

static PyObject *__pyx_getprop_6amplpy_4ampl_4AMPL_solve_result_num(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6amplpy_4ampl_4AMPL_16solve_result_num_1__get__(o);
}

static PyMethodDef __pyx_methods_6amplpy_4ampl_AMPL[] = {
  {"get_data", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_5get_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_4get_data},
  {"get_entity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_7get_entity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_6get_entity},
  {"get_variable", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_9get_variable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_8get_variable},
  {"get_constraint", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_11get_constraint, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_10get_constraint},
  {"get_objective", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_13get_objective, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_12get_objective},
  {"get_set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_15get_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_14get_set},
  {"get_parameter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_17get_parameter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_16get_parameter},
  {"eval", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_19eval, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_18eval},
  {"get_output", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_21get_output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_20get_output},
  {"reset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_23reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_22reset},
  {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_25close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_24close},
  {"is_running", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_27is_running, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_26is_running},
  {"solve", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_29solve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_28solve},
  {"cd", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_31cd, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_30cd},
  {"set_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_33set_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_32set_option},
  {"get_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_35get_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_34get_option},
  {"read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_37read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_36read},
  {"read_data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_39read_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_38read_data},
  {"get_value", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_41get_value, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_40get_value},
  {"set_data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_43set_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_42set_data},
  {"set_data_arrow", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_45set_data_arrow, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_44set_data_arrow},
  {"read_table", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_47read_table, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_46read_table},
  {"write_table", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_49write_table, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_48write_table},
  {"display", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_51display, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_50display},
  {"set_output_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_53set_output_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_52set_output_handler},
  {"set_error_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_55set_error_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_54set_error_handler},
  {"get_output_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_57get_output_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_56get_output_handler},
  {"get_error_handler", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_59get_error_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_58get_error_handler},
  {"get_variables", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_61get_variables, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_60get_variables},
  {"get_constraints", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_63get_constraints, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_62get_constraints},
  {"get_objectives", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_65get_objectives, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_64get_objectives},
  {"get_sets", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_67get_sets, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_66get_sets},
  {"get_parameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_69get_parameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_68get_parameters},
  {"get_current_objective", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_71get_current_objective, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_70get_current_objective},
  {"_var", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_73_var, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_72_var},
  {"_con", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_75_con, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_74_con},
  {"_obj", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_77_obj, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_76_obj},
  {"_set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_79_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_78_set},
  {"_param", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_81_param, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_80_param},
  {"_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_83_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_82_option},
  {"_set_option", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_85_set_option, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_84_set_option},
  {"export_model", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_87export_model, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_86export_model},
  {"export_data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_89export_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_88export_data},
  {"snapshot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_91snapshot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_90snapshot},
  {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_93write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_92write},
  {"get_iis", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_95get_iis, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_94get_iis},
  {"get_solution", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_97get_solution, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_96get_solution},
  {"_start_recording", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_99_start_recording, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_98_start_recording},
  {"_stop_recording", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_101_stop_recording, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_100_stop_recording},
  {"_load_session", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_103_load_session, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_102_load_session},
  {"to_ampls", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_105to_ampls, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_104to_ampls},
  {"import_ampls_solution", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_107import_ampls_solution, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_106import_ampls_solution},
  {"to_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_109to_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_108to_string},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_113__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_112__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6amplpy_4ampl_4AMPL_115__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6amplpy_4ampl_4AMPL_114__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6amplpy_4ampl_AMPL[] = {
  {"solve_result", __pyx_getprop_6amplpy_4ampl_4AMPL_solve_result, 0, PyDoc_STR("\n        Return solve_result value, which indicates if the problem has been solved.\n\n        +---------+-----------+---------------------------------------------+\n        | Number  |  String   |           Interpretation                    |\n        +=========+===========+=============================================+\n        |    0-99 |  solved   | Optimal solution found                      |\n        +---------+-----------+---------------------------------------------+\n        | 100-199 |  solved?  | Optimal solution indicated, but error likely|\n        +---------+-----------+---------------------------------------------+\n        | 200-299 | infeasible| Constraints cannot be satisfied             |\n        +---------+-----------+---------------------------------------------+\n        | 300-399 | unbounded | Objective can be improved without limit     |\n        +---------+-----------+---------------------------------------------+\n        | 400-499 |   limit   | Stopped by a limit that you set (such as on |\n        |         |           | iterations)                                 |\n        +---------+-----------+---------------------------------------------+\n        | 500-599 |  failure  | Stopped by an error condition in the solver |\n        |         |           | routines                                    |\n        +---------+-----------+---------------------------------------------+\n        "), 0},
  {"solve_result_num", __pyx_getprop_6amplpy_4ampl_4AMPL_solve_result_num, 0, PyDoc_STR("\n        Return solve_result_num value, which indicates if the problem has been solved.\n\n        +---------+-----------+---------------------------------------------+\n        | Number  |  String   |           Interpretation                    |\n        +=========+===========+=============================================+\n        |    0-99 |  solved   | Optimal solution found                      |\n        +---------+-----------+---------------------------------------------+\n        | 100-199 |  solved?  | Optimal solution indicated, but error likely|\n        +---------+-----------+---------------------------------------------+\n        | 200-299 | infeasible| Constraints cannot be satisfied             |\n        +---------+-----------+---------------------------------------------+\n        | 300-399 | unbounded | Objective can be improved without limit     |\n        +---------+-----------+---------------------------------------------+\n        | 400-499 |   limit   | Stopped by a limit that you set (such as on |\n        |         |           | iterations)                                 |\n        +---------+-----------+---------------------------------------------+\n        | 500-599 |  failure  | Stopped by an error condition in the solver |\n        |         |           | routines                                    |\n        +---------+-----------+---------------------------------------------+\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl_AMPL_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl_AMPL},
  {Py_tp_str, (void *)__pyx_pw_6amplpy_4ampl_4AMPL_111__str__},
  {Py_tp_doc, (void *)PyDoc_STR("AMPL(environment=None)\nAn AMPL translator.\n\nAn object of this class can be used to do the following tasks:\n\n- Run AMPL code. See :func:`~amplpy.AMPL.eval`.\n- Read models and data from files. See :func:`~amplpy.AMPL.read`,\n  :func:`~amplpy.AMPL.read_data`.\n- Solve optimization problems constructed from model and data (see\n  :func:`~amplpy.AMPL.solve`).\n- Access single Elements of an optimization problem. See\n  :func:`~amplpy.AMPL.get_variable`,\n  :func:`~amplpy.AMPL.get_constraint`,\n  :func:`~amplpy.AMPL.get_objective`,\n  :func:`~amplpy.AMPL.get_set`,\n  and :func:`~amplpy.AMPL.get_parameter`.\n- Access lists of available entities of an optimization problem. See\n  :func:`~amplpy.AMPL.get_variables`,\n  :func:`~amplpy.AMPL.get_constraints`,\n  :func:`~amplpy.AMPL.get_objectives`,\n  :func:`~amplpy.AMPL.get_sets`,\n  and :func:`~amplpy.AMPL.get_parameters`.\n\nError handling is two-faced:\n\n- Errors coming from the underlying AMPL translator (e.g. syntax errors and\n  warnings obtained calling the eval method) are handled by\n  the :class:`~amplpy.ErrorHandler` which can be set and get via\n  :func:`~amplpy.AMPL.get_error_handler` and\n  :func:`~amplpy.AMPL.set_error_handler`.\n- Generic errors coming from misusing the API, which are detected in\n  Python, are thrown as exceptions.\n\nThe default implementation of the error handler throws exceptions on errors\nand prints to console on warnings.\n\nThe output of every user interaction with the underlying translator is\nhandled implementing the abstract class :class:`~amplpy.OutputHandler`.\nThe (only) method is called at each block of output from the translator.\nThe current output handler can be accessed and set via\n:func:`~amplpy.AMPL.get_output_handler` and\n:func:`~amplpy.AMPL.set_output_handler`.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl_AMPL},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl_AMPL},
  {Py_tp_methods, (void *)__pyx_methods_6amplpy_4ampl_AMPL},
  {Py_tp_getset, (void *)__pyx_getsets_6amplpy_4ampl_AMPL},
  {Py_tp_init, (void *)__pyx_pw_6amplpy_4ampl_4AMPL_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl_AMPL},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl_AMPL_spec = {
  "amplpy.ampl.AMPL",
  sizeof(struct __pyx_obj_6amplpy_4ampl_AMPL),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6amplpy_4ampl_AMPL_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl_AMPL = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""AMPL", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl_AMPL), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl_AMPL, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6amplpy_4ampl_4AMPL_111__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("AMPL(environment=None)\nAn AMPL translator.\n\nAn object of this class can be used to do the following tasks:\n\n- Run AMPL code. See :func:`~amplpy.AMPL.eval`.\n- Read models and data from files. See :func:`~amplpy.AMPL.read`,\n  :func:`~amplpy.AMPL.read_data`.\n- Solve optimization problems constructed from model and data (see\n  :func:`~amplpy.AMPL.solve`).\n- Access single Elements of an optimization problem. See\n  :func:`~amplpy.AMPL.get_variable`,\n  :func:`~amplpy.AMPL.get_constraint`,\n  :func:`~amplpy.AMPL.get_objective`,\n  :func:`~amplpy.AMPL.get_set`,\n  and :func:`~amplpy.AMPL.get_parameter`.\n- Access lists of available entities of an optimization problem. See\n  :func:`~amplpy.AMPL.get_variables`,\n  :func:`~amplpy.AMPL.get_constraints`,\n  :func:`~amplpy.AMPL.get_objectives`,\n  :func:`~amplpy.AMPL.get_sets`,\n  and :func:`~amplpy.AMPL.get_parameters`.\n\nError handling is two-faced:\n\n- Errors coming from the underlying AMPL translator (e.g. syntax errors and\n  warnings obtained calling the eval method) are handled by\n  the :class:`~amplpy.ErrorHandler` which can be set and get via\n  :func:`~amplpy.AMPL.get_error_handler` and\n  :func:`~amplpy.AMPL.set_error_handler`.\n- Generic errors coming from misusing the API, which are detected in\n  Python, are thrown as exceptions.\n\nThe default implementation of the error handler throws exceptions on errors\nand prints to console on warnings.\n\nThe output of every user interaction with the underlying translator is\nhandled implementing the abstract class :class:`~amplpy.OutputHandler`.\nThe (only) method is called at each block of output from the translator.\nThe current output handler can be accessed and set via\n:func:`~amplpy.AMPL.get_output_handler` and\n:func:`~amplpy.AMPL.set_output_handler`."), /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl_AMPL, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl_AMPL, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6amplpy_4ampl_AMPL, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6amplpy_4ampl_AMPL, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6amplpy_4ampl_4AMPL_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl_AMPL, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct____iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct____iter__[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct____iter__];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct____iter__(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct____iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct____iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct____iter__[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct____iter__++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl___pyx_scope_struct____iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6amplpy_4ampl_DataFrame *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct____iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct____iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct____iter__},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl___pyx_scope_struct____iter__},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct____iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct____iter___spec = {
  "amplpy.ampl.__pyx_scope_struct____iter__",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct____iter___slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct____iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct____iter__", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct____iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct____iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct____iter__, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl___pyx_scope_struct____iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct____iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_1_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_1_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_i);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_1_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_1_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_1_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_1_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_1_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_2_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_2_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_2_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_2_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_2_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_2_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_2_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_2_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_2_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_2_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_2_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_2_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_3_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_3_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_3_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_3_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_3_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_3_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_3_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_4__get_headers(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_4__get_headers > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_4__get_headers[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_4__get_headers];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers));
    (void) PyObject_INIT(o, t);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_4__get_headers(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_4__get_headers) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_4__get_headers < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_4__get_headers[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_4__get_headers++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_4__get_headers},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_4__get_headers},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers_spec = {
  "amplpy.ampl.__pyx_scope_struct_4__get_headers",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_4__get_headers", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_4__get_headers), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_4__get_headers, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_4__get_headers, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_5_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_5_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_5_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_5_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_5_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_5_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_5_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_5_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_5_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_5_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_5_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_6_from_dict(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_6_from_dict > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_6_from_dict[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_6_from_dict];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict));
    (void) PyObject_INIT(o, t);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_6_from_dict(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_6_from_dict) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_6_from_dict < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_6_from_dict[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_6_from_dict++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_6_from_dict},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_6_from_dict},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict_spec = {
  "amplpy.ampl.__pyx_scope_struct_6_from_dict",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_6_from_dict", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_6_from_dict), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_6_from_dict, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_6_from_dict, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_7_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_7_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_7_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_7_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_k);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_7_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_7_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_k) {
    e = (*v)(p->__pyx_v_k, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_7_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_7_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_7_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_7_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_7_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_8_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_8_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_8_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_8_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_8_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_v);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_8_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_8_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_8_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_8_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_8_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_8_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_8_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_8_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_8_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_8_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_8_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_9_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_9_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_9_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_9_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_9_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_9_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_9_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_9_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_9_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_9_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_9_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_9_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_9_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_9_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_9_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_9_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_9_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_9_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_9_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_10_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_10_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_10_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_10_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_10_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_10_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_10_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_10_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_10_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_10_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_10_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_10_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_10_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_10_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_10_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_10_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_11_set_values(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_11_set_values > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_11_set_values[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_11_set_values];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_11_set_values(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_11_set_values) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_cast_value);
  Py_CLEAR(p->__pyx_v_dimen);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_11_set_values < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_11_set_values[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_11_set_values++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_11_set_values(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_cast_value) {
    e = (*v)(p->__pyx_v_cast_value, a); if (e) return e;
  }
  if (p->__pyx_v_dimen) {
    e = (*v)(p->__pyx_v_dimen, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6amplpy_4ampl___pyx_scope_struct_11_set_values(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values *)o;
  tmp = ((PyObject*)p->__pyx_v_cast_value);
  p->__pyx_v_cast_value = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_dimen);
  p->__pyx_v_dimen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_11_set_values},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_11_set_values},
  {Py_tp_clear, (void *)__pyx_tp_clear_6amplpy_4ampl___pyx_scope_struct_11_set_values},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_11_set_values},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values_spec = {
  "amplpy.ampl.__pyx_scope_struct_11_set_values",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_11_set_values", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_11_set_values), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_11_set_values, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_11_set_values, /*tp_traverse*/
  __pyx_tp_clear_6amplpy_4ampl___pyx_scope_struct_11_set_values, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_11_set_values, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_12_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_12_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_12_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_12_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_12_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_12_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_12_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_12_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_12_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_12_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_12_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_12_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_12_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_12_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_12_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_12_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_12_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_12_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_12_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_13_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_13_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_13_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_13_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_13_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_13_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_13_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_13_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_13_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_13_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_13_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_13_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_13_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_13_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_13_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_13_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_13_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_13_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_13_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_14_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_14_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_14_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_14_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_14_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_row);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_14_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_14_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_14_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_row) {
    e = (*v)(p->__pyx_v_row, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_14_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_14_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_14_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_14_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_14_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_14_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_14_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_14_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_14_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_15_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_15_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_15_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_15_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_15_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_15_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_row);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_15_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_15_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_15_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_15_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_row) {
    e = (*v)(p->__pyx_v_row, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_15_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_15_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_15_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_15_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_15_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_15_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_15_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_15_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_15_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_16_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_16_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_16_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_16_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_16_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_16_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_k);
  Py_CLEAR(p->__pyx_v_v);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_16_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_16_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_16_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_16_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_k) {
    e = (*v)(p->__pyx_v_k, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_16_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_16_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_16_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_16_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_16_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_16_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_16_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_16_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_16_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_17_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_17_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_17_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_17_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_17_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_k);
  Py_CLEAR(p->__pyx_v_v);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_17_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_17_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_17_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_17_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_k) {
    e = (*v)(p->__pyx_v_k, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_17_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_17_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_17_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_17_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_17_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_17_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_17_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_17_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_17_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_18_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_18_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_18_genexpr[--__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_18_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_18_genexpr(PyObject *o) {
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_18_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_name);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_18_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_6amplpy_4ampl___pyx_scope_struct_18_genexpr[__pyx_mstate_global->__pyx_freecount_6amplpy_4ampl___pyx_scope_struct_18_genexpr++] = ((struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_18_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_name) {
    e = (*v)(p->__pyx_v_name, a); if (e) return e;
  }
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_18_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_18_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_18_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr_spec = {
  "amplpy.ampl.__pyx_scope_struct_18_genexpr",
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "amplpy.ampl.""__pyx_scope_struct_18_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6amplpy_4ampl___pyx_scope_struct_18_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6amplpy_4ampl___pyx_scope_struct_18_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6amplpy_4ampl___pyx_scope_struct_18_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6amplpy_4ampl___pyx_scope_struct_18_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};
/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_6amplpy_4ampl_Row = &__pyx_vtable_6amplpy_4ampl_Row;
  __pyx_vtable_6amplpy_4ampl_Row.create = (PyObject *(*)(AMPL_DATAFRAME *, size_t))__pyx_f_6amplpy_4ampl_3Row_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Row_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row)) __PYX_ERR(1, 21, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Row_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row) < 0) __PYX_ERR(1, 21, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row = &__pyx_type_6amplpy_4ampl_Row;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row) < 0) __PYX_ERR(1, 21, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row, __pyx_vtabptr_6amplpy_4ampl_Row) < 0) __PYX_ERR(1, 21, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row) < 0) __PYX_ERR(1, 21, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Row, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row) < 0) __PYX_ERR(1, 21, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Row) < 0) __PYX_ERR(1, 21, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Column = &__pyx_vtable_6amplpy_4ampl_Column;
  __pyx_vtable_6amplpy_4ampl_Column.create = (PyObject *(*)(AMPL_DATAFRAME *, size_t))__pyx_f_6amplpy_4ampl_6Column_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Column_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column)) __PYX_ERR(1, 53, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Column_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column) < 0) __PYX_ERR(1, 53, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column = &__pyx_type_6amplpy_4ampl_Column;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column) < 0) __PYX_ERR(1, 53, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column, __pyx_vtabptr_6amplpy_4ampl_Column) < 0) __PYX_ERR(1, 53, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column) < 0) __PYX_ERR(1, 53, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Column, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column) < 0) __PYX_ERR(1, 53, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Column) < 0) __PYX_ERR(1, 53, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_DataFrame = &__pyx_vtable_6amplpy_4ampl_DataFrame;
  __pyx_vtable_6amplpy_4ampl_DataFrame.get_ptr = (AMPL_DATAFRAME *(*)(struct __pyx_obj_6amplpy_4ampl_DataFrame *))__pyx_f_6amplpy_4ampl_9DataFrame_get_ptr;
  __pyx_vtable_6amplpy_4ampl_DataFrame.create = (PyObject *(*)(AMPL_DATAFRAME *))__pyx_f_6amplpy_4ampl_9DataFrame_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_DataFrame_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame)) __PYX_ERR(1, 92, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_DataFrame_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame) < 0) __PYX_ERR(1, 92, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame = &__pyx_type_6amplpy_4ampl_DataFrame;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame) < 0) __PYX_ERR(1, 92, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_vtabptr_6amplpy_4ampl_DataFrame) < 0) __PYX_ERR(1, 92, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame) < 0) __PYX_ERR(1, 92, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DataFrame, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame) < 0) __PYX_ERR(1, 92, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrame) < 0) __PYX_ERR(1, 92, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_DataFrameArrow = &__pyx_vtable_6amplpy_4ampl_DataFrameArrow;
  __pyx_vtable_6amplpy_4ampl_DataFrameArrow.init_from_arrow = (void (*)(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *, struct ArrowSchema *, struct ArrowArray *, int64_t))__pyx_f_6amplpy_4ampl_14DataFrameArrow_init_from_arrow;
  __pyx_vtable_6amplpy_4ampl_DataFrameArrow.get_ptr = (struct AMPL_DATAFRAMEARROW *(*)(struct __pyx_obj_6amplpy_4ampl_DataFrameArrow *))__pyx_f_6amplpy_4ampl_14DataFrameArrow_get_ptr;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_DataFrameArrow_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow)) __PYX_ERR(9, 32, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_DataFrameArrow_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow) < 0) __PYX_ERR(9, 32, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow = &__pyx_type_6amplpy_4ampl_DataFrameArrow;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow) < 0) __PYX_ERR(9, 32, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow, __pyx_vtabptr_6amplpy_4ampl_DataFrameArrow) < 0) __PYX_ERR(9, 32, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow) < 0) __PYX_ERR(9, 32, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_DataFrameArrow, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow) < 0) __PYX_ERR(9, 32, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_DataFrameArrow) < 0) __PYX_ERR(9, 32, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Entity = &__pyx_vtable_6amplpy_4ampl_Entity;
  __pyx_vtable_6amplpy_4ampl_Entity.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *))__pyx_f_6amplpy_4ampl_6Entity_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Entity_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity)) __PYX_ERR(10, 22, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Entity_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity) < 0) __PYX_ERR(10, 22, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity = &__pyx_type_6amplpy_4ampl_Entity;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity) < 0) __PYX_ERR(10, 22, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_vtabptr_6amplpy_4ampl_Entity) < 0) __PYX_ERR(10, 22, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity) < 0) __PYX_ERR(10, 22, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Entity, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity) < 0) __PYX_ERR(10, 22, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Entity) < 0) __PYX_ERR(10, 22, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Constraint = &__pyx_vtable_6amplpy_4ampl_Constraint;
  __pyx_vtable_6amplpy_4ampl_Constraint.__pyx_base = *__pyx_vtabptr_6amplpy_4ampl_Entity;
  __pyx_vtable_6amplpy_4ampl_Constraint.__pyx_base.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *))__pyx_f_6amplpy_4ampl_10Constraint_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Constraint_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint)) __PYX_ERR(5, 6, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Constraint_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint) < 0) __PYX_ERR(5, 6, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint = &__pyx_type_6amplpy_4ampl_Constraint;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint->tp_base = __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint) < 0) __PYX_ERR(5, 6, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_vtabptr_6amplpy_4ampl_Constraint) < 0) __PYX_ERR(5, 6, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint) < 0) __PYX_ERR(5, 6, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Constraint, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint) < 0) __PYX_ERR(5, 6, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Constraint) < 0) __PYX_ERR(5, 6, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Environment = &__pyx_vtable_6amplpy_4ampl_Environment;
  __pyx_vtable_6amplpy_4ampl_Environment.get_c_pointer = (AMPL_ENVIRONMENT *(*)(struct __pyx_obj_6amplpy_4ampl_Environment *))__pyx_f_6amplpy_4ampl_11Environment_get_c_pointer;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Environment_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment)) __PYX_ERR(11, 5, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Environment_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment) < 0) __PYX_ERR(11, 5, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment = &__pyx_type_6amplpy_4ampl_Environment;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment) < 0) __PYX_ERR(11, 5, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(11, 5, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_6amplpy_4ampl_11Environment_8__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6amplpy_4ampl_11Environment_8__setitem__.doc = __pyx_doc_6amplpy_4ampl_11Environment_8__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6amplpy_4ampl_11Environment_8__setitem__;
    }
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(11, 5, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_6amplpy_4ampl_11Environment_10__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6amplpy_4ampl_11Environment_10__getitem__.doc = __pyx_doc_6amplpy_4ampl_11Environment_10__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6amplpy_4ampl_11Environment_10__getitem__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_vtabptr_6amplpy_4ampl_Environment) < 0) __PYX_ERR(11, 5, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment) < 0) __PYX_ERR(11, 5, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Environment, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment) < 0) __PYX_ERR(11, 5, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Environment) < 0) __PYX_ERR(11, 5, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_ErrorHandler_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler)) __PYX_ERR(12, 28, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_ErrorHandler_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler) < 0) __PYX_ERR(12, 28, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler = &__pyx_type_6amplpy_4ampl_ErrorHandler;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler) < 0) __PYX_ERR(12, 28, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ErrorHandler, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler) < 0) __PYX_ERR(12, 28, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ErrorHandler) < 0) __PYX_ERR(12, 28, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)(((PyTypeObject*)PyExc_Exception))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_AMPLException_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException)) __PYX_ERR(2, 4, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_AMPLException_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException) < 0) __PYX_ERR(2, 4, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException = &__pyx_type_6amplpy_4ampl_AMPLException;
  #endif
  if (sizeof(struct __pyx_obj_6amplpy_4ampl_AMPLException) != sizeof(PyBaseExceptionObject)) {
    if (__Pyx_validate_extern_base((((PyTypeObject*)PyExc_Exception))) < 0) __PYX_ERR(2, 4, __pyx_L1_error)
  }
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException->tp_dealloc = (((PyTypeObject*)PyExc_Exception))->tp_dealloc;
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException->tp_base = (((PyTypeObject*)PyExc_Exception));
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException->tp_new = (((PyTypeObject*)PyExc_Exception))->tp_new;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException) < 0) __PYX_ERR(2, 4, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_AMPLException, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException) < 0) __PYX_ERR(2, 4, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPLException) < 0) __PYX_ERR(2, 4, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_EnvIterator = &__pyx_vtable_6amplpy_4ampl_EnvIterator;
  __pyx_vtable_6amplpy_4ampl_EnvIterator.create = (PyObject *(*)(AMPL_ENVIRONMENT *))__pyx_f_6amplpy_4ampl_11EnvIterator_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_EnvIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator)) __PYX_ERR(6, 1, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_EnvIterator_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator) < 0) __PYX_ERR(6, 1, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator = &__pyx_type_6amplpy_4ampl_EnvIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator) < 0) __PYX_ERR(6, 1, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator, __pyx_vtabptr_6amplpy_4ampl_EnvIterator) < 0) __PYX_ERR(6, 1, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator) < 0) __PYX_ERR(6, 1, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_EnvIterator, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator) < 0) __PYX_ERR(6, 1, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EnvIterator) < 0) __PYX_ERR(6, 1, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_EntityMap = &__pyx_vtable_6amplpy_4ampl_EntityMap;
  __pyx_vtable_6amplpy_4ampl_EntityMap.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, AMPL_ENTITYTYPE))__pyx_f_6amplpy_4ampl_9EntityMap_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_EntityMap_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap)) __PYX_ERR(6, 38, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_EntityMap_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap) < 0) __PYX_ERR(6, 38, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap = &__pyx_type_6amplpy_4ampl_EntityMap;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap) < 0) __PYX_ERR(6, 38, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap, __pyx_vtabptr_6amplpy_4ampl_EntityMap) < 0) __PYX_ERR(6, 38, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap) < 0) __PYX_ERR(6, 38, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_EntityMap, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap) < 0) __PYX_ERR(6, 38, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_EntityMap) < 0) __PYX_ERR(6, 38, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_InstanceIterator = &__pyx_vtable_6amplpy_4ampl_InstanceIterator;
  __pyx_vtable_6amplpy_4ampl_InstanceIterator.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_ENTITYTYPE, PyObject *))__pyx_f_6amplpy_4ampl_16InstanceIterator_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_InstanceIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator)) __PYX_ERR(6, 111, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_InstanceIterator_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator) < 0) __PYX_ERR(6, 111, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator = &__pyx_type_6amplpy_4ampl_InstanceIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator) < 0) __PYX_ERR(6, 111, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator, __pyx_vtabptr_6amplpy_4ampl_InstanceIterator) < 0) __PYX_ERR(6, 111, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator) < 0) __PYX_ERR(6, 111, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_InstanceIterator, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator) < 0) __PYX_ERR(6, 111, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_InstanceIterator) < 0) __PYX_ERR(6, 111, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_MemberRangeIterator = &__pyx_vtable_6amplpy_4ampl_MemberRangeIterator;
  __pyx_vtable_6amplpy_4ampl_MemberRangeIterator.create = (PyObject *(*)(AMPL *, char *, AMPL_TUPLE *, PyObject *))__pyx_f_6amplpy_4ampl_19MemberRangeIterator_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_MemberRangeIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator)) __PYX_ERR(6, 180, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_MemberRangeIterator_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator) < 0) __PYX_ERR(6, 180, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator = &__pyx_type_6amplpy_4ampl_MemberRangeIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator) < 0) __PYX_ERR(6, 180, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator, __pyx_vtabptr_6amplpy_4ampl_MemberRangeIterator) < 0) __PYX_ERR(6, 180, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator) < 0) __PYX_ERR(6, 180, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_MemberRangeIterator, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator) < 0) __PYX_ERR(6, 180, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator) < 0) __PYX_ERR(6, 180, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_ColIterator = &__pyx_vtable_6amplpy_4ampl_ColIterator;
  __pyx_vtable_6amplpy_4ampl_ColIterator.create = (PyObject *(*)(AMPL_DATAFRAME *, size_t))__pyx_f_6amplpy_4ampl_11ColIterator_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_ColIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator)) __PYX_ERR(6, 244, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_ColIterator_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator) < 0) __PYX_ERR(6, 244, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator = &__pyx_type_6amplpy_4ampl_ColIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator) < 0) __PYX_ERR(6, 244, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator, __pyx_vtabptr_6amplpy_4ampl_ColIterator) < 0) __PYX_ERR(6, 244, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator) < 0) __PYX_ERR(6, 244, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ColIterator, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator) < 0) __PYX_ERR(6, 244, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_ColIterator) < 0) __PYX_ERR(6, 244, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_RowIterator = &__pyx_vtable_6amplpy_4ampl_RowIterator;
  __pyx_vtable_6amplpy_4ampl_RowIterator.create = (PyObject *(*)(AMPL_DATAFRAME *, size_t))__pyx_f_6amplpy_4ampl_11RowIterator_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_RowIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator)) __PYX_ERR(6, 270, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_RowIterator_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator) < 0) __PYX_ERR(6, 270, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator = &__pyx_type_6amplpy_4ampl_RowIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator) < 0) __PYX_ERR(6, 270, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator, __pyx_vtabptr_6amplpy_4ampl_RowIterator) < 0) __PYX_ERR(6, 270, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator) < 0) __PYX_ERR(6, 270, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RowIterator, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator) < 0) __PYX_ERR(6, 270, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_RowIterator) < 0) __PYX_ERR(6, 270, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Objective = &__pyx_vtable_6amplpy_4ampl_Objective;
  __pyx_vtable_6amplpy_4ampl_Objective.__pyx_base = *__pyx_vtabptr_6amplpy_4ampl_Entity;
  __pyx_vtable_6amplpy_4ampl_Objective.__pyx_base.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *))__pyx_f_6amplpy_4ampl_9Objective_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Objective_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective)) __PYX_ERR(13, 4, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Objective_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective) < 0) __PYX_ERR(13, 4, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective = &__pyx_type_6amplpy_4ampl_Objective;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective->tp_base = __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective) < 0) __PYX_ERR(13, 4, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_vtabptr_6amplpy_4ampl_Objective) < 0) __PYX_ERR(13, 4, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective) < 0) __PYX_ERR(13, 4, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Objective, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective) < 0) __PYX_ERR(13, 4, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Objective) < 0) __PYX_ERR(13, 4, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_OutputHandler_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler)) __PYX_ERR(3, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_OutputHandler_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler) < 0) __PYX_ERR(3, 3, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler = &__pyx_type_6amplpy_4ampl_OutputHandler;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler) < 0) __PYX_ERR(3, 3, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_OutputHandler, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler) < 0) __PYX_ERR(3, 3, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_OutputHandler) < 0) __PYX_ERR(3, 3, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Parameter = &__pyx_vtable_6amplpy_4ampl_Parameter;
  __pyx_vtable_6amplpy_4ampl_Parameter.__pyx_base = *__pyx_vtabptr_6amplpy_4ampl_Entity;
  __pyx_vtable_6amplpy_4ampl_Parameter.__pyx_base.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *))__pyx_f_6amplpy_4ampl_9Parameter_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Parameter_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter)) __PYX_ERR(14, 30, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Parameter_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter) < 0) __PYX_ERR(14, 30, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter = &__pyx_type_6amplpy_4ampl_Parameter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter->tp_base = __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter) < 0) __PYX_ERR(14, 30, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_vtabptr_6amplpy_4ampl_Parameter) < 0) __PYX_ERR(14, 30, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter) < 0) __PYX_ERR(14, 30, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Parameter, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter) < 0) __PYX_ERR(14, 30, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Parameter) < 0) __PYX_ERR(14, 30, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Set = &__pyx_vtable_6amplpy_4ampl_Set;
  __pyx_vtable_6amplpy_4ampl_Set.__pyx_base = *__pyx_vtabptr_6amplpy_4ampl_Entity;
  __pyx_vtable_6amplpy_4ampl_Set.__pyx_base.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *))__pyx_f_6amplpy_4ampl_3Set_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Set_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set)) __PYX_ERR(15, 12, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Set_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set) < 0) __PYX_ERR(15, 12, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set = &__pyx_type_6amplpy_4ampl_Set;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set->tp_base = __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set) < 0) __PYX_ERR(15, 12, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set, __pyx_vtabptr_6amplpy_4ampl_Set) < 0) __PYX_ERR(15, 12, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set) < 0) __PYX_ERR(15, 12, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Set, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set) < 0) __PYX_ERR(15, 12, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Set) < 0) __PYX_ERR(15, 12, __pyx_L1_error)
  __pyx_vtabptr_6amplpy_4ampl_Variable = &__pyx_vtable_6amplpy_4ampl_Variable;
  __pyx_vtable_6amplpy_4ampl_Variable.__pyx_base = *__pyx_vtabptr_6amplpy_4ampl_Entity;
  __pyx_vtable_6amplpy_4ampl_Variable.__pyx_base.create = (PyObject *(*)(struct __pyx_obj_6amplpy_4ampl_AMPL *, char *, AMPL_TUPLE *, PyObject *))__pyx_f_6amplpy_4ampl_8Variable_create;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_Variable_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable)) __PYX_ERR(16, 3, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_Variable_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable) < 0) __PYX_ERR(16, 3, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable = &__pyx_type_6amplpy_4ampl_Variable;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable->tp_base = __pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable) < 0) __PYX_ERR(16, 3, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_vtabptr_6amplpy_4ampl_Variable) < 0) __PYX_ERR(16, 3, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable) < 0) __PYX_ERR(16, 3, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Variable, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable) < 0) __PYX_ERR(16, 3, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_Variable) < 0) __PYX_ERR(16, 3, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl_AMPL_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL)) __PYX_ERR(0, 66, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl_AMPL_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL = &__pyx_type_6amplpy_4ampl_AMPL;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 66, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_6amplpy_4ampl_4AMPL___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6amplpy_4ampl_4AMPL___init__.doc = __pyx_doc_6amplpy_4ampl_4AMPL___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6amplpy_4ampl_4AMPL___init__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_AMPL, (PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6amplpy_4ampl_AMPL) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct____iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__)) __PYX_ERR(1, 197, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct____iter___spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__) < 0) __PYX_ERR(1, 197, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__ = &__pyx_type_6amplpy_4ampl___pyx_scope_struct____iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__) < 0) __PYX_ERR(1, 197, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct____iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr)) __PYX_ERR(1, 199, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(1, 199, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_1_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(1, 199, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr)) __PYX_ERR(1, 276, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(1, 276, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_2_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(1, 276, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_2_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr)) __PYX_ERR(1, 289, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(1, 289, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_3_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(1, 289, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers)) __PYX_ERR(1, 383, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers) < 0) __PYX_ERR(1, 383, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_4__get_headers;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers) < 0) __PYX_ERR(1, 383, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_4__get_headers->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr)) __PYX_ERR(1, 396, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(1, 396, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_5_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(1, 396, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_5_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict)) __PYX_ERR(1, 499, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict) < 0) __PYX_ERR(1, 499, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_6_from_dict;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict) < 0) __PYX_ERR(1, 499, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_6_from_dict->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr)) __PYX_ERR(1, 523, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(1, 523, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_7_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(1, 523, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_7_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr)) __PYX_ERR(1, 524, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr) < 0) __PYX_ERR(1, 524, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_8_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr) < 0) __PYX_ERR(1, 524, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_8_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr)) __PYX_ERR(14, 198, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr) < 0) __PYX_ERR(14, 198, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_9_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr) < 0) __PYX_ERR(14, 198, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_9_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr)) __PYX_ERR(14, 204, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr) < 0) __PYX_ERR(14, 204, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_10_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr) < 0) __PYX_ERR(14, 204, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_10_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values)) __PYX_ERR(15, 107, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values) < 0) __PYX_ERR(15, 107, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_11_set_values;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values) < 0) __PYX_ERR(15, 107, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_11_set_values->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr)) __PYX_ERR(15, 147, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr) < 0) __PYX_ERR(15, 147, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_12_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr) < 0) __PYX_ERR(15, 147, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_12_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr)) __PYX_ERR(15, 153, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr) < 0) __PYX_ERR(15, 153, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_13_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr) < 0) __PYX_ERR(15, 153, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_13_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr)) __PYX_ERR(15, 183, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr) < 0) __PYX_ERR(15, 183, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_14_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr) < 0) __PYX_ERR(15, 183, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_14_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr)) __PYX_ERR(15, 189, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr) < 0) __PYX_ERR(15, 189, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_15_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr) < 0) __PYX_ERR(15, 189, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_15_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr)) __PYX_ERR(0, 942, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr) < 0) __PYX_ERR(0, 942, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_16_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr) < 0) __PYX_ERR(0, 942, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_16_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr)) __PYX_ERR(0, 952, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr) < 0) __PYX_ERR(0, 952, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_17_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr) < 0) __PYX_ERR(0, 952, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_17_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr)) __PYX_ERR(0, 1229, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr_spec, __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr) < 0) __PYX_ERR(0, 1229, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr = &__pyx_type_6amplpy_4ampl___pyx_scope_struct_18_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr) < 0) __PYX_ERR(0, 1229, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6amplpy_4ampl___pyx_scope_struct_18_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_1_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_0(PyLongObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_0(PyLongObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_0); if (!__pyx_mstate->__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(17, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(18, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_1_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_0(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_0(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_0); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(18, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(19, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_1_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_0(PyComplexObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_0(PyComplexObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_0); if (!__pyx_mstate->__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(19, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_ampl(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_ampl},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, Py_MOD_GIL_USED},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "ampl",
      0, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      NULL /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      NULL /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit_ampl(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_ampl(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x03090000
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_ampl(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'ampl' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "ampl" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif

__Pyx_RefNannySetupContext("PyInit_ampl", 0);
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_amplpy__ampl) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "amplpy.ampl")) {
      if (unlikely((PyDict_SetItemString(modules, "amplpy.ampl", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  /*--- Execution code ---*/

  /* "amplpy/ampl.pyx":2
 * # https://cython.readthedocs.io/en/latest/src/tutorial/clibraries.html
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cimport amplpy.campl as campl
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sys, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":15
 * from cpython cimport Py_INCREF, Py_DECREF
 * 
 * import builtins             # <<<<<<<<<<<<<<
 * 
 * from numbers import Real
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_builtins, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_builtins, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":17
 * import builtins
 * 
 * from numbers import Real             # <<<<<<<<<<<<<<
 * from ast import literal_eval
 * 
*/
  __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numbers, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Real, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/ampl.pyx":18
 * 
 * from numbers import Real
 * from ast import literal_eval             # <<<<<<<<<<<<<<
 * 
 * include "util.pxi" # must be first
*/
  __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_literal_eval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_ast, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_literal_eval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_literal_eval, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":48
 *         self.__getitem__(index).set_dual(value)
 * 
 *     def is_logical(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check if the constraint is a logical constraint. Returns True if
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_3is_logical, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_is_logical, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_is_logical, __pyx_t_2) < 0) __PYX_ERR(5, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":64
 *             return False
 * 
 *     def drop(self):             # <<<<<<<<<<<<<<
 *         """
 *         Drop all instances in this constraint entity, corresponding to the AMPL
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_5drop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_drop, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_drop, __pyx_t_2) < 0) __PYX_ERR(5, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":71
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))
 * 
 *     def restore(self):             # <<<<<<<<<<<<<<
 *         """
 *         Restore all instances in this constraint entity, corresponding to the
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_7restore, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_restore, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_restore, __pyx_t_2) < 0) __PYX_ERR(5, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":78
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))
 * 
 *     def body(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's body.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_9body, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_body, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_body, __pyx_t_2) < 0) __PYX_ERR(5, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":86
 *         return value
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current AMPL status (dropped, presolved, or substituted out).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_11astatus, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_astatus, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_astatus, __pyx_t_2) < 0) __PYX_ERR(5, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":100
 *         return value
 * 
 *     def defvar(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the index in `_var` of "defined variable" substituted out by the
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_13defvar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_defvar, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_defvar, __pyx_t_2) < 0) __PYX_ERR(5, 100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":109
 *         return value
 * 
 *     def dinit(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current initial guess for the constraint's dual variable.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_15dinit, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_dinit, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_dinit, __pyx_t_2) < 0) __PYX_ERR(5, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":117
 *         return value
 * 
 *     def dinit0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the original initial guess for the constraint's dual variable.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_17dinit0, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_dinit0, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_dinit0, __pyx_t_2) < 0) __PYX_ERR(5, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":125
 *         return value
 * 
 *     def dual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's dual variable.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_19dual, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_dual, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_dual, __pyx_t_2) < 0) __PYX_ERR(5, 125, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":138
 *         return value
 * 
 *     def lb(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's lower bound.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_21lb, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_lb, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_lb, __pyx_t_2) < 0) __PYX_ERR(5, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":146
 *         return value
 * 
 *     def ub(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the constraint's upper bound.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_23ub, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_ub, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_ub, __pyx_t_2) < 0) __PYX_ERR(5, 146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":154
 *         return value
 * 
 *     def lbs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint lower bound sent to the solver (reflecting
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_25lbs, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_lbs, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_lbs, __pyx_t_2) < 0) __PYX_ERR(5, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":163
 *         return value
 * 
 *     def ubs(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint upper bound sent to the solver (reflecting
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_27ubs, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_ubs, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_ubs, __pyx_t_2) < 0) __PYX_ERR(5, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":172
 *         return value
 * 
 *     def ldual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current dual value associated with the lower bound.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_29ldual, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_ldual, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_ldual, __pyx_t_2) < 0) __PYX_ERR(5, 172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":180
 *         return value
 * 
 *     def udual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current dual value associated with the upper bounds.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_31udual, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_udual, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_udual, __pyx_t_2) < 0) __PYX_ERR(5, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":188
 *         return value
 * 
 *     def lslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the slack at lower bound `body - lb`.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_33lslack, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_lslack, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_lslack, __pyx_t_2) < 0) __PYX_ERR(5, 188, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":196
 *         return value
 * 
 *     def uslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the slack at upper bound `ub - body`.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_35uslack, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_uslack, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_uslack, __pyx_t_2) < 0) __PYX_ERR(5, 196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":204
 *         return value
 * 
 *     def slack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Constraint slack (the lesser of lslack and uslack).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_37slack, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_slack, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_slack, __pyx_t_2) < 0) __PYX_ERR(5, 204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":212
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the solver status (basis status of constraint's slack or artificial
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_39sstatus, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_sstatus, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_sstatus, __pyx_t_2) < 0) __PYX_ERR(5, 212, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":227
 *         return value
 * 
 *     def status(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL status if not `in`, otherwise solver status.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_41status, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_status, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_status, __pyx_t_2) < 0) __PYX_ERR(5, 227, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":241
 *         return value
 * 
 *     def set_dual(self, dual):             # <<<<<<<<<<<<<<
 *         """
 *         Set the value of the dual variable associated to this constraint (valid
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_43set_dual, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_set_dual, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[65])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_set_dual, __pyx_t_2) < 0) __PYX_ERR(5, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":258
 *         PY_AMPL_CALL(campl.AMPL_ConstraintInstanceSetDual(self._ampl._c_ampl, self._name, self._index, float(dual)))
 * 
 *     def val(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL val suffix. Valid only for logical constraints.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_45val, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint_val, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[66])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_val, __pyx_t_2) < 0) __PYX_ERR(5, 258, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":270
 * 
 *     # Aliases
 *     isLogical = is_logical             # <<<<<<<<<<<<<<
 *     setDual = set_dual
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_is_logical); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_isLogical, __pyx_t_2) < 0) __PYX_ERR(5, 270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/constraint.pxi":271
 *     # Aliases
 *     isLogical = is_logical
 *     setDual = set_dual             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_set_dual); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Constraint, __pyx_mstate_global->__pyx_n_u_setDual, __pyx_t_2) < 0) __PYX_ERR(5, 271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_47__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[67])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_10Constraint_49__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Constraint___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[68])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/dataframe.pxi":9
 * from cpython.exc cimport PyErr_Occurred, PyErr_Clear
 * 
 * from numbers import Real             # <<<<<<<<<<<<<<
 * 
 * try:
*/
  __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numbers, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Real, __pyx_t_2) < 0) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":11
 * from numbers import Real
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "amplpy/dataframe.pxi":12
 * 
 * try:
 *     import pandas as pd             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pd = None
*/
      __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pandas, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 12, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, __pyx_t_3) < 0) __PYX_ERR(1, 12, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "amplpy/dataframe.pxi":11
 * from numbers import Real
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "amplpy/dataframe.pxi":13
 * try:
 *     import pandas as pd
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pd = None
 * try:
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_7) < 0) __PYX_ERR(1, 13, __pyx_L4_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "amplpy/dataframe.pxi":14
 *     import pandas as pd
 * except ImportError:
 *     pd = None             # <<<<<<<<<<<<<<
 * try:
 *     import numpy as np
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, Py_None) < 0) __PYX_ERR(1, 14, __pyx_L4_except_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;

    /* "amplpy/dataframe.pxi":11
 * from numbers import Real
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    __pyx_L7_try_end:;
  }

  /* "amplpy/dataframe.pxi":15
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "amplpy/dataframe.pxi":16
 *     pd = None
 * try:
 *     import numpy as np             # <<<<<<<<<<<<<<
 * except ImportError:
 *     np = None
*/
      __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 16, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_7) < 0) __PYX_ERR(1, 16, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "amplpy/dataframe.pxi":15
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L15_try_end;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/dataframe.pxi":17
 * try:
 *     import numpy as np
 * except ImportError:             # <<<<<<<<<<<<<<
 *     np = None
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(1, 17, __pyx_L12_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);

      /* "amplpy/dataframe.pxi":18
 *     import numpy as np
 * except ImportError:
 *     np = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, Py_None) < 0) __PYX_ERR(1, 18, __pyx_L12_except_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L11_exception_handled;
    }
    goto __pyx_L12_except_error;

    /* "amplpy/dataframe.pxi":15
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
    __pyx_L12_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L11_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    __pyx_L15_try_end:;
  }

  /* "amplpy/dataframe.pxi":46
 *         return to_py_variant(v)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         return str(list(self))
 * 
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Row_7to_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Row_to_string, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[69])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Row, __pyx_mstate_global->__pyx_n_u_to_string, __pyx_t_3) < 0) __PYX_ERR(1, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":50
 * 
 *     # Aliases
 *     toString = to_string             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Row, __pyx_mstate_global->__pyx_n_u_to_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Row, __pyx_mstate_global->__pyx_n_u_toString, __pyx_t_3) < 0) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Row_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Row___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[70])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Row_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Row___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[71])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":73
 *         return ColIterator.create(self._df, self._index)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         return str(self.to_list())
 * 
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Column_5to_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Column_to_string, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column, __pyx_mstate_global->__pyx_n_u_to_string, __pyx_t_3) < 0) __PYX_ERR(1, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":76
 *         return str(self.to_list())
 * 
 *     def to_list(self):             # <<<<<<<<<<<<<<
 *         py_list = []
 *         cdef campl.AMPL_VARIANT* v
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Column_7to_list, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Column_to_list, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column, __pyx_mstate_global->__pyx_n_u_to_list, __pyx_t_3) < 0) __PYX_ERR(1, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":88
 * 
 *     # Aliases
 *     toString = to_string             # <<<<<<<<<<<<<<
 *     toList = to_list
 * 
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column, __pyx_mstate_global->__pyx_n_u_to_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column, __pyx_mstate_global->__pyx_n_u_toString, __pyx_t_3) < 0) __PYX_ERR(1, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":89
 *     # Aliases
 *     toString = to_string
 *     toList = to_list             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column, __pyx_mstate_global->__pyx_n_u_to_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Column, __pyx_mstate_global->__pyx_n_u_toList, __pyx_t_3) < 0) __PYX_ERR(1, 89, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Column_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Column___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Column_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Column___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":126
 *     cdef campl.AMPL_DATAFRAME* _c_df
 * 
 *     def __cinit__(self, index, columns=tuple(), **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Create a new DataFrame with specifed index and column headers.
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)(&PyTuple_Type));
  __pyx_t_7 = ((PyObject *)(&PyTuple_Type)); 
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_mstate_global->__pyx_k_ = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":187
 *         campl.AMPL_DataFrameFree(&self._c_df)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef char* value_c
 *         PY_AMPL_CALL(campl.AMPL_DataFrameToString(self._c_df, &value_c))
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_5to_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame_to_string, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_string, __pyx_t_3) < 0) __PYX_ERR(1, 187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":201
 *         return (self._get_row_by_index(i) for i in range(self._get_num_rows()))
 * 
 *     def _get_num_cols(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the total number of columns in this dataframe (indexarity + number
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_11_get_num_cols, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__get_num_cols, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[77])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_num_cols, __pyx_t_3) < 0) __PYX_ERR(1, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":213
 *         return int(num)
 * 
 *     def _get_num_rows(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of data rows in this dataframe.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_13_get_num_rows, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__get_num_rows, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[78])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_num_rows, __pyx_t_3) < 0) __PYX_ERR(1, 213, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":224
 *         return int(num)
 * 
 *     def _get_num_indices(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of indices (the indexarity) of this dataframe.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_15_get_num_indices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__get_num_indices, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_num_indices, __pyx_t_3) < 0) __PYX_ERR(1, 224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":235
 *         return int(num)
 * 
 *     def _add_row(self, *value):             # <<<<<<<<<<<<<<
 *         """
 *         Add a row to the DataFrame. The size of the tuple must be equal to the
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_17_add_row, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__add_row, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[80])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_add_row, __pyx_t_3) < 0) __PYX_ERR(1, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":255
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def _add_column(self, header, values=None):             # <<<<<<<<<<<<<<
 *         """
 *         Add a new column with the corresponding header and values to the
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_19_add_column, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__add_column, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[81])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_add_column, __pyx_t_3) < 0) __PYX_ERR(1, 255, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":301
 *                 raise NotImplementedError
 * 
 *     def _get_column(self, header):             # <<<<<<<<<<<<<<
 *         """
 *         Get the specified column as a view object.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_21_get_column, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__get_column, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[82])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_column, __pyx_t_3) < 0) __PYX_ERR(1, 301, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":312
 *         return Column.create(self._c_df, index)
 * 
 *     def _set_column(self, header, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of a column.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_23_set_column, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__set_column, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_set_column, __pyx_t_3) < 0) __PYX_ERR(1, 312, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":351
 *                 PY_AMPL_CALL(errorinfo)
 * 
 *     def _get_row(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         Get a row by value of the indexing columns. If the index is not
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_25_get_row, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__get_row, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_row, __pyx_t_3) < 0) __PYX_ERR(1, 351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":371
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_row_by_index(self, index):             # <<<<<<<<<<<<<<
 *         """
 *         Get row by numeric index.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_27_get_row_by_index, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__get_row_by_index, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[85])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_row_by_index, __pyx_t_3) < 0) __PYX_ERR(1, 371, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":383
 *         return Row.create(self._c_df, index)
 * 
 *     def _get_headers(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the headers of this DataFrame.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_29_get_headers, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__get_headers, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[86])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_headers, __pyx_t_3) < 0) __PYX_ERR(1, 383, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":402
 *         return headers_py
 * 
 *     def _set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of a DataFrame from a dictionary.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_31_set_values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__set_values, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[87])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_set_values_2, __pyx_t_3) < 0) __PYX_ERR(1, 402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":427
 *             self._add_row(key + value)
 * 
 *     def to_dict(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return a dictionary with the DataFrame data.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_33to_dict, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame_to_dict, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[88])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_dict, __pyx_t_3) < 0) __PYX_ERR(1, 427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":451
 *         return d
 * 
 *     def to_list(self, skip_index=False):             # <<<<<<<<<<<<<<
 *         """
 *         Return a list with the DataFrame data.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_35to_list, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame_to_list, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[89])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[17]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_list, __pyx_t_3) < 0) __PYX_ERR(1, 451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":474
 *             return lst
 * 
 *     def to_pandas(self, multi_index=True):             # <<<<<<<<<<<<<<
 *         """
 *         Return a pandas.DataFrame with the DataFrame data.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_37to_pandas, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame_to_pandas, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[90])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[18]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_pandas, __pyx_t_3) < 0) __PYX_ERR(1, 474, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":499
 *                 return pd.DataFrame(columns, index=index)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_dict(cls, dic, index_names=None, column_names=None):
 *         """
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_39from_dict, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame_from_dict, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[91])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_dict, __pyx_t_3) < 0) __PYX_ERR(1, 499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_dict, __pyx_t_7) < 0) __PYX_ERR(1, 499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "amplpy/dataframe.pxi":541
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_41from_pandas, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame_from_pandas, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[92])); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_t_7) < 0) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_GetNameInClass(__pyx_t_7, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_pandas); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_t_3) < 0) __PYX_ERR(1, 541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":575
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_numpy(cls, data):
 *         """
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_43from_numpy, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame_from_numpy, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[93])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_numpy, __pyx_t_3) < 0) __PYX_ERR(1, 575, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_numpy, __pyx_t_7) < 0) __PYX_ERR(1, 575, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "amplpy/dataframe.pxi":593
 *         return cls(index=index, columns=columns)
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def _from_data_frame_ref(cls, df_ref):
 *         return cls(None, None, _impl=df_ref)
*/
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_45_from_data_frame_ref, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame__from_data_frame_ref, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[94])); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_data_frame_ref, __pyx_t_7) < 0) __PYX_ERR(1, 593, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_GetNameInClass(__pyx_t_7, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_data_frame_ref); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_Method_ClassMethod(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_data_frame_ref, __pyx_t_3) < 0) __PYX_ERR(1, 593, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":598
 * 
 *     # Aliases
 *     _addColumn = _add_column             # <<<<<<<<<<<<<<
 *     _addRow = _add_row
 *     _getColumn = _get_column
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_add_column); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_addColumn, __pyx_t_3) < 0) __PYX_ERR(1, 598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":599
 *     # Aliases
 *     _addColumn = _add_column
 *     _addRow = _add_row             # <<<<<<<<<<<<<<
 *     _getColumn = _get_column
 *     _getHeaders = _get_headers
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_add_row); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_addRow, __pyx_t_3) < 0) __PYX_ERR(1, 599, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":600
 *     _addColumn = _add_column
 *     _addRow = _add_row
 *     _getColumn = _get_column             # <<<<<<<<<<<<<<
 *     _getHeaders = _get_headers
 *     _getNumCols = _get_num_cols
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_column); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_getColumn, __pyx_t_3) < 0) __PYX_ERR(1, 600, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":601
 *     _addRow = _add_row
 *     _getColumn = _get_column
 *     _getHeaders = _get_headers             # <<<<<<<<<<<<<<
 *     _getNumCols = _get_num_cols
 *     _getNumIndices = _get_num_indices
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_headers); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_getHeaders, __pyx_t_3) < 0) __PYX_ERR(1, 601, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":602
 *     _getColumn = _get_column
 *     _getHeaders = _get_headers
 *     _getNumCols = _get_num_cols             # <<<<<<<<<<<<<<
 *     _getNumIndices = _get_num_indices
 *     _getNumRows = _get_num_rows
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_num_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_getNumCols, __pyx_t_3) < 0) __PYX_ERR(1, 602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":603
 *     _getHeaders = _get_headers
 *     _getNumCols = _get_num_cols
 *     _getNumIndices = _get_num_indices             # <<<<<<<<<<<<<<
 *     _getNumRows = _get_num_rows
 *     _getRow = _get_row
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_num_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_getNumIndices, __pyx_t_3) < 0) __PYX_ERR(1, 603, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":604
 *     _getNumCols = _get_num_cols
 *     _getNumIndices = _get_num_indices
 *     _getNumRows = _get_num_rows             # <<<<<<<<<<<<<<
 *     _getRow = _get_row
 *     _getRowByIndex = _get_row_by_index
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_num_rows); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_getNumRows, __pyx_t_3) < 0) __PYX_ERR(1, 604, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":605
 *     _getNumIndices = _get_num_indices
 *     _getNumRows = _get_num_rows
 *     _getRow = _get_row             # <<<<<<<<<<<<<<
 *     _getRowByIndex = _get_row_by_index
 *     _setColumn = _set_column
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_row); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_getRow, __pyx_t_3) < 0) __PYX_ERR(1, 605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":606
 *     _getNumRows = _get_num_rows
 *     _getRow = _get_row
 *     _getRowByIndex = _get_row_by_index             # <<<<<<<<<<<<<<
 *     _setColumn = _set_column
 *     _setValues = _set_values
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_get_row_by_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_getRowByIndex, __pyx_t_3) < 0) __PYX_ERR(1, 606, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":607
 *     _getRow = _get_row
 *     _getRowByIndex = _get_row_by_index
 *     _setColumn = _set_column             # <<<<<<<<<<<<<<
 *     _setValues = _set_values
 *     fromDict = from_dict
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_set_column); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_setColumn, __pyx_t_3) < 0) __PYX_ERR(1, 607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":608
 *     _getRowByIndex = _get_row_by_index
 *     _setColumn = _set_column
 *     _setValues = _set_values             # <<<<<<<<<<<<<<
 *     fromDict = from_dict
 *     fromNumpy = from_numpy
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_set_values_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_setValues, __pyx_t_3) < 0) __PYX_ERR(1, 608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":609
 *     _setColumn = _set_column
 *     _setValues = _set_values
 *     fromDict = from_dict             # <<<<<<<<<<<<<<
 *     fromNumpy = from_numpy
 *     fromPandas = from_pandas
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_fromDict, __pyx_t_3) < 0) __PYX_ERR(1, 609, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":610
 *     _setValues = _set_values
 *     fromDict = from_dict
 *     fromNumpy = from_numpy             # <<<<<<<<<<<<<<
 *     fromPandas = from_pandas
 *     toDict = to_dict
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_fromNumpy, __pyx_t_3) < 0) __PYX_ERR(1, 610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":611
 *     fromDict = from_dict
 *     fromNumpy = from_numpy
 *     fromPandas = from_pandas             # <<<<<<<<<<<<<<
 *     toDict = to_dict
 *     toList = to_list
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_from_pandas); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_fromPandas, __pyx_t_3) < 0) __PYX_ERR(1, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":612
 *     fromNumpy = from_numpy
 *     fromPandas = from_pandas
 *     toDict = to_dict             # <<<<<<<<<<<<<<
 *     toList = to_list
 *     toPandas = to_pandas
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_toDict, __pyx_t_3) < 0) __PYX_ERR(1, 612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":613
 *     fromPandas = from_pandas
 *     toDict = to_dict
 *     toList = to_list             # <<<<<<<<<<<<<<
 *     toPandas = to_pandas
 *     toString = to_string
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_toList, __pyx_t_3) < 0) __PYX_ERR(1, 613, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":614
 *     toDict = to_dict
 *     toList = to_list
 *     toPandas = to_pandas             # <<<<<<<<<<<<<<
 *     toString = to_string
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_pandas); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_toPandas, __pyx_t_3) < 0) __PYX_ERR(1, 614, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe.pxi":615
 *     toList = to_list
 *     toPandas = to_pandas
 *     toString = to_string             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_to_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrame, __pyx_mstate_global->__pyx_n_u_toString, __pyx_t_3) < 0) __PYX_ERR(1, 615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_47__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[95])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9DataFrame_49__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrame___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[96])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe_arrow.pxi":12
 * from cpython.pycapsule cimport PyCapsule_IsValid
 * 
 * from numbers import Real             # <<<<<<<<<<<<<<
 * 
 * import nanoarrow as na
*/
  __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numbers, __pyx_t_3, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Real, __pyx_t_3) < 0) __PYX_ERR(9, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "amplpy/dataframe_arrow.pxi":14
 * from numbers import Real
 * 
 * import nanoarrow as na             # <<<<<<<<<<<<<<
 * from nanoarrow import c_array, c_schema, c_array_stream
 * 
*/
  __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_nanoarrow, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_na, __pyx_t_7) < 0) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "amplpy/dataframe_arrow.pxi":15
 * 
 * import nanoarrow as na
 * from nanoarrow import c_array, c_schema, c_array_stream             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_7 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_c_array, __pyx_mstate_global->__pyx_n_u_c_schema, __pyx_mstate_global->__pyx_n_u_c_array_stream); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_nanoarrow, __pyx_t_7, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_c_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_c_array, __pyx_t_7) < 0) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_c_schema); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_c_schema, __pyx_t_7) < 0) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_c_array_stream); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_c_array_stream, __pyx_t_7) < 0) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/dataframe_arrow.pxi":18
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "amplpy/dataframe_arrow.pxi":19
 * 
 * try:
 *     import pandas as pd             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pd = None
*/
      __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pandas, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 19, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, __pyx_t_3) < 0) __PYX_ERR(9, 19, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "amplpy/dataframe_arrow.pxi":18
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L23_try_end;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/dataframe_arrow.pxi":20
 * try:
 *     import pandas as pd
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pd = None
 * try:
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(9, 20, __pyx_L20_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "amplpy/dataframe_arrow.pxi":21
 *     import pandas as pd
 * except ImportError:
 *     pd = None             # <<<<<<<<<<<<<<
 * try:
 *     import pyarrow as pa
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, Py_None) < 0) __PYX_ERR(9, 21, __pyx_L20_except_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L19_exception_handled;
    }
    goto __pyx_L20_except_error;

    /* "amplpy/dataframe_arrow.pxi":18
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
    __pyx_L20_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L19_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    __pyx_L23_try_end:;
  }

  /* "amplpy/dataframe_arrow.pxi":22
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "amplpy/dataframe_arrow.pxi":23
 *     pd = None
 * try:
 *     import pyarrow as pa             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pa = None
*/
      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pyarrow, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 23, __pyx_L26_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pa, __pyx_t_2) < 0) __PYX_ERR(9, 23, __pyx_L26_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/dataframe_arrow.pxi":22
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L31_try_end;
    __pyx_L26_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/dataframe_arrow.pxi":24
 * try:
 *     import pyarrow as pa
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pa = None
 * try :
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(9, 24, __pyx_L28_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_3);

      /* "amplpy/dataframe_arrow.pxi":25
 *     import pyarrow as pa
 * except ImportError:
 *     pa = None             # <<<<<<<<<<<<<<
 * try :
 *     import polars as pl
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pa, Py_None) < 0) __PYX_ERR(9, 25, __pyx_L28_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L27_exception_handled;
    }
    goto __pyx_L28_except_error;

    /* "amplpy/dataframe_arrow.pxi":22
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 * except ImportError:
*/
    __pyx_L28_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L27_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    __pyx_L31_try_end:;
  }

  /* "amplpy/dataframe_arrow.pxi":26
 * except ImportError:
 *     pa = None
 * try :             # <<<<<<<<<<<<<<
 *     import polars as pl
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "amplpy/dataframe_arrow.pxi":27
 *     pa = None
 * try :
 *     import polars as pl             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pl = None
*/
      __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_polars, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 27, __pyx_L34_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pl, __pyx_t_3) < 0) __PYX_ERR(9, 27, __pyx_L34_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "amplpy/dataframe_arrow.pxi":26
 * except ImportError:
 *     pa = None
 * try :             # <<<<<<<<<<<<<<
 *     import polars as pl
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L39_try_end;
    __pyx_L34_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/dataframe_arrow.pxi":28
 * try :
 *     import polars as pl
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pl = None
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(9, 28, __pyx_L36_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "amplpy/dataframe_arrow.pxi":29
 *     import polars as pl
 * except ImportError:
 *     pl = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pl, Py_None) < 0) __PYX_ERR(9, 29, __pyx_L36_except_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L35_exception_handled;
    }
    goto __pyx_L36_except_error;

    /* "amplpy/dataframe_arrow.pxi":26
 * except ImportError:
 *     pa = None
 * try :             # <<<<<<<<<<<<<<
 *     import polars as pl
 * except ImportError:
*/
    __pyx_L36_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L35_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    __pyx_L39_try_end:;
  }

  /* "amplpy/dataframe_arrow.pxi":64
 *         return self._c_df
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_polars(cls, df):
 *         """
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_14DataFrameArrow_5from_polars, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrameArrow_from_polars, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[97])); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow, __pyx_mstate_global->__pyx_n_u_from_polars, __pyx_t_2) < 0) __PYX_ERR(9, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow, __pyx_mstate_global->__pyx_n_u_from_polars); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow, __pyx_mstate_global->__pyx_n_u_from_polars, __pyx_t_7) < 0) __PYX_ERR(9, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "amplpy/dataframe_arrow.pxi":83
 *         return obj
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def from_pandas(cls, df, index_names=None, indexarity=None):
 *         """
*/
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_14DataFrameArrow_7from_pandas, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrameArrow_from_pandas, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[98])); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow, __pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_t_7) < 0) __PYX_ERR(9, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_GetNameInClass(__pyx_t_7, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow, __pyx_mstate_global->__pyx_n_u_from_pandas); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_DataFrameArrow, __pyx_mstate_global->__pyx_n_u_from_pandas, __pyx_t_2) < 0) __PYX_ERR(9, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_14DataFrameArrow_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrameArrow___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[99])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_14DataFrameArrow_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_DataFrameArrow___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[100])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/entity.pxi":6
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "amplpy/entity.pxi":7
 * 
 * try:
 *     import pandas as pd             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pd = None
*/
      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pandas, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7, __pyx_L42_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, __pyx_t_2) < 0) __PYX_ERR(10, 7, __pyx_L42_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/entity.pxi":6
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L47_try_end;
    __pyx_L42_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/entity.pxi":8
 * try:
 *     import pandas as pd
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pd = None
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(10, 8, __pyx_L44_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_3);

      /* "amplpy/entity.pxi":9
 *     import pandas as pd
 * except ImportError:
 *     pd = None             # <<<<<<<<<<<<<<
 * 
 * try:
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, Py_None) < 0) __PYX_ERR(10, 9, __pyx_L44_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L43_exception_handled;
    }
    goto __pyx_L44_except_error;

    /* "amplpy/entity.pxi":6
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
    __pyx_L44_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L43_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    __pyx_L47_try_end:;
  }

  /* "amplpy/entity.pxi":11
 *     pd = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "amplpy/entity.pxi":12
 * 
 * try:
 *     import pyarrow as pa             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pd = None
*/
      __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pyarrow, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12, __pyx_L50_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pa, __pyx_t_3) < 0) __PYX_ERR(10, 12, __pyx_L50_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "amplpy/entity.pxi":11
 *     pd = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L55_try_end;
    __pyx_L50_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/entity.pxi":13
 * try:
 *     import pyarrow as pa
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pd = None
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(10, 13, __pyx_L52_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "amplpy/entity.pxi":14
 *     import pyarrow as pa
 * except ImportError:
 *     pd = None             # <<<<<<<<<<<<<<
 * 
 * try:
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, Py_None) < 0) __PYX_ERR(10, 14, __pyx_L52_except_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L51_exception_handled;
    }
    goto __pyx_L52_except_error;

    /* "amplpy/entity.pxi":11
 *     pd = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 * except ImportError:
*/
    __pyx_L52_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L51_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    __pyx_L55_try_end:;
  }

  /* "amplpy/entity.pxi":16
 *     pd = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import nanoarrow as na
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "amplpy/entity.pxi":17
 * 
 * try:
 *     import nanoarrow as na             # <<<<<<<<<<<<<<
 * except ImportError:
 *     na = None
*/
      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_nanoarrow, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17, __pyx_L58_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_na, __pyx_t_2) < 0) __PYX_ERR(10, 17, __pyx_L58_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/entity.pxi":16
 *     pd = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import nanoarrow as na
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L63_try_end;
    __pyx_L58_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/entity.pxi":18
 * try:
 *     import nanoarrow as na
 * except ImportError:             # <<<<<<<<<<<<<<
 *     na = None
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(10, 18, __pyx_L60_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_3);

      /* "amplpy/entity.pxi":19
 *     import nanoarrow as na
 * except ImportError:
 *     na = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_na, Py_None) < 0) __PYX_ERR(10, 19, __pyx_L60_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L59_exception_handled;
    }
    goto __pyx_L60_except_error;

    /* "amplpy/entity.pxi":16
 *     pd = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import nanoarrow as na
 * except ImportError:
*/
    __pyx_L60_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L59_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    __pyx_L63_try_end:;
  }

  /* "amplpy/entity.pxi":79
 *         Py_DECREF(self._ampl)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_3to_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_to_string, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[101])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_to_string, __pyx_t_3) < 0) __PYX_ERR(10, 79, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":103
 *         return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
 * 
 *     def get(self, *index):             # <<<<<<<<<<<<<<
 *         """
 *         Get the instance with the specified index.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_11get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_get, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[102])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_3) < 0) __PYX_ERR(10, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":131
 *                 return create_entity(self.wrap_function, self._ampl, self._name, tuple_c, self)
 * 
 *     def find(self, index):             # <<<<<<<<<<<<<<
 *         """
 *         Searches the current entity for an instance with the specified index.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_13find, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_find, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[103])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_find, __pyx_t_3) < 0) __PYX_ERR(10, 131, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":159
 *         return None
 * 
 *     def instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the instances in this entity.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_15instances, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_instances, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[104])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_instances, __pyx_t_3) < 0) __PYX_ERR(10, 159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":165
 *         return InstanceIterator.create(self._ampl, self._name, self.wrap_function, self)
 * 
 *     def name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of this entity.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_17name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_name, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[105])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_name, __pyx_t_3) < 0) __PYX_ERR(10, 165, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":171
 *         return self._name.decode('utf-8')
 * 
 *     def indexarity(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the indexarity of this entity (sum of the dimensions of the
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_19indexarity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_indexarity, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[106])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_indexarity, __pyx_t_3) < 0) __PYX_ERR(10, 171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":197
 *         return indexarity
 * 
 *     def is_scalar(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check whether this entity is scalar. Equivalent to testing whether
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_21is_scalar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_is_scalar, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[107])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_is_scalar, __pyx_t_3) < 0) __PYX_ERR(10, 197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":210
 *             return True
 * 
 *     def num_instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of instances in this entity.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_23num_instances, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_num_instances, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[108])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_num_instances, __pyx_t_3) < 0) __PYX_ERR(10, 210, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":218
 *         return int(size)
 * 
 *     def get_indexing_sets(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL string representation of the sets on which this entity is
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_25get_indexing_sets, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_get_indexing_sets, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[109])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_get_indexing_sets, __pyx_t_3) < 0) __PYX_ERR(10, 218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":243
 *         return pylist
 * 
 *     def xref(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the names of all entities which depend on this one.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_27xref, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_xref, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[110])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_xref, __pyx_t_3) < 0) __PYX_ERR(10, 243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":263
 *         return pylist
 * 
 *     def get_values(self, suffixes=None):             # <<<<<<<<<<<<<<
 *         """
 *         If a list of suffixes is provided, get the specified suffixes value for
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_29get_values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_get_values, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[111])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_get_values, __pyx_t_3) < 0) __PYX_ERR(10, 263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":305
 *         return DataFrame.create(df_c)
 * 
 *     def to_pandas(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_pandas`.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_31to_pandas, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_to_pandas, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[112])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_to_pandas, __pyx_t_3) < 0) __PYX_ERR(10, 305, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":311
 *         return self.get_values().to_pandas(**kwargs)
 * 
 *     def to_dict(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_dict`.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_33to_dict, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_to_dict, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[113])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_to_dict, __pyx_t_3) < 0) __PYX_ERR(10, 311, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":317
 *         return self.get_values().to_dict(**kwargs)
 * 
 *     def to_list(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to ``Entity.get_values().``:func:`~amplpy.DataFrame.to_list`.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_35to_list, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_to_list, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[114])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_to_list, __pyx_t_3) < 0) __PYX_ERR(10, 317, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":323
 *         return self.get_values().to_list(**kwargs)
 * 
 *     def set_values(self, data):             # <<<<<<<<<<<<<<
 *         """
 *         Set the values of this entiy to the correponding values of a
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_37set_values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity_set_values, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[115])); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_set_values, __pyx_t_3) < 0) __PYX_ERR(10, 323, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":385
 * 
 *     # Aliases
 *     toString = to_string             # <<<<<<<<<<<<<<
 *     getIndexingSets = get_indexing_sets
 *     getValues = get_values
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_to_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_toString, __pyx_t_3) < 0) __PYX_ERR(10, 385, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":386
 *     # Aliases
 *     toString = to_string
 *     getIndexingSets = get_indexing_sets             # <<<<<<<<<<<<<<
 *     getValues = get_values
 *     isScalar = is_scalar
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_get_indexing_sets); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_getIndexingSets, __pyx_t_3) < 0) __PYX_ERR(10, 386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":387
 *     toString = to_string
 *     getIndexingSets = get_indexing_sets
 *     getValues = get_values             # <<<<<<<<<<<<<<
 *     isScalar = is_scalar
 *     numInstances = num_instances
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_get_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_getValues, __pyx_t_3) < 0) __PYX_ERR(10, 387, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":388
 *     getIndexingSets = get_indexing_sets
 *     getValues = get_values
 *     isScalar = is_scalar             # <<<<<<<<<<<<<<
 *     numInstances = num_instances
 *     setValues = set_values
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_is_scalar); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_isScalar, __pyx_t_3) < 0) __PYX_ERR(10, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":389
 *     getValues = get_values
 *     isScalar = is_scalar
 *     numInstances = num_instances             # <<<<<<<<<<<<<<
 *     setValues = set_values
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_num_instances); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_numInstances, __pyx_t_3) < 0) __PYX_ERR(10, 389, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/entity.pxi":390
 *     isScalar = is_scalar
 *     numInstances = num_instances
 *     setValues = set_values             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_set_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Entity, __pyx_mstate_global->__pyx_n_u_setValues_2, __pyx_t_3) < 0) __PYX_ERR(10, 390, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_39__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[116])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_6Entity_41__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Entity___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[117])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":2
 * # -*- coding: utf-8 -*-
 * import os             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_os, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_os, __pyx_t_3) < 0) __PYX_ERR(11, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":72
 *             return None
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef char* to_string_c
 *         campl.AMPL_EnvironmentToString(self._c_env, &to_string_c)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11Environment_13to_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Environment_to_string, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[118])); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_to_string, __pyx_t_3) < 0) __PYX_ERR(11, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":78
 *         return to_string
 * 
 *     def set_bin_dir(self, binary_directory):             # <<<<<<<<<<<<<<
 *         """
 *         Set the location where AMPL API will search for the AMPL executable.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11Environment_15set_bin_dir, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Environment_set_bin_dir, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[119])); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_set_bin_dir, __pyx_t_3) < 0) __PYX_ERR(11, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":87
 *         campl.AMPL_EnvironmentSetBinaryDirectory(self._c_env, binary_directory.encode('utf-8'))
 * 
 *     def get_bin_dir(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the location where AMPL API will search for the AMPL executable.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11Environment_17get_bin_dir, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Environment_get_bin_dir, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[120])); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_get_bin_dir, __pyx_t_3) < 0) __PYX_ERR(11, 87, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":96
 *         return bin_dir
 * 
 *     def set_bin_name(self, binary_name):             # <<<<<<<<<<<<<<
 *         """
 *         Set the name of the AMPL executable.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11Environment_19set_bin_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Environment_set_bin_name, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[121])); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_set_bin_name, __pyx_t_3) < 0) __PYX_ERR(11, 96, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":105
 *         campl.AMPL_EnvironmentSetBinaryName(self._c_env, binary_name.encode('utf-8'))
 * 
 *     def get_bin_name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of the AMPL executable.
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11Environment_21get_bin_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Environment_get_bin_name, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[122])); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_get_bin_name, __pyx_t_3) < 0) __PYX_ERR(11, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":115
 * 
 *     # Aliases
 *     toString = to_string             # <<<<<<<<<<<<<<
 *     getBinDir = get_bin_dir
 *     getBinName = get_bin_name
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_to_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_toString, __pyx_t_3) < 0) __PYX_ERR(11, 115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":116
 *     # Aliases
 *     toString = to_string
 *     getBinDir = get_bin_dir             # <<<<<<<<<<<<<<
 *     getBinName = get_bin_name
 *     setBinDir = set_bin_dir
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_get_bin_dir); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_getBinDir, __pyx_t_3) < 0) __PYX_ERR(11, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":117
 *     toString = to_string
 *     getBinDir = get_bin_dir
 *     getBinName = get_bin_name             # <<<<<<<<<<<<<<
 *     setBinDir = set_bin_dir
 *     setBinName = set_bin_name
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_get_bin_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_getBinName, __pyx_t_3) < 0) __PYX_ERR(11, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":118
 *     getBinDir = get_bin_dir
 *     getBinName = get_bin_name
 *     setBinDir = set_bin_dir             # <<<<<<<<<<<<<<
 *     setBinName = set_bin_name
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_set_bin_dir); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_setBinDir, __pyx_t_3) < 0) __PYX_ERR(11, 118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/environment.pxi":119
 *     getBinName = get_bin_name
 *     setBinDir = set_bin_dir
 *     setBinName = set_bin_name             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_set_bin_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(11, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Environment, __pyx_mstate_global->__pyx_n_u_setBinName, __pyx_t_3) < 0) __PYX_ERR(11, 119, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11Environment_23__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Environment___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[123])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11Environment_25__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Environment___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[124])); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/errorhandler.pxi":2
 * # -*- coding: utf-8 -*-
 * import logging             # <<<<<<<<<<<<<<
 * 
 * try:
*/
  __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_logging, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_logging, __pyx_t_3) < 0) __PYX_ERR(12, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "amplpy/errorhandler.pxi":4
 * import logging
 * 
 * try:             # <<<<<<<<<<<<<<
 *     from .tools import _SUPPORT_MESSAGE
 * except Exception:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "amplpy/errorhandler.pxi":5
 * 
 * try:
 *     from .tools import _SUPPORT_MESSAGE             # <<<<<<<<<<<<<<
 * except Exception:
 *     _SUPPORT_MESSAGE = ""
*/
      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_SUPPORT_MESSAGE); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 5, __pyx_L66_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_tools, __pyx_t_3, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 5, __pyx_L66_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_SUPPORT_MESSAGE); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 5, __pyx_L66_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SUPPORT_MESSAGE, __pyx_t_3) < 0) __PYX_ERR(12, 5, __pyx_L66_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "amplpy/errorhandler.pxi":4
 * import logging
 * 
 * try:             # <<<<<<<<<<<<<<
 *     from .tools import _SUPPORT_MESSAGE
 * except Exception:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L71_try_end;
    __pyx_L66_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "amplpy/errorhandler.pxi":6
 * try:
 *     from .tools import _SUPPORT_MESSAGE
 * except Exception:             # <<<<<<<<<<<<<<
 *     _SUPPORT_MESSAGE = ""
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(12, 6, __pyx_L68_except_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "amplpy/errorhandler.pxi":7
 *     from .tools import _SUPPORT_MESSAGE
 * except Exception:
 *     _SUPPORT_MESSAGE = ""             # <<<<<<<<<<<<<<
 * 
 * logger = logging.getLogger("amplpy")
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SUPPORT_MESSAGE, __pyx_mstate_global->__pyx_kp_u__3) < 0) __PYX_ERR(12, 7, __pyx_L68_except_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L67_exception_handled;
    }
    goto __pyx_L68_except_error;

    /* "amplpy/errorhandler.pxi":4
 * import logging
 * 
 * try:             # <<<<<<<<<<<<<<
 *     from .tools import _SUPPORT_MESSAGE
 * except Exception:
*/
    __pyx_L68_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L67_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    __pyx_L71_try_end:;
  }

  /* "amplpy/errorhandler.pxi":9
 *     _SUPPORT_MESSAGE = ""
 * 
 * logger = logging.getLogger("amplpy")             # <<<<<<<<<<<<<<
 * logger.setLevel(logging.WARNING)
 * 
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_logging); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_getLogger); if (unlikely(!__pyx_t_9)) __PYX_ERR(12, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_amplpy};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_logger, __pyx_t_2) < 0) __PYX_ERR(12, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/errorhandler.pxi":10
 * 
 * logger = logging.getLogger("amplpy")
 * logger.setLevel(logging.WARNING)             # <<<<<<<<<<<<<<
 * 
 * if not logger.hasHandlers():
*/
  __pyx_t_9 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setLevel); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_WARNING); if (unlikely(!__pyx_t_10)) __PYX_ERR(12, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 10, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/errorhandler.pxi":12
 * logger.setLevel(logging.WARNING)
 * 
 * if not logger.hasHandlers():             # <<<<<<<<<<<<<<
 *     handler = logging.StreamHandler()
 *     formatter = logging.Formatter("[%(levelname)s] %(message)s")
*/
  __pyx_t_7 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_logger); if (unlikely(!__pyx_t_10)) __PYX_ERR(12, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_hasHandlers); if (unlikely(!__pyx_t_9)) __PYX_ERR(12, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(12, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_12 = (!__pyx_t_11);
  if (__pyx_t_12) {

    /* "amplpy/errorhandler.pxi":13
 * 
 * if not logger.hasHandlers():
 *     handler = logging.StreamHandler()             # <<<<<<<<<<<<<<
 *     formatter = logging.Formatter("[%(levelname)s] %(message)s")
 *     handler.setFormatter(formatter)
*/
    __pyx_t_9 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_logging); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_StreamHandler); if (unlikely(!__pyx_t_10)) __PYX_ERR(12, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_handler, __pyx_t_2) < 0) __PYX_ERR(12, 13, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/errorhandler.pxi":14
 * if not logger.hasHandlers():
 *     handler = logging.StreamHandler()
 *     formatter = logging.Formatter("[%(levelname)s] %(message)s")             # <<<<<<<<<<<<<<
 *     handler.setFormatter(formatter)
 *     logger.addHandler(handler)
*/
    __pyx_t_10 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_logging); if (unlikely(!__pyx_t_9)) __PYX_ERR(12, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Formatter); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_levelname_s_message_s};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_formatter, __pyx_t_2) < 0) __PYX_ERR(12, 14, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/errorhandler.pxi":15
 *     handler = logging.StreamHandler()
 *     formatter = logging.Formatter("[%(levelname)s] %(message)s")
 *     handler.setFormatter(formatter)             # <<<<<<<<<<<<<<
 *     logger.addHandler(handler)
 *     logger.propagate = False
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_handler); if (unlikely(!__pyx_t_10)) __PYX_ERR(12, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_setFormatter); if (unlikely(!__pyx_t_9)) __PYX_ERR(12, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_formatter); if (unlikely(!__pyx_t_10)) __PYX_ERR(12, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/errorhandler.pxi":16
 *     formatter = logging.Formatter("[%(levelname)s] %(message)s")
 *     handler.setFormatter(formatter)
 *     logger.addHandler(handler)             # <<<<<<<<<<<<<<
 *     logger.propagate = False
 * 
*/
    __pyx_t_9 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_logger); if (unlikely(!__pyx_t_10)) __PYX_ERR(12, 16, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_addHandler); if (unlikely(!__pyx_t_7)) __PYX_ERR(12, 16, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_handler); if (unlikely(!__pyx_t_10)) __PYX_ERR(12, 16, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/errorhandler.pxi":17
 *     handler.setFormatter(formatter)
 *     logger.addHandler(handler)
 *     logger.propagate = False             # <<<<<<<<<<<<<<
 * 
 * def display_error_message(exception, error=True):
*/
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 17, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_propagate, Py_False) < 0) __PYX_ERR(12, 17, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "amplpy/errorhandler.pxi":12
 * logger.setLevel(logging.WARNING)
 * 
 * if not logger.hasHandlers():             # <<<<<<<<<<<<<<
 *     handler = logging.StreamHandler()
 *     formatter = logging.Formatter("[%(levelname)s] %(message)s")
*/
  }

  /* "amplpy/errorhandler.pxi":19
 *     logger.propagate = False
 * 
 * def display_error_message(exception, error=True):             # <<<<<<<<<<<<<<
 *     logger.setLevel(logging.WARNING)
 *     msg = "\t" + str(exception).replace(_SUPPORT_MESSAGE, "").replace("\n", "\n\t")
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_1display_error_message, 0, __pyx_mstate_global->__pyx_n_u_display_error_message, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[125])); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[18]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_display_error_message, __pyx_t_2) < 0) __PYX_ERR(12, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/errorhandler.pxi":38
 *     """
 * 
 *     def error(self, exception):             # <<<<<<<<<<<<<<
 *         """
 *         Receives notification of an error.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_12ErrorHandler_1error, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorHandler_error, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[126])); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler, __pyx_mstate_global->__pyx_n_u_error, __pyx_t_2) < 0) __PYX_ERR(12, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/errorhandler.pxi":45
 *         raise exception
 * 
 *     def warning(self, exception):             # <<<<<<<<<<<<<<
 *         """
 *         Receives notification of a warning.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_12ErrorHandler_3warning, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorHandler_warning, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[127])); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler, __pyx_mstate_global->__pyx_n_u_warning, __pyx_t_2) < 0) __PYX_ERR(12, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_12ErrorHandler_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorHandler___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[128])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ErrorHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ErrorHandler__set_state(self, __pyx_state)
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_12ErrorHandler_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ErrorHandler___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[129])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_ErrorHandler, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":16
 *         self.message = message
 * 
 *     def get_source_name(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the name of the file where the error was detected.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13AMPLException_3get_source_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPLException_get_source_name, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[130])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_source_name, __pyx_t_2) < 0) __PYX_ERR(2, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":22
 *         return self.source_name
 * 
 *     def get_line_number(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the row where the error is located.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13AMPLException_5get_line_number, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPLException_get_line_number, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[131])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_line_number, __pyx_t_2) < 0) __PYX_ERR(2, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":28
 *         return self.line_number
 * 
 *     def get_offset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the offset where the error is located.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13AMPLException_7get_offset, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPLException_get_offset, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[132])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_offset, __pyx_t_2) < 0) __PYX_ERR(2, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":34
 *         return self.offset
 * 
 *     def get_message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the error message.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13AMPLException_9get_message, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPLException_get_message, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[133])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_message, __pyx_t_2) < 0) __PYX_ERR(2, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":49
 * 
 *     # Aliases
 *     getLineNumber = get_line_number             # <<<<<<<<<<<<<<
 *     getMessage = get_message
 *     getOffset = get_offset
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_line_number); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_getLineNumber, __pyx_t_2) < 0) __PYX_ERR(2, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":50
 *     # Aliases
 *     getLineNumber = get_line_number
 *     getMessage = get_message             # <<<<<<<<<<<<<<
 *     getOffset = get_offset
 *     getSourceName = get_source_name
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_getMessage, __pyx_t_2) < 0) __PYX_ERR(2, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":51
 *     getLineNumber = get_line_number
 *     getMessage = get_message
 *     getOffset = get_offset             # <<<<<<<<<<<<<<
 *     getSourceName = get_source_name
 * 
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_getOffset, __pyx_t_2) < 0) __PYX_ERR(2, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":52
 *     getMessage = get_message
 *     getOffset = get_offset
 *     getSourceName = get_source_name             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_get_source_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_getSourceName, __pyx_t_2) < 0) __PYX_ERR(2, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13AMPLException_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPLException___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[134])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_AMPLException, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_AMPLException__set_state(self, __pyx_state)
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13AMPLException_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPLException___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[135])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPLException, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":55
 * 
 * 
 * class PresolveException(RuntimeError):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[20]); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_PresolveException, __pyx_mstate_global->__pyx_n_u_PresolveException, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_2 != __pyx_mstate_global->__pyx_tuple[20]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_10, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[20]) < 0))) __PYX_ERR(2, 55, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_PresolveException, __pyx_t_2, __pyx_t_10, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PresolveException, __pyx_t_9) < 0) __PYX_ERR(2, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/exceptions.pxi":59
 * 
 * 
 * class InfeasibilityException(RuntimeError):             # <<<<<<<<<<<<<<
 *     pass
*/
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[22]); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_InfeasibilityException, __pyx_mstate_global->__pyx_n_u_InfeasibilityException, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, (PyObject *) NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_2 != __pyx_mstate_global->__pyx_tuple[22]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_10, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[22]) < 0))) __PYX_ERR(2, 59, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_InfeasibilityException, __pyx_t_2, __pyx_t_10, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_InfeasibilityException, __pyx_t_9) < 0) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11EnvIterator_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EnvIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[136])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin,self.end,self.env_c,self.iterator cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11EnvIterator_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EnvIterator___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[137])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/iterators.pxi":105
 *         return create_entity(self.entity_class, self._ampl, name_c, NULL, None)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9EntityMap_9size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EntityMap_size, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[138])); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_EntityMap, __pyx_mstate_global->__pyx_n_u_size, __pyx_t_2) < 0) __PYX_ERR(6, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9EntityMap_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EntityMap___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[139])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9EntityMap_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EntityMap___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[140])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/iterators.pxi":173
 *         return create_entity(self.entity_class, self._ampl, self._name, tuple_c, self._entity)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_16InstanceIterator_9size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InstanceIterator_size, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[141])); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_InstanceIterator, __pyx_mstate_global->__pyx_n_u_size, __pyx_t_2) < 0) __PYX_ERR(6, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_16InstanceIterator_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InstanceIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[142])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.begin cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_16InstanceIterator_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_InstanceIterator___setstate_cyth, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[143])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/iterators.pxi":218
 *             self.begin = NULL
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         return int(self._size)
 * 
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_19MemberRangeIterator_3size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MemberRangeIterator_size, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[144])); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_MemberRangeIterator, __pyx_mstate_global->__pyx_n_u_size, __pyx_t_2) < 0) __PYX_ERR(6, 218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_19MemberRangeIterator_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MemberRangeIterator___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[145])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl,self._index,self.begin cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_19MemberRangeIterator_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MemberRangeIterator___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[146])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11ColIterator_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ColIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[147])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11ColIterator_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ColIterator___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[148])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11RowIterator_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RowIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[149])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._df cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_11RowIterator_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RowIterator___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[150])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":37
 *         return entity
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the value of the objective.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_1value, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_value, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[151])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_value, __pyx_t_2) < 0) __PYX_ERR(13, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":45
 *         return value
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the AMPL status.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_3astatus, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_astatus, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[152])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_astatus, __pyx_t_2) < 0) __PYX_ERR(13, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":59
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the solver status.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_5sstatus, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_sstatus, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[153])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_sstatus, __pyx_t_2) < 0) __PYX_ERR(13, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":73
 *         return value
 * 
 *     def exitcode(self):             # <<<<<<<<<<<<<<
 *         """
 *         Exit code returned by solver after most recent solve with this
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_7exitcode, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_exitcode, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[154])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_exitcode, __pyx_t_2) < 0) __PYX_ERR(13, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":82
 *         return value
 * 
 *     def message(self):             # <<<<<<<<<<<<<<
 *         """
 *         Result message returned by solver after most recent solve with this
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_9message, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_message, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[155])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_message, __pyx_t_2) < 0) __PYX_ERR(13, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":97
 *         return value
 * 
 *     def result(self):             # <<<<<<<<<<<<<<
 *         """
 *         Result string returned by solver after most recent solve with this
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_11result, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_result, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[156])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_result, __pyx_t_2) < 0) __PYX_ERR(13, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":112
 *         return value
 * 
 *     def drop(self):             # <<<<<<<<<<<<<<
 *         """
 *         Drop this objective instance.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_13drop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_drop, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[157])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_drop, __pyx_t_2) < 0) __PYX_ERR(13, 112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":118
 *         PY_AMPL_CALL(campl.AMPL_EntityDrop(self._ampl._c_ampl, self._name))
 * 
 *     def restore(self):             # <<<<<<<<<<<<<<
 *         """
 *         Restore this objective (if it had been dropped, no effect otherwise).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_15restore, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_restore, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[158])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_restore, __pyx_t_2) < 0) __PYX_ERR(13, 118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/objective.pxi":124
 *         PY_AMPL_CALL(campl.AMPL_EntityRestore(self._ampl._c_ampl, self._name))
 * 
 *     def minimization(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the sense of this objective. Returns True if minimize,
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_17minimization, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective_minimization, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[159])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Objective, __pyx_mstate_global->__pyx_n_u_minimization, __pyx_t_2) < 0) __PYX_ERR(13, 124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_19__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[160])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Objective_21__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Objective___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[161])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/outputhandler.pxi":17
 *     """
 * 
 *     def output(self, kind, msg):             # <<<<<<<<<<<<<<
 *         """
 *         This method is called when AMPL sends some output derived from
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13OutputHandler_1output, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OutputHandler_output, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[162])); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_OutputHandler, __pyx_mstate_global->__pyx_n_u_output, __pyx_t_2) < 0) __PYX_ERR(3, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13OutputHandler_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OutputHandler___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[163])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_OutputHandler, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_OutputHandler, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_OutputHandler__set_state(self, __pyx_state)
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_13OutputHandler_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OutputHandler___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[164])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_OutputHandler, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/outputhandler.pxi":33
 *     PyOutputHandler.output(kind, msg.decode('utf-8'))
 * 
 * class Kind(object):             # <<<<<<<<<<<<<<
 *     """
 *     Represents the type of the output coming from the interpreter.
*/
  __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_mstate_global->__pyx_tuple[24]); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_Kind, __pyx_mstate_global->__pyx_n_u_Kind, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_kp_u_Represents_the_type_of_the_outp); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_2 != __pyx_mstate_global->__pyx_tuple[24]) {
    if (unlikely((PyDict_SetItemString(__pyx_t_10, "__orig_bases__", __pyx_mstate_global->__pyx_tuple[24]) < 0))) __PYX_ERR(3, 33, __pyx_L1_error)
  }

  /* "amplpy/outputhandler.pxi":38
 *     """
 * 
 *     WAITING = campl.AMPL_OUTPUT_WAITING             # <<<<<<<<<<<<<<
 *     """
 *     Output ``prompt2``, returned when incomplete statements are interpreted.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_WAITING); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_WAITING, __pyx_t_9) < 0) __PYX_ERR(3, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":43
 *     """
 * 
 *     BREAK = campl.AMPL_OUTPUT_BREAK             # <<<<<<<<<<<<<<
 *     """
 *     Output ``break``, displayed when an operation is interrupted with SIGINT.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_BREAK); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_BREAK, __pyx_t_9) < 0) __PYX_ERR(3, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":48
 *     """
 * 
 *     CD = campl.AMPL_OUTPUT_CD             # <<<<<<<<<<<<<<
 *     """
 *     Output ``cd``, returned by the ``cd`` function.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_CD); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_CD, __pyx_t_9) < 0) __PYX_ERR(3, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":53
 *     """
 * 
 *     DISPLAY = campl.AMPL_OUTPUT_DISPLAY             # <<<<<<<<<<<<<<
 *     """
 *     Output ``display``, returned by the ``display`` function.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_DISPLAY); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DISPLAY, __pyx_t_9) < 0) __PYX_ERR(3, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":58
 *     """
 * 
 *     EXIT = campl.AMPL_OUTPUT_EXIT             # <<<<<<<<<<<<<<
 *     """
 *     Output ``exit``, returned as last message from AMPL before exiting the
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_EXIT); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_EXIT, __pyx_t_9) < 0) __PYX_ERR(3, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":64
 *     """
 * 
 *     EXPAND = campl.AMPL_OUTPUT_EXPAND             # <<<<<<<<<<<<<<
 *     """
 *     Output ``expand``, returned by the ``expand`` function.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_EXPAND); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_EXPAND, __pyx_t_9) < 0) __PYX_ERR(3, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":69
 *     """
 * 
 *     LOAD = campl.AMPL_OUTPUT_LOAD             # <<<<<<<<<<<<<<
 *     """
 *     Output ``load``, returned by the ``load`` function when loading a library.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_LOAD); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_LOAD, __pyx_t_9) < 0) __PYX_ERR(3, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":74
 *     """
 * 
 *     OPTION = campl.AMPL_OUTPUT_OPTION             # <<<<<<<<<<<<<<
 *     """
 *     Output ``option``, returned by the ``option`` function when getting the
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_OPTION); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_OPTION, __pyx_t_9) < 0) __PYX_ERR(3, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":80
 *     """
 * 
 *     PRINT = campl.AMPL_OUTPUT_PRINT             # <<<<<<<<<<<<<<
 *     """
 *     Output ``print``, returned by the ``print`` function when printing values
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_PRINT); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_PRINT, __pyx_t_9) < 0) __PYX_ERR(3, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":86
 *     """
 * 
 *     PROMPT = campl.AMPL_OUTPUT_PROMPT  # prompt1 and prompt3             # <<<<<<<<<<<<<<
 *     """
 *     Output ``prompt1``, normal AMPL prompt.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_PROMPT); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_PROMPT, __pyx_t_9) < 0) __PYX_ERR(3, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":91
 *     """
 * 
 *     SOLUTION = campl.AMPL_OUTPUT_SOLUTION             # <<<<<<<<<<<<<<
 *     """
 *     Output ``solution``, returned when loading a solution with the command
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_SOLUTION); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SOLUTION, __pyx_t_9) < 0) __PYX_ERR(3, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":97
 *     """
 * 
 *     SOLVE = campl.AMPL_OUTPUT_SOLVE             # <<<<<<<<<<<<<<
 *     """
 *     Output ``solve``, returned by the ``solve`` function, contains the solver
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_SOLVE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SOLVE, __pyx_t_9) < 0) __PYX_ERR(3, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":103
 *     """
 * 
 *     SHOW = campl.AMPL_OUTPUT_SHOW             # <<<<<<<<<<<<<<
 *     """
 *     Output ``show``, returned by the ``show`` function.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_SHOW); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SHOW, __pyx_t_9) < 0) __PYX_ERR(3, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":108
 *     """
 * 
 *     XREF = campl.AMPL_OUTPUT_XREF             # <<<<<<<<<<<<<<
 *     """
 *     Output ``xref``, returned by the ``xref`` function.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_XREF); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_XREF, __pyx_t_9) < 0) __PYX_ERR(3, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":113
 *     """
 * 
 *     SHELL_OUTPUT = campl.AMPL_OUTPUT_SHELL_OUTPUT             # <<<<<<<<<<<<<<
 *     """
 *     Output of the AMPL command ``shell``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_SHELL_OUTPUT); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SHELL_OUTPUT, __pyx_t_9) < 0) __PYX_ERR(3, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":118
 *     """
 * 
 *     SHELL_MESSAGE = campl.AMPL_OUTPUT_SHELL_MESSAGE             # <<<<<<<<<<<<<<
 *     """
 *     Messages from the command ``shell``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_SHELL_MESSAGE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SHELL_MESSAGE, __pyx_t_9) < 0) __PYX_ERR(3, 118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":123
 *     """
 * 
 *     MISC = campl.AMPL_OUTPUT_MISC             # <<<<<<<<<<<<<<
 *     """
 *     Output ``misc``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_MISC); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_MISC, __pyx_t_9) < 0) __PYX_ERR(3, 123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":128
 *     """
 * 
 *     WRITE_TABLE = campl.AMPL_OUTPUT_WRITE_TABLE             # <<<<<<<<<<<<<<
 *     """
 *     Messages from the command ``write table``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_WRITE_TABLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_WRITE_TABLE, __pyx_t_9) < 0) __PYX_ERR(3, 128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":133
 *     """
 * 
 *     READ_TABLE = campl.AMPL_OUTPUT_READ_TABLE             # <<<<<<<<<<<<<<
 *     """
 *     Messages from the command ``read table``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_READ_TABLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_READ_TABLE, __pyx_t_9) < 0) __PYX_ERR(3, 133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":138
 *     """
 * 
 *     _READTABLE = campl.AMPL_OUTPUT_READTABLE             # <<<<<<<<<<<<<<
 *     """
 *     Internal messages from the command ``read table``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_READTABLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_READTABLE, __pyx_t_9) < 0) __PYX_ERR(3, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":143
 *     """
 * 
 *     _WRITETABLE = campl.AMPL_OUTPUT_WRITETABLE             # <<<<<<<<<<<<<<
 *     """
 *     Internal messages from the command ``write table``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_WRITETABLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_WRITETABLE, __pyx_t_9) < 0) __PYX_ERR(3, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":148
 *     """
 * 
 *     BREAKPOINT = campl.AMPL_OUTPUT_BREAKPOINT             # <<<<<<<<<<<<<<
 *     """
 *     Breakpoint hit.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_BREAKPOINT); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_BREAKPOINT, __pyx_t_9) < 0) __PYX_ERR(3, 148, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":153
 *     """
 * 
 *     CALL = campl.AMPL_OUTPUT_CALL             # <<<<<<<<<<<<<<
 *     """
 *     Output of a script ``call``.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_CALL); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_CALL, __pyx_t_9) < 0) __PYX_ERR(3, 153, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":158
 *     """
 * 
 *     CHECK = campl.AMPL_OUTPUT_CHECK             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``check`` operation.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_CHECK); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_CHECK, __pyx_t_9) < 0) __PYX_ERR(3, 158, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":163
 *     """
 * 
 *     CLOSE = campl.AMPL_OUTPUT_CLOSE             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``close`` command for output redirection.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_CLOSE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_CLOSE, __pyx_t_9) < 0) __PYX_ERR(3, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":168
 *     """
 * 
 *     COMMANDS = campl.AMPL_OUTPUT_COMMANDS             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``commands`` call into another file.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_COMMANDS); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_COMMANDS, __pyx_t_9) < 0) __PYX_ERR(3, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":173
 *     """
 * 
 *     CONTINUE = campl.AMPL_OUTPUT_CONTINUE             # <<<<<<<<<<<<<<
 *     """
 *     Issued when ``continue`` is encountered.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_CONTINUE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_CONTINUE, __pyx_t_9) < 0) __PYX_ERR(3, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":178
 *     """
 * 
 *     DATA = campl.AMPL_OUTPUT_DATA             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``data`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_DATA); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DATA, __pyx_t_9) < 0) __PYX_ERR(3, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":183
 *     """
 * 
 *     DELETECMD = campl.AMPL_OUTPUT_DELETECMD             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``delete`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_DELETECMD); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DELETECMD, __pyx_t_9) < 0) __PYX_ERR(3, 183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":188
 *     """
 * 
 *     DROP = campl.AMPL_OUTPUT_DROP             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``drop`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_DROP); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DROP, __pyx_t_9) < 0) __PYX_ERR(3, 188, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":193
 *     """
 * 
 *     DROP_OR_RESTORE_ALL = campl.AMPL_OUTPUT_DROP_OR_RESTORE_ALL             # <<<<<<<<<<<<<<
 *     """
 *     Internal.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_DROP_OR_RESTORE_ALL); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DROP_OR_RESTORE_ALL, __pyx_t_9) < 0) __PYX_ERR(3, 193, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":198
 *     """
 * 
 *     _ELSE = campl.AMPL_OUTPUT_ELSE             # <<<<<<<<<<<<<<
 *     """
 *     Else block.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_ELSE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ELSE, __pyx_t_9) < 0) __PYX_ERR(3, 198, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":203
 *     """
 * 
 *     ELSE_CHECK = campl.AMPL_OUTPUT_ELSE_CHECK             # <<<<<<<<<<<<<<
 *     """
 *     Internal.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_ELSE_CHECK); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ELSE_CHECK, __pyx_t_9) < 0) __PYX_ERR(3, 203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":208
 *     """
 * 
 *     ENDIF = campl.AMPL_OUTPUT_ENDIF             # <<<<<<<<<<<<<<
 *     """
 *     End of if block.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_ENDIF); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ENDIF, __pyx_t_9) < 0) __PYX_ERR(3, 208, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":213
 *     """
 * 
 *     ENVIRON = campl.AMPL_OUTPUT_ENVIRON             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``environ`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_ENVIRON); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ENVIRON, __pyx_t_9) < 0) __PYX_ERR(3, 213, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":218
 *     """
 * 
 *     FIX = campl.AMPL_OUTPUT_FIX             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``fix`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_FIX); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_FIX, __pyx_t_9) < 0) __PYX_ERR(3, 218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":223
 *     """
 * 
 *     FOR = campl.AMPL_OUTPUT_FOR             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``for`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_FOR); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_FOR, __pyx_t_9) < 0) __PYX_ERR(3, 223, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":228
 *     """
 * 
 *     _IF = campl.AMPL_OUTPUT_IF             # <<<<<<<<<<<<<<
 *     """
 *     Output of an ``if`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_IF); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_IF, __pyx_t_9) < 0) __PYX_ERR(3, 228, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":233
 *     """
 * 
 *     LET = campl.AMPL_OUTPUT_LET             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``let`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_LET); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_LET, __pyx_t_9) < 0) __PYX_ERR(3, 233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":238
 *     """
 * 
 *     LOOPEND = campl.AMPL_OUTPUT_LOOPEND             # <<<<<<<<<<<<<<
 *     """
 *     End of loop.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_LOOPEND); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_LOOPEND, __pyx_t_9) < 0) __PYX_ERR(3, 238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":243
 *     """
 * 
 *     OBJECTIVE = campl.AMPL_OUTPUT_OBJECTIVE             # <<<<<<<<<<<<<<
 *     """
 *     Output of an ``objective`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_OBJECTIVE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_OBJECTIVE, __pyx_t_9) < 0) __PYX_ERR(3, 243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":248
 *     """
 * 
 *     OPTION_RESET = campl.AMPL_OUTPUT_OPTION_RESET             # <<<<<<<<<<<<<<
 *     """
 *     Occurs when resetting option values.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_OPTION_RESET); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_OPTION_RESET, __pyx_t_9) < 0) __PYX_ERR(3, 248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":253
 *     """
 * 
 *     PRINTF = campl.AMPL_OUTPUT_PRINTF             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``printf`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_PRINTF); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_PRINTF, __pyx_t_9) < 0) __PYX_ERR(3, 253, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":258
 *     """
 * 
 *     PROBLEM = campl.AMPL_OUTPUT_PROBLEM             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``problem`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_PROBLEM); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_PROBLEM, __pyx_t_9) < 0) __PYX_ERR(3, 258, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":263
 *     """
 * 
 *     PURGE = campl.AMPL_OUTPUT_PURGE             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``purge`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_PURGE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_PURGE, __pyx_t_9) < 0) __PYX_ERR(3, 263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":268
 *     """
 * 
 *     RBRACE = campl.AMPL_OUTPUT_RBRACE             # <<<<<<<<<<<<<<
 *     """
 *     Occurs when a right brace is encountered.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_RBRACE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_RBRACE, __pyx_t_9) < 0) __PYX_ERR(3, 268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":273
 *     """
 * 
 *     READ = campl.AMPL_OUTPUT_READ             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``read`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_READ); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_READ, __pyx_t_9) < 0) __PYX_ERR(3, 273, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":278
 *     """
 * 
 *     RELOAD = campl.AMPL_OUTPUT_RELOAD             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``reload`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_RELOAD); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_RELOAD, __pyx_t_9) < 0) __PYX_ERR(3, 278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":283
 *     """
 * 
 *     REMOVE = campl.AMPL_OUTPUT_REMOVE             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``remove`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_REMOVE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_REMOVE, __pyx_t_9) < 0) __PYX_ERR(3, 283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":288
 *     """
 * 
 *     REPEAT = campl.AMPL_OUTPUT_REPEAT             # <<<<<<<<<<<<<<
 *     """
 *     Beginning of a repeat loop.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_REPEAT); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_REPEAT, __pyx_t_9) < 0) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":293
 *     """
 * 
 *     REPEAT_END = campl.AMPL_OUTPUT_REPEAT_END             # <<<<<<<<<<<<<<
 *     """
 *     End of a repeat loop.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_REPEAT_END); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_REPEAT_END, __pyx_t_9) < 0) __PYX_ERR(3, 293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":298
 *     """
 * 
 *     RESET = campl.AMPL_OUTPUT_RESET             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``reset`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_RESET); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_RESET, __pyx_t_9) < 0) __PYX_ERR(3, 298, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":303
 *     """
 * 
 *     RESTORE = campl.AMPL_OUTPUT_RESTORE             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``restore`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_RESTORE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_RESTORE, __pyx_t_9) < 0) __PYX_ERR(3, 303, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":308
 *     """
 * 
 *     RUN_ARGS = campl.AMPL_OUTPUT_RUN_ARGS             # <<<<<<<<<<<<<<
 *     """
 *     Internal.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_RUN_ARGS); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_RUN_ARGS, __pyx_t_9) < 0) __PYX_ERR(3, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":313
 *     """
 * 
 *     SEMICOLON = campl.AMPL_OUTPUT_SEMICOLON             # <<<<<<<<<<<<<<
 *     """
 *     Internal.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_SEMICOLON); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SEMICOLON, __pyx_t_9) < 0) __PYX_ERR(3, 313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":318
 *     """
 * 
 *     SSTEP = campl.AMPL_OUTPUT_SSTEP             # <<<<<<<<<<<<<<
 *     """
 *     Internal.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_SSTEP); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_SSTEP, __pyx_t_9) < 0) __PYX_ERR(3, 318, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":323
 *     """
 * 
 *     THEN = campl.AMPL_OUTPUT_THEN             # <<<<<<<<<<<<<<
 *     """
 *     Beginning of the ``then`` part of an if statement.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_THEN); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_THEN, __pyx_t_9) < 0) __PYX_ERR(3, 323, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":328
 *     """
 * 
 *     UNFIX = campl.AMPL_OUTPUT_UNFIX             # <<<<<<<<<<<<<<
 *     """
 *     Output of an ``unfix`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_UNFIX); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_UNFIX, __pyx_t_9) < 0) __PYX_ERR(3, 328, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":333
 *     """
 * 
 *     UNLOAD = campl.AMPL_OUTPUT_UNLOAD             # <<<<<<<<<<<<<<
 *     """
 *     Output of an ``unload`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_UNLOAD); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_UNLOAD, __pyx_t_9) < 0) __PYX_ERR(3, 333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":338
 *     """
 * 
 *     UPDATE = campl.AMPL_OUTPUT_UPDATE             # <<<<<<<<<<<<<<
 *     """
 *     Output of an ``update`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_UPDATE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_UPDATE, __pyx_t_9) < 0) __PYX_ERR(3, 338, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":343
 *     """
 * 
 *     WRITE = campl.AMPL_OUTPUT_WRITE             # <<<<<<<<<<<<<<
 *     """
 *     Output of a ``write`` command.
*/
  __pyx_t_9 = __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUT_WRITE); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_SetNameInClass(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_WRITE, __pyx_t_9) < 0) __PYX_ERR(3, 343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "amplpy/outputhandler.pxi":33
 *     PyOutputHandler.output(kind, msg.decode('utf-8'))
 * 
 * class Kind(object):             # <<<<<<<<<<<<<<
 *     """
 *     Represents the type of the output coming from the interpreter.
*/
  __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Kind, __pyx_t_2, __pyx_t_10, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Kind, __pyx_t_9) < 0) __PYX_ERR(3, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/parameter.pxi":2
 * # -*- coding: utf-8 -*-
 * from numbers import Real             # <<<<<<<<<<<<<<
 * from collections.abc import Iterable
 * 
*/
  __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numbers, __pyx_t_2, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Real, __pyx_t_2) < 0) __PYX_ERR(14, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "amplpy/parameter.pxi":3
 * # -*- coding: utf-8 -*-
 * from numbers import Real
 * from collections.abc import Iterable             # <<<<<<<<<<<<<<
 * 
 * from cpython.pycapsule cimport PyCapsule_GetPointer, PyCapsule_IsValid
*/
  __pyx_t_7 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections_abc, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_7)) __PYX_ERR(14, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Iterable, __pyx_t_7) < 0) __PYX_ERR(14, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/parameter.pxi":7
 * from cpython.pycapsule cimport PyCapsule_GetPointer, PyCapsule_IsValid
 * 
 * import pyarrow as pa             # <<<<<<<<<<<<<<
 * import nanoarrow as na
 * 
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pyarrow, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pa, __pyx_t_2) < 0) __PYX_ERR(14, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/parameter.pxi":8
 * 
 * import pyarrow as pa
 * import nanoarrow as na             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_nanoarrow, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_na, __pyx_t_2) < 0) __PYX_ERR(14, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/parameter.pxi":12
 * 
 * 
 * import itertools             # <<<<<<<<<<<<<<
 * 
 * try:
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_itertools, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_itertools, __pyx_t_2) < 0) __PYX_ERR(14, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/parameter.pxi":14
 * import itertools
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 *     import pandas as pd
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "amplpy/parameter.pxi":15
 * 
 * try:
 *     import pyarrow as pa             # <<<<<<<<<<<<<<
 *     import pandas as pd
 * except ImportError:
*/
      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pyarrow, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 15, __pyx_L75_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pa, __pyx_t_2) < 0) __PYX_ERR(14, 15, __pyx_L75_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/parameter.pxi":16
 * try:
 *     import pyarrow as pa
 *     import pandas as pd             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pd = None
*/
      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pandas, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 16, __pyx_L75_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, __pyx_t_2) < 0) __PYX_ERR(14, 16, __pyx_L75_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/parameter.pxi":14
 * import itertools
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 *     import pandas as pd
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L80_try_end;
    __pyx_L75_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "amplpy/parameter.pxi":17
 *     import pyarrow as pa
 *     import pandas as pd
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pd = None
 * try:
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_10) < 0) __PYX_ERR(14, 17, __pyx_L77_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_10);

      /* "amplpy/parameter.pxi":18
 *     import pandas as pd
 * except ImportError:
 *     pd = None             # <<<<<<<<<<<<<<
 * try:
 *     import polars as pl
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, Py_None) < 0) __PYX_ERR(14, 18, __pyx_L77_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L76_exception_handled;
    }
    goto __pyx_L77_except_error;

    /* "amplpy/parameter.pxi":14
 * import itertools
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pyarrow as pa
 *     import pandas as pd
*/
    __pyx_L77_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L76_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    __pyx_L80_try_end:;
  }

  /* "amplpy/parameter.pxi":19
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import polars as pl
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "amplpy/parameter.pxi":20
 *     pd = None
 * try:
 *     import polars as pl             # <<<<<<<<<<<<<<
 * except ImportError:
 *     pl = None
*/
      __pyx_t_10 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_polars, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 20, __pyx_L83_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pl, __pyx_t_10) < 0) __PYX_ERR(14, 20, __pyx_L83_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "amplpy/parameter.pxi":19
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import polars as pl
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L88_try_end;
    __pyx_L83_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "amplpy/parameter.pxi":21
 * try:
 *     import polars as pl
 * except ImportError:             # <<<<<<<<<<<<<<
 *     pl = None
 * try:
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(14, 21, __pyx_L85_except_error)
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "amplpy/parameter.pxi":22
 *     import polars as pl
 * except ImportError:
 *     pl = None             # <<<<<<<<<<<<<<
 * try:
 *     import numpy as np
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pl, Py_None) < 0) __PYX_ERR(14, 22, __pyx_L85_except_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L84_exception_handled;
    }
    goto __pyx_L85_except_error;

    /* "amplpy/parameter.pxi":19
 * except ImportError:
 *     pd = None
 * try:             # <<<<<<<<<<<<<<
 *     import polars as pl
 * except ImportError:
*/
    __pyx_L85_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L84_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    __pyx_L88_try_end:;
  }

  /* "amplpy/parameter.pxi":23
 * except ImportError:
 *     pl = None
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "amplpy/parameter.pxi":24
 *     pl = None
 * try:
 *     import numpy as np             # <<<<<<<<<<<<<<
 * except ImportError:
 *     np = None
*/
      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(14, 24, __pyx_L91_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_2) < 0) __PYX_ERR(14, 24, __pyx_L91_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "amplpy/parameter.pxi":23
 * except ImportError:
 *     pl = None
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L96_try_end;
    __pyx_L91_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "amplpy/parameter.pxi":25
 * try:
 *     import numpy as np
 * except ImportError:             # <<<<<<<<<<<<<<
 *     np = None
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_10) < 0) __PYX_ERR(14, 25, __pyx_L93_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_10);

      /* "amplpy/parameter.pxi":26
 *     import numpy as np
 * except ImportError:
 *     np = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, Py_None) < 0) __PYX_ERR(14, 26, __pyx_L93_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L92_exception_handled;
    }
    goto __pyx_L93_except_error;

    /* "amplpy/parameter.pxi":23
 * except ImportError:
 *     pl = None
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
    __pyx_L93_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L92_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_1);
    __pyx_L96_try_end:;
  }

  /* "amplpy/parameter.pxi":58
 *         self.set(index, value)
 * 
 *     def is_symbolic(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if the parameter is declared as symbolic (can store both
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Parameter_3is_symbolic, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Parameter_is_symbolic, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[165])); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_is_symbolic, __pyx_t_10) < 0) __PYX_ERR(14, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/parameter.pxi":67
 *         return value
 * 
 *     def has_default(self):             # <<<<<<<<<<<<<<
 *         """
 *         Check if the parameter has a default initial value. In case of the
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Parameter_5has_default, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Parameter_has_default, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[166])); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_has_default, __pyx_t_10) < 0) __PYX_ERR(14, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/parameter.pxi":108
 *         return py_variant
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the value of this parameter. Valid only for non-indexed parameters.
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Parameter_9value, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Parameter_value, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[167])); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_value, __pyx_t_10) < 0) __PYX_ERR(14, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/parameter.pxi":121
 *         return py_variant
 * 
 *     def set(self, *args):             # <<<<<<<<<<<<<<
 *         """
 *         Set the value of a single instance of this parameter.
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Parameter_11set, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Parameter_set, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[168])); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_set, __pyx_t_10) < 0) __PYX_ERR(14, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/parameter.pxi":165
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Assign the values (string or float) to the parameter instances with the
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Parameter_13set_values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Parameter_set_values, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[169])); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_set_values, __pyx_t_10) < 0) __PYX_ERR(14, 165, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/parameter.pxi":215
 * 
 *     # Aliases
 *     hasDefault = has_default             # <<<<<<<<<<<<<<
 *     isSymbolic = is_symbolic
 *     setValues = set_values
*/
  __Pyx_GetNameInClass(__pyx_t_10, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_has_default); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_hasDefault, __pyx_t_10) < 0) __PYX_ERR(14, 215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/parameter.pxi":216
 *     # Aliases
 *     hasDefault = has_default
 *     isSymbolic = is_symbolic             # <<<<<<<<<<<<<<
 *     setValues = set_values
*/
  __Pyx_GetNameInClass(__pyx_t_10, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_is_symbolic); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_isSymbolic, __pyx_t_10) < 0) __PYX_ERR(14, 216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/parameter.pxi":217
 *     hasDefault = has_default
 *     isSymbolic = is_symbolic
 *     setValues = set_values             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_10, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_set_values); if (unlikely(!__pyx_t_10)) __PYX_ERR(14, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Parameter, __pyx_mstate_global->__pyx_n_u_setValues_2, __pyx_t_10) < 0) __PYX_ERR(14, 217, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Parameter_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Parameter___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[170])); if (unlikely(!__pyx_t_10)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_10) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9Parameter_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Parameter___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[171])); if (unlikely(!__pyx_t_10)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_10) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/set.pxi":2
 * # -*- coding: utf-8 -*-
 * from numbers import Real             # <<<<<<<<<<<<<<
 * from collections.abc import Iterable
 * 
*/
  __pyx_t_10 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_10)) __PYX_ERR(15, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_7 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numbers, __pyx_t_10, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(15, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_ImportFrom(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_10)) __PYX_ERR(15, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Real, __pyx_t_10) < 0) __PYX_ERR(15, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "amplpy/set.pxi":3
 * # -*- coding: utf-8 -*-
 * from numbers import Real
 * from collections.abc import Iterable             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_7 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_7)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections_abc, __pyx_t_7, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_7)) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Iterable, __pyx_t_7) < 0) __PYX_ERR(15, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "amplpy/set.pxi":6
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "amplpy/set.pxi":7
 * 
 * try:
 *     import numpy as np             # <<<<<<<<<<<<<<
 * except ImportError:
 *     np = None
*/
      __pyx_t_10 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(15, 7, __pyx_L99_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_10) < 0) __PYX_ERR(15, 7, __pyx_L99_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "amplpy/set.pxi":6
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L104_try_end;
    __pyx_L99_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "amplpy/set.pxi":8
 * try:
 *     import numpy as np
 * except ImportError:             # <<<<<<<<<<<<<<
 *     np = None
 * 
*/
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(15, 8, __pyx_L101_except_error)
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_2);

      /* "amplpy/set.pxi":9
 *     import numpy as np
 * except ImportError:
 *     np = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, Py_None) < 0) __PYX_ERR(15, 9, __pyx_L101_except_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L100_exception_handled;
    }
    goto __pyx_L101_except_error;

    /* "amplpy/set.pxi":6
 * 
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import numpy as np
 * except ImportError:
*/
    __pyx_L101_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L100_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);
    __pyx_L104_try_end:;
  }

  /* "amplpy/set.pxi":53
 *             return self.instances()
 * 
 *     def instances(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get an iterator to iterate over all the instances in a Set.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_5instances, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set_instances, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[172])); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_instances, __pyx_t_2) < 0) __PYX_ERR(15, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":59
 *         return Entity.instances(self)
 * 
 *     def arity(self):             # <<<<<<<<<<<<<<
 *         """
 *         The arity of the set, or number of components in each member of this
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_7arity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set_arity, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[173])); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_arity, __pyx_t_2) < 0) __PYX_ERR(15, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":68
 *         return int(arity)
 * 
 *     def get_values(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get values of this set in a DataFrame. Valid only for non-indexed sets.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_9get_values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set_get_values, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[174])); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_get_values, __pyx_t_2) < 0) __PYX_ERR(15, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":76
 *         return DataFrame.create(df_c)
 * 
 *     def members(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get members (tuples) of this Set. Valid only for non-indexed sets.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_11members, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set_members, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[175])); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_members, __pyx_t_2) < 0) __PYX_ERR(15, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":82
 *         return MemberRangeIterator.create(self._ampl._c_ampl, self._name, self._index, self)
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the number of tuples in this set. Valid only for non-indexed sets.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_13size, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set_size, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[176])); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_size, __pyx_t_2) < 0) __PYX_ERR(15, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":90
 *         return int(size)
 * 
 *     def contains(self, t):             # <<<<<<<<<<<<<<
 *         """
 *         Check wether this set instance contains the specified Tuple.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_15contains, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set_contains, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[177])); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_contains, __pyx_t_2) < 0) __PYX_ERR(15, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":107
 *         return contains_c
 * 
 *     def set_values(self, values):             # <<<<<<<<<<<<<<
 *         """
 *         Set the tuples in this set. Valid only for non-indexed sets.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_17set_values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set_set_values, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[178])); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_set_values, __pyx_t_2) < 0) __PYX_ERR(15, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":200
 * 
 *     # Aliases
 *     getValues = get_values             # <<<<<<<<<<<<<<
 *     setValues = set_values
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_get_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_getValues, __pyx_t_2) < 0) __PYX_ERR(15, 200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/set.pxi":201
 *     # Aliases
 *     getValues = get_values
 *     setValues = set_values             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_set_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(15, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Set, __pyx_mstate_global->__pyx_n_u_setValues_2, __pyx_t_2) < 0) __PYX_ERR(15, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_19__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[179])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3Set_21__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Set___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[180])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":39
 *         self.__getitem__(index).set_value(value)
 * 
 *     def value(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of this variable.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_3value, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_value, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[181])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_value, __pyx_t_2) < 0) __PYX_ERR(16, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":47
 *         return value
 * 
 *     def fix(self, value=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fix all instances of this variable to a value if provided or to
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_5fix, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_fix, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[182])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_fix, __pyx_t_2) < 0) __PYX_ERR(16, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":60
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceFixToValue(self._ampl._c_ampl, self._name, self._index, value))
 * 
 *     def unfix(self):             # <<<<<<<<<<<<<<
 *         """
 *         Unfix all instances of this variable.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_7unfix, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_unfix, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[183])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_unfix, __pyx_t_2) < 0) __PYX_ERR(16, 60, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":66
 *         PY_AMPL_CALL(campl.AMPL_VariableInstanceUnfix(self._ampl._c_ampl, self._name, self._index))
 * 
 *     def set_value(self, value):             # <<<<<<<<<<<<<<
 *         """
 *         Set the current value of this variable (does not fix it),
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_9set_value, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_set_value, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[184])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_set_value, __pyx_t_2) < 0) __PYX_ERR(16, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":79
 *             PY_AMPL_CALL(campl.AMPL_VariableInstanceSetValue(self._ampl._c_ampl, self._name, self._index, float(value)))
 * 
 *     def astatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the AMPL status (fixed, presolved, or substituted out).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_11astatus, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_astatus, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[185])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_astatus, __pyx_t_2) < 0) __PYX_ERR(16, 79, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":93
 *         return value
 * 
 *     def defeqn(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the index in `_con` of "defining constraint" used to substitute
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_13defeqn, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_defeqn, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[186])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_defeqn, __pyx_t_2) < 0) __PYX_ERR(16, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":102
 *         return value
 * 
 *     def dual(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the dual value on defining constraint of variable substituted out.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_15dual, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_dual, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[187])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_dual, __pyx_t_2) < 0) __PYX_ERR(16, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":110
 *         return value
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current initial guess.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_17init, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_init, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[188])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_init_2, __pyx_t_2) < 0) __PYX_ERR(16, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":118
 *         return value
 * 
 *     def init0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the original initial guess (set by `:=` or`default` or by a data
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_19init0, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_init0, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[189])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_init0, __pyx_t_2) < 0) __PYX_ERR(16, 118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":127
 *         return value
 * 
 *     def lb(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current lower bound.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_21lb, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_lb, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[190])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_lb, __pyx_t_2) < 0) __PYX_ERR(16, 127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":135
 *         return value
 * 
 *     def ub(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current upper bound.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_23ub, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_ub, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[191])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_ub, __pyx_t_2) < 0) __PYX_ERR(16, 135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":143
 *         return value
 * 
 *     def lb0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the initial lower bounds, from the var declaration.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_25lb0, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_lb0, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[192])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_lb0, __pyx_t_2) < 0) __PYX_ERR(16, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":151
 *         return value
 * 
 *     def ub0(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the initial upper bound, from the var declaration.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_27ub0, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_ub0, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[193])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_ub0, __pyx_t_2) < 0) __PYX_ERR(16, 151, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":159
 *         return value
 * 
 *     def lb1(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the weaker lower bound from AMPL's presolve phase.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_29lb1, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_lb1, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[194])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_lb1, __pyx_t_2) < 0) __PYX_ERR(16, 159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":167
 *         return value
 * 
 *     def ub1(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the weaker upper bound from AMPL's presolve phase.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_31ub1, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_ub1, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[195])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_ub1, __pyx_t_2) < 0) __PYX_ERR(16, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":175
 *         return value
 * 
 *     def lb2(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the stronger lower bound from AMPL's presolve phase.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_33lb2, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_lb2, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[196])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_lb2, __pyx_t_2) < 0) __PYX_ERR(16, 175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":183
 *         return value
 * 
 *     def ub2(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the stronger upper bound from AMPL's presolve phase.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_35ub2, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_ub2, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[197])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_ub2, __pyx_t_2) < 0) __PYX_ERR(16, 183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":191
 *         return value
 * 
 *     def lrc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the reduced cost at lower bound.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_37lrc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_lrc, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[198])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_lrc, __pyx_t_2) < 0) __PYX_ERR(16, 191, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":199
 *         return value
 * 
 *     def urc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the reduced cost at upper bound.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_39urc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_urc, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[199])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_urc, __pyx_t_2) < 0) __PYX_ERR(16, 199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":207
 *         return value
 * 
 *     def lslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the slack at lower bound (``val - lb``).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_41lslack, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_lslack, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[200])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_lslack, __pyx_t_2) < 0) __PYX_ERR(16, 207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":215
 *         return value
 * 
 *     def uslack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the slack at upper bound (``ub - val``).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_43uslack, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_uslack, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[201])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_uslack, __pyx_t_2) < 0) __PYX_ERR(16, 215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":223
 *         return value
 * 
 *     def rc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the reduced cost (at the nearer bound).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_45rc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_rc, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[202])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_rc, __pyx_t_2) < 0) __PYX_ERR(16, 223, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":231
 *         return value
 * 
 *     def slack(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the bound slack which is the lesser of
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_47slack, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_slack, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[203])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_slack, __pyx_t_2) < 0) __PYX_ERR(16, 231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":240
 *         return value
 * 
 *     def sstatus(self):             # <<<<<<<<<<<<<<
 *         """
 *         Solver status (basis status of variable).
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_49sstatus, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_sstatus, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[204])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_sstatus, __pyx_t_2) < 0) __PYX_ERR(16, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":254
 *         return value
 * 
 *     def status(self):             # <<<<<<<<<<<<<<
 *         """
 *         AMPL status if not `in`, otherwise solver status.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_51status, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable_status, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[205])); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_status, __pyx_t_2) < 0) __PYX_ERR(16, 254, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/variable.pxi":269
 * 
 *     # Aliases
 *     setValue = set_value             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_set_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(16, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_Variable, __pyx_mstate_global->__pyx_n_u_setValue, __pyx_t_2) < 0) __PYX_ERR(16, 269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_53__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[206])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._index cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_8Variable_55__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Variable___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[207])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":36
 * 
 * 
 * def nested_dict_of_suffixes(lst):             # <<<<<<<<<<<<<<
 *     nested = {}
 *     for name, value in lst:
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_3nested_dict_of_suffixes, 0, __pyx_mstate_global->__pyx_n_u_nested_dict_of_suffixes, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[208])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_nested_dict_of_suffixes, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":52
 * 
 * 
 * AMPL_NOT_FOUND_MESSAGE = """             # <<<<<<<<<<<<<<
 * Please make sure that the AMPL directory is in the system search path, or
 * add it before instantiating the AMPL object with:
*/
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_AMPL_NOT_FOUND_MESSAGE, __pyx_mstate_global->__pyx_kp_u_Please_make_sure_that_the_AMPL) < 0) __PYX_ERR(0, 52, __pyx_L1_error)

  /* "amplpy/ampl.pyx":179
 * 
 * 
 *     def get_data(self, *statements):             # <<<<<<<<<<<<<<
 *         """
 *         Get the data corresponding to the display statements. The statements
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_5get_data, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_data, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[209])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_data, __pyx_t_2) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":224
 *         return DataFrame.create(data)
 * 
 *     def get_entity(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get entity corresponding to the specified name (looks for it in all
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_7get_entity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_entity, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[210])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_entity, __pyx_t_2) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":241
 *         return Entity.create(self, name_c, NULL, None)
 * 
 *     def get_variable(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the variable with the corresponding name.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_9get_variable, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_variable, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[211])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_variable, __pyx_t_2) < 0) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":263
 *         return Variable.create(self, name_c, NULL, None)
 * 
 *     def get_constraint(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the constraint with the corresponding name.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_11get_constraint, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_constraint, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[212])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_constraint, __pyx_t_2) < 0) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":285
 *         return Constraint.create(self, name_c, NULL, None)
 * 
 *     def get_objective(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the objective with the corresponding name.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_13get_objective, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_objective, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[213])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_objective, __pyx_t_2) < 0) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":307
 *         return Objective.create(self, name_c, NULL, None)
 * 
 *     def get_set(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the set with the corresponding name.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_15get_set, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_set, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[214])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_set, __pyx_t_2) < 0) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":329
 *         return Set.create(self, name_c, NULL, None)
 * 
 *     def get_parameter(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the parameter with the corresponding name.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_17get_parameter, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_parameter, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[215])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_parameter, __pyx_t_2) < 0) __PYX_ERR(0, 329, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":351
 *         return Parameter.create(self, name_c, NULL, None)
 * 
 *     def eval(self, statements):             # <<<<<<<<<<<<<<
 *         """
 *         Parses AMPL code and evaluates it as a possibly empty sequence of AMPL
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_19eval, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_eval, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[216])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_eval, __pyx_t_2) < 0) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":383
 *         self._error_handler_wrapper.check()
 * 
 *     def get_output(self, statements):             # <<<<<<<<<<<<<<
 *         """
 *         Equivalent to :func:`~amplpy.AMPL.eval` but returns the output as a
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_21get_output, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_output, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[217])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_output, __pyx_t_2) < 0) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":404
 *         return output
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """
 *         Clears all entities in the underlying AMPL interpreter, clears all maps
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_23reset, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_reset, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[218])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_reset, __pyx_t_2) < 0) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":411
 *         PY_AMPL_CALL(campl.AMPL_Reset(self._c_ampl))
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stops the underlying engine, and release all any further attempt to
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_25close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_close, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[219])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_2) < 0) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":422
 *             self._c_ampl = NULL
 * 
 *     def is_running(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the underlying engine is running.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_27is_running, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_is_running, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[220])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_is_running, __pyx_t_2) < 0) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":430
 *         return isrunning
 * 
 *     def solve(self, problem="", solver="", verbose=True, return_output=False, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Solve the current model or the problem specified by ``problem``.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_29solve, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_solve, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[221])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[25]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_solve_2, __pyx_t_2) < 0) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":460
 *             PY_AMPL_CALL(campl.AMPL_Solve(self._c_ampl, problem.encode('utf-8'), solver.encode('utf-8')))
 * 
 *     def cd(self, path=None):             # <<<<<<<<<<<<<<
 *         """
 *         Get or set the current working directory from the underlying
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_31cd, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_cd, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[222])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_cd, __pyx_t_2) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":488
 *         return workdir
 * 
 *     def set_option(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Set an AMPL option to a specified value.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_33set_option, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_set_option, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[223])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_option, __pyx_t_2) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":513
 *             raise TypeError
 * 
 *     def get_option(self, name):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current value of the specified option. If the option does not
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_35get_option, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_option, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[224])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_option, __pyx_t_2) < 0) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":546
 *                     return value
 * 
 *     def read(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Interprets the specified file (script or model or mixed) As a side
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_37read, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_read, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[225])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_read, __pyx_t_2) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":562
 *         self._error_handler_wrapper.check()
 * 
 *     def read_data(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Interprets the specified file as an AMPL data file. As a side effect,
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_39read_data, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_read_data, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[226])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_read_data, __pyx_t_2) < 0) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":579
 *         self._error_handler_wrapper.check()
 * 
 *     def get_value(self, scalar_expression):             # <<<<<<<<<<<<<<
 *         """
 *         Get a scalar value from the underlying AMPL interpreter, as a double or
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_41get_value, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_value, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[227])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_value, __pyx_t_2) < 0) __PYX_ERR(0, 579, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":605
 *         return py_variant
 * 
 *     def set_data(self, data, set_name=None):             # <<<<<<<<<<<<<<
 *         """
 *         Assign the data in the dataframe to the AMPL entities with the names
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_43set_data, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_set_data, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[228])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_data, __pyx_t_2) < 0) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":630
 * 
 * 
 *     def set_data_arrow(self, data, set_name=None):             # <<<<<<<<<<<<<<
 *         cdef DataFrameArrow data_frame
 *         if not isinstance(data, DataFrameArrow):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_45set_data_arrow, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_set_data_arrow, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[229])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_data_arrow, __pyx_t_2) < 0) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":641
 *             PY_AMPL_CALL(campl.AMPL_SetDataArrow(self._c_ampl, data_c, set_name.encode('utf-8')))
 * 
 *     def read_table(self, table_name):             # <<<<<<<<<<<<<<
 *         """
 *         Read the table corresponding to the specified name, equivalent to the
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_47read_table, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_read_table, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[230])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_read_table, __pyx_t_2) < 0) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":655
 *         PY_AMPL_CALL(campl.AMPL_ReadTable(self._c_ampl, table_name.encode('utf-8')))
 * 
 *     def write_table(self, table_name):             # <<<<<<<<<<<<<<
 *         """
 *         Write the table corresponding to the specified name, equivalent to the
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_49write_table, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_write_table, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[231])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_write_table, __pyx_t_2) < 0) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":669
 *         PY_AMPL_CALL(campl.AMPL_WriteTable(self._c_ampl, table_name.encode('utf-8')))
 * 
 *     def display(self, *ampl_expressions):             # <<<<<<<<<<<<<<
 *         """
 *         Writes on the current OutputHandler the outcome of the AMPL statement.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_51display, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_display, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[232])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_display, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":701
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def set_output_handler(self, output_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a new output handler.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_53set_output_handler, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_set_output_handler, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[233])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_output_handler, __pyx_t_2) < 0) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":712
 *         PY_AMPL_CALL(campl.AMPL_SetOutputHandler(self._c_ampl, PyOutput, <void*>output_handler))
 * 
 *     def set_error_handler(self, error_handler):             # <<<<<<<<<<<<<<
 *         """
 *         Sets a new error handler.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_55set_error_handler, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_set_error_handler, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[234])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_error_handler, __pyx_t_2) < 0) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":755
 *         PY_AMPL_CALL(campl.AMPL_SetErrorHandler(self._c_ampl, PyError, <void*>self._error_handler_wrapper))
 * 
 *     def get_output_handler(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current output handler.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_57get_output_handler, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_output_handler, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[235])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_output_handler, __pyx_t_2) < 0) __PYX_ERR(0, 755, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":766
 *         return <OutputHandler>output_handler
 * 
 *     def get_error_handler(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the current error handler.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_59get_error_handler, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_error_handler, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[236])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_error_handler, __pyx_t_2) < 0) __PYX_ERR(0, 766, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":775
 *         return <ErrorHandler>self._error_handler
 * 
 *     def get_variables(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the variables declared.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_61get_variables, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_variables, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[237])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_variables, __pyx_t_2) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":781
 *         return EntityMap.create(self, campl.AMPL_VARIABLE)
 * 
 *     def get_constraints(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the constraints declared.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_63get_constraints, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_constraints, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[238])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_constraints, __pyx_t_2) < 0) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":787
 *         return EntityMap.create(self, campl.AMPL_CONSTRAINT)
 * 
 *     def get_objectives(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the objectives declared.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_65get_objectives, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_objectives, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[239])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_objectives, __pyx_t_2) < 0) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":793
 *         return EntityMap.create(self, campl.AMPL_OBJECTIVE)
 * 
 *     def get_sets(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the sets declared.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_67get_sets, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_sets, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[240])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_sets, __pyx_t_2) < 0) __PYX_ERR(0, 793, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":799
 *         return EntityMap.create(self, campl.AMPL_SET)
 * 
 *     def get_parameters(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get all the parameters declared.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_69get_parameters, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_parameters, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[241])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_parameters, __pyx_t_2) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":805
 *         return EntityMap.create(self, campl.AMPL_PARAMETER)
 * 
 *     def get_current_objective(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get the the current objective. Returns `None` if no objective is set.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_71get_current_objective, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_current_objective, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[242])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_current_objective, __pyx_t_2) < 0) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":821
 *             return self.get_objective(objname)
 * 
 *     def _var(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a variable.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_73_var, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__var, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[243])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_var, __pyx_t_2) < 0) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":844
 *         return Variables(self)
 * 
 *     def _con(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a constraint.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_75_con, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__con, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[244])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_con, __pyx_t_2) < 0) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":867
 *         return Constraints(self)
 * 
 *     def _obj(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get an objective.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_77_obj, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__obj, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[245])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_obj, __pyx_t_2) < 0) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":884
 *         return Objectives(self)
 * 
 *     def _set(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a set.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_79_set, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__set, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[246])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_2, __pyx_t_2) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":904
 *         return Sets(self)
 * 
 *     def _param(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set a parameter.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_81_param, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__param, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[247])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_param, __pyx_t_2) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":927
 *         return Parameters(self)
 * 
 *     def _option(self):             # <<<<<<<<<<<<<<
 *         """
 *         Get/Set an option.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_83_option, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__option, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[248])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_option, __pyx_t_2) < 0) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":948
 *         return Options(self)
 * 
 *     def _set_option(self, options_dict):             # <<<<<<<<<<<<<<
 *         for name, value in options_dict.items():
 *             if isinstance(value, dict):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_85_set_option, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__set_option, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[249])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_option_2, __pyx_t_2) < 0) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":956
 *                 self.set_option(name, value)
 * 
 *     var = property(_var)             # <<<<<<<<<<<<<<
 *     con = property(_con)
 *     obj = property(_obj)
*/
  __pyx_t_7 = NULL;
  __Pyx_INCREF(__pyx_builtin_property);
  __pyx_t_10 = __pyx_builtin_property; 
  __Pyx_GetNameInClass(__pyx_t_9, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_var); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_var_2, __pyx_t_2) < 0) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":957
 * 
 *     var = property(_var)
 *     con = property(_con)             # <<<<<<<<<<<<<<
 *     obj = property(_obj)
 *     set = property(_set)
*/
  __pyx_t_10 = NULL;
  __Pyx_INCREF(__pyx_builtin_property);
  __pyx_t_9 = __pyx_builtin_property; 
  __Pyx_GetNameInClass(__pyx_t_7, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_con); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_con_2, __pyx_t_2) < 0) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":958
 *     var = property(_var)
 *     con = property(_con)
 *     obj = property(_obj)             # <<<<<<<<<<<<<<
 *     set = property(_set)
 *     param = property(_param)
*/
  __pyx_t_9 = NULL;
  __Pyx_INCREF(__pyx_builtin_property);
  __pyx_t_7 = __pyx_builtin_property; 
  __Pyx_GetNameInClass(__pyx_t_10, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_obj); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_10};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_obj_2, __pyx_t_2) < 0) __PYX_ERR(0, 958, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":959
 *     con = property(_con)
 *     obj = property(_obj)
 *     set = property(_set)             # <<<<<<<<<<<<<<
 *     param = property(_param)
 *     option = property(_option, _set_option)
*/
  __pyx_t_7 = NULL;
  __Pyx_INCREF(__pyx_builtin_property);
  __pyx_t_10 = __pyx_builtin_property; 
  __Pyx_GetNameInClass(__pyx_t_9, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set, __pyx_t_2) < 0) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":960
 *     obj = property(_obj)
 *     set = property(_set)
 *     param = property(_param)             # <<<<<<<<<<<<<<
 *     option = property(_option, _set_option)
 * 
*/
  __pyx_t_10 = NULL;
  __Pyx_INCREF(__pyx_builtin_property);
  __pyx_t_9 = __pyx_builtin_property; 
  __Pyx_GetNameInClass(__pyx_t_7, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_param); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_param_2, __pyx_t_2) < 0) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":961
 *     set = property(_set)
 *     param = property(_param)
 *     option = property(_option, _set_option)             # <<<<<<<<<<<<<<
 * 
 *     def export_model(self, filename=""):
*/
  __pyx_t_9 = NULL;
  __Pyx_INCREF(__pyx_builtin_property);
  __pyx_t_7 = __pyx_builtin_property; 
  __Pyx_GetNameInClass(__pyx_t_10, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_option); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GetNameInClass(__pyx_t_3, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_option_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_t_10, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_option_2, __pyx_t_2) < 0) __PYX_ERR(0, 961, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":963
 *     option = property(_option, _set_option)
 * 
 *     def export_model(self, filename=""):             # <<<<<<<<<<<<<<
 *         """
 *         Create a .mod file with the model that has been loaded.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_87export_model, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_export_model, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[250])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[26]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_export_model, __pyx_t_2) < 0) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":981
 *         return output
 * 
 *     def export_data(self, filename=""):             # <<<<<<<<<<<<<<
 *         """
 *         Create a .dat file with the data that has been loaded.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_89export_data, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_export_data, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[251])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[26]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_export_data, __pyx_t_2) < 0) __PYX_ERR(0, 981, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":999
 *         return output
 * 
 *     def snapshot(self, filename="", model=True, data=True, options=True):             # <<<<<<<<<<<<<<
 *         """
 *         Create a snapshot file that replicates the current session.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_91snapshot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_snapshot, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[252])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[27]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_snapshot, __pyx_t_2) < 0) __PYX_ERR(0, 999, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1026
 *         return output
 * 
 *     def write(self, filename, auxfiles=""):             # <<<<<<<<<<<<<<
 *         """
 *         Invoke write command with filename as argument and
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_93write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_write, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[253])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[26]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_2) < 0) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1087
 *         return self.get_value("solve_result_num")
 * 
 *     def get_iis(self, flat=True):             # <<<<<<<<<<<<<<
 *         """
 *         Get IIS attributes for all variables and constraints.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_95get_iis, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_iis, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[254])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[18]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_iis, __pyx_t_2) < 0) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1131
 *         return iis_var, iis_con
 * 
 *     def get_solution(self, flat=True, zeros=False):             # <<<<<<<<<<<<<<
 *         """
 *         Get solution values for all variables.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_97get_solution, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_get_solution, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[255])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[28]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_solution, __pyx_t_2) < 0) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1160
 *         return nested_dict_of_suffixes(lst_solution)
 * 
 *     def _start_recording(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Start recording the session to a file for debug purposes.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_99_start_recording, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__start_recording, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[256])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_start_recording, __pyx_t_2) < 0) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1169
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 1))
 * 
 *     def _stop_recording(self):             # <<<<<<<<<<<<<<
 *         """
 *         Stop recording the session.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_101_stop_recording, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__stop_recording, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[257])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_stop_recording, __pyx_t_2) < 0) __PYX_ERR(0, 1169, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1175
 *         PY_AMPL_CALL(campl.AMPL_SetDblOption(self._c_ampl, "_log", 0))
 * 
 *     def _load_session(self, filename):             # <<<<<<<<<<<<<<
 *         """
 *         Load a recorded session.
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_103_load_session, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL__load_session, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[258])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_load_session, __pyx_t_2) < 0) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1185
 *             print(exp)
 * 
 *     def to_ampls(self, driver, options=None):             # <<<<<<<<<<<<<<
 *         if driver == "gurobi":
 *             try:
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_105to_ampls, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_to_ampls, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[259])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_to_ampls, __pyx_t_2) < 0) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1225
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):             # <<<<<<<<<<<<<<
 *         if isinstance(model, dict):
 *             self.eval(
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_107import_ampls_solution, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_import_ampls_solution, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[260])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[29]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_import_ampls_solution, __pyx_t_2) < 0) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1247
 *             shutil.rmtree(model._tmpdir)
 * 
 *     def to_string(self):             # <<<<<<<<<<<<<<
 *         cdef campl.AMPL_ERRORINFO* errorinfo
 *         cdef char* output_c
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_109to_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL_to_string, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[261])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_to_string, __pyx_t_2) < 0) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1262
 * 
 *     # Aliases
 *     _loadSession = _load_session             # <<<<<<<<<<<<<<
 *     _startRecording = _start_recording
 *     _stopRecording = _stop_recording
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_load_session); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_loadSession, __pyx_t_2) < 0) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1263
 *     # Aliases
 *     _loadSession = _load_session
 *     _startRecording = _start_recording             # <<<<<<<<<<<<<<
 *     _stopRecording = _stop_recording
 *     exportData = export_data
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_start_recording); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_startRecording, __pyx_t_2) < 0) __PYX_ERR(0, 1263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1264
 *     _loadSession = _load_session
 *     _startRecording = _start_recording
 *     _stopRecording = _stop_recording             # <<<<<<<<<<<<<<
 *     exportData = export_data
 *     exportModel = export_model
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_stop_recording); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_stopRecording, __pyx_t_2) < 0) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1265
 *     _startRecording = _start_recording
 *     _stopRecording = _stop_recording
 *     exportData = export_data             # <<<<<<<<<<<<<<
 *     exportModel = export_model
 *     getConstraint = get_constraint
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_export_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_exportData, __pyx_t_2) < 0) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1266
 *     _stopRecording = _stop_recording
 *     exportData = export_data
 *     exportModel = export_model             # <<<<<<<<<<<<<<
 *     getConstraint = get_constraint
 *     getConstraints = get_constraints
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_export_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_exportModel, __pyx_t_2) < 0) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1267
 *     exportData = export_data
 *     exportModel = export_model
 *     getConstraint = get_constraint             # <<<<<<<<<<<<<<
 *     getConstraints = get_constraints
 *     getCurrentObjective = get_current_objective
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_constraint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getConstraint, __pyx_t_2) < 0) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1268
 *     exportModel = export_model
 *     getConstraint = get_constraint
 *     getConstraints = get_constraints             # <<<<<<<<<<<<<<
 *     getCurrentObjective = get_current_objective
 *     getData = get_data
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_constraints); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getConstraints, __pyx_t_2) < 0) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1269
 *     getConstraint = get_constraint
 *     getConstraints = get_constraints
 *     getCurrentObjective = get_current_objective             # <<<<<<<<<<<<<<
 *     getData = get_data
 *     getEntity = get_entity
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_current_objective); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getCurrentObjective, __pyx_t_2) < 0) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1270
 *     getConstraints = get_constraints
 *     getCurrentObjective = get_current_objective
 *     getData = get_data             # <<<<<<<<<<<<<<
 *     getEntity = get_entity
 *     getErrorHandler = get_error_handler
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getData, __pyx_t_2) < 0) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1271
 *     getCurrentObjective = get_current_objective
 *     getData = get_data
 *     getEntity = get_entity             # <<<<<<<<<<<<<<
 *     getErrorHandler = get_error_handler
 *     getObjective = get_objective
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_entity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getEntity, __pyx_t_2) < 0) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1272
 *     getData = get_data
 *     getEntity = get_entity
 *     getErrorHandler = get_error_handler             # <<<<<<<<<<<<<<
 *     getObjective = get_objective
 *     getObjectives = get_objectives
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_error_handler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getErrorHandler, __pyx_t_2) < 0) __PYX_ERR(0, 1272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1273
 *     getEntity = get_entity
 *     getErrorHandler = get_error_handler
 *     getObjective = get_objective             # <<<<<<<<<<<<<<
 *     getObjectives = get_objectives
 *     getOption = get_option
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_objective); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getObjective, __pyx_t_2) < 0) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1274
 *     getErrorHandler = get_error_handler
 *     getObjective = get_objective
 *     getObjectives = get_objectives             # <<<<<<<<<<<<<<
 *     getOption = get_option
 *     getOutput = get_output
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_objectives); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getObjectives, __pyx_t_2) < 0) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1275
 *     getObjective = get_objective
 *     getObjectives = get_objectives
 *     getOption = get_option             # <<<<<<<<<<<<<<
 *     getOutput = get_output
 *     getOutputHandler = get_output_handler
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_option); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getOption, __pyx_t_2) < 0) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1276
 *     getObjectives = get_objectives
 *     getOption = get_option
 *     getOutput = get_output             # <<<<<<<<<<<<<<
 *     getOutputHandler = get_output_handler
 *     getParameter = get_parameter
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_output); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getOutput, __pyx_t_2) < 0) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1277
 *     getOption = get_option
 *     getOutput = get_output
 *     getOutputHandler = get_output_handler             # <<<<<<<<<<<<<<
 *     getParameter = get_parameter
 *     getParameters = get_parameters
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_output_handler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getOutputHandler, __pyx_t_2) < 0) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1278
 *     getOutput = get_output
 *     getOutputHandler = get_output_handler
 *     getParameter = get_parameter             # <<<<<<<<<<<<<<
 *     getParameters = get_parameters
 *     getSet = get_set
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_parameter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getParameter, __pyx_t_2) < 0) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1279
 *     getOutputHandler = get_output_handler
 *     getParameter = get_parameter
 *     getParameters = get_parameters             # <<<<<<<<<<<<<<
 *     getSet = get_set
 *     getSets = get_sets
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_parameters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getParameters, __pyx_t_2) < 0) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1280
 *     getParameter = get_parameter
 *     getParameters = get_parameters
 *     getSet = get_set             # <<<<<<<<<<<<<<
 *     getSets = get_sets
 *     getValue = get_value
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getSet, __pyx_t_2) < 0) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1281
 *     getParameters = get_parameters
 *     getSet = get_set
 *     getSets = get_sets             # <<<<<<<<<<<<<<
 *     getValue = get_value
 *     getVariable = get_variable
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_sets); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getSets, __pyx_t_2) < 0) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1282
 *     getSet = get_set
 *     getSets = get_sets
 *     getValue = get_value             # <<<<<<<<<<<<<<
 *     getVariable = get_variable
 *     getVariables = get_variables
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getValue, __pyx_t_2) < 0) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1283
 *     getSets = get_sets
 *     getValue = get_value
 *     getVariable = get_variable             # <<<<<<<<<<<<<<
 *     getVariables = get_variables
 *     isRunning = is_running
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_variable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getVariable, __pyx_t_2) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1284
 *     getValue = get_value
 *     getVariable = get_variable
 *     getVariables = get_variables             # <<<<<<<<<<<<<<
 *     isRunning = is_running
 *     readData = read_data
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_get_variables); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_getVariables, __pyx_t_2) < 0) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1285
 *     getVariable = get_variable
 *     getVariables = get_variables
 *     isRunning = is_running             # <<<<<<<<<<<<<<
 *     readData = read_data
 *     readTable = read_table
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_is_running); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_isRunning, __pyx_t_2) < 0) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1286
 *     getVariables = get_variables
 *     isRunning = is_running
 *     readData = read_data             # <<<<<<<<<<<<<<
 *     readTable = read_table
 *     setData = set_data
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_read_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_readData, __pyx_t_2) < 0) __PYX_ERR(0, 1286, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1287
 *     isRunning = is_running
 *     readData = read_data
 *     readTable = read_table             # <<<<<<<<<<<<<<
 *     setData = set_data
 *     setErrorHandler = set_error_handler
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_read_table); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_readTable, __pyx_t_2) < 0) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1288
 *     readData = read_data
 *     readTable = read_table
 *     setData = set_data             # <<<<<<<<<<<<<<
 *     setErrorHandler = set_error_handler
 *     setOption = set_option
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_setData, __pyx_t_2) < 0) __PYX_ERR(0, 1288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1289
 *     readTable = read_table
 *     setData = set_data
 *     setErrorHandler = set_error_handler             # <<<<<<<<<<<<<<
 *     setOption = set_option
 *     setOutputHandler = set_output_handler
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_error_handler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_setErrorHandler, __pyx_t_2) < 0) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1290
 *     setData = set_data
 *     setErrorHandler = set_error_handler
 *     setOption = set_option             # <<<<<<<<<<<<<<
 *     setOutputHandler = set_output_handler
 *     toString = to_string
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_option); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_setOption, __pyx_t_2) < 0) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1291
 *     setErrorHandler = set_error_handler
 *     setOption = set_option
 *     setOutputHandler = set_output_handler             # <<<<<<<<<<<<<<
 *     toString = to_string
 *     writeTable = write_table
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_set_output_handler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_setOutputHandler, __pyx_t_2) < 0) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1292
 *     setOption = set_option
 *     setOutputHandler = set_output_handler
 *     toString = to_string             # <<<<<<<<<<<<<<
 *     writeTable = write_table
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_to_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_toString, __pyx_t_2) < 0) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1293
 *     setOutputHandler = set_output_handler
 *     toString = to_string
 *     writeTable = write_table             # <<<<<<<<<<<<<<
*/
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_write_table); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6amplpy_4ampl_AMPL, __pyx_mstate_global->__pyx_n_u_writeTable, __pyx_t_2) < 0) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_113__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[262])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self._c_ampl cannot be converted to a Python object for pickling"
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_4AMPL_115__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_AMPL___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[263])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(8, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_ErrorHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_5__pyx_unpickle_ErrorHandler, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ErrorHandler, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[264])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ErrorHandler, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_ErrorHandler__set_state(<ErrorHandler> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ErrorHandler__set_state(ErrorHandler __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_7__pyx_unpickle_AMPLException, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_AMPLException, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[265])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_AMPLException, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_OutputHandler(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6amplpy_4ampl_9__pyx_unpickle_OutputHandler, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_OutputHandler, NULL, __pyx_mstate_global->__pyx_n_u_amplpy_ampl, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[266])); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_OutputHandler, __pyx_t_2) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "amplpy/ampl.pyx":1
 * # https://cython.readthedocs.io/en/latest/src/tutorial/clibraries.html             # <<<<<<<<<<<<<<
 * import sys
 * 
*/
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init amplpy.ampl", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init amplpy.ampl");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */

typedef struct {
    const char *s;
#if 457 <= 65535
    const unsigned short n;
#elif 457 / 2 < INT_MAX
    const unsigned int n;
#elif 457 / 2 < LONG_MAX
    const unsigned long n;
#else
    const Py_ssize_t n;
#endif
#if 1 <= 31
    const unsigned int encoding : 5;
#elif 1 <= 255
    const unsigned char encoding;
#elif 1 <= 65535
    const unsigned short encoding;
#else
    const Py_ssize_t encoding;
#endif
    const unsigned int is_unicode : 1;
    const unsigned int intern : 1;
} __Pyx_StringTabEntry;
static const char * const __pyx_string_tab_encodings[] = { 0 };
static const __Pyx_StringTabEntry __pyx_string_tab[] = {
  {__pyx_k_75, sizeof(__pyx_k_75), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_75 */
  {__pyx_k_AMPL, sizeof(__pyx_k_AMPL), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL */
  {__pyx_k_AMPLException, sizeof(__pyx_k_AMPLException), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPLException */
  {__pyx_k_AMPLException___reduce_cython, sizeof(__pyx_k_AMPLException___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPLException___reduce_cython */
  {__pyx_k_AMPLException___setstate_cython, sizeof(__pyx_k_AMPLException___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPLException___setstate_cython */
  {__pyx_k_AMPLException_get_line_number, sizeof(__pyx_k_AMPLException_get_line_number), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPLException_get_line_number */
  {__pyx_k_AMPLException_get_message, sizeof(__pyx_k_AMPLException_get_message), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPLException_get_message */
  {__pyx_k_AMPLException_get_offset, sizeof(__pyx_k_AMPLException_get_offset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPLException_get_offset */
  {__pyx_k_AMPLException_get_source_name, sizeof(__pyx_k_AMPLException_get_source_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPLException_get_source_name */
  {__pyx_k_AMPL_NOT_FOUND_MESSAGE, sizeof(__pyx_k_AMPL_NOT_FOUND_MESSAGE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_NOT_FOUND_MESSAGE */
  {__pyx_k_AMPL___reduce_cython, sizeof(__pyx_k_AMPL___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL___reduce_cython */
  {__pyx_k_AMPL___setstate_cython, sizeof(__pyx_k_AMPL___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL___setstate_cython */
  {__pyx_k_AMPL__con, sizeof(__pyx_k_AMPL__con), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__con */
  {__pyx_k_AMPL__load_session, sizeof(__pyx_k_AMPL__load_session), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__load_session */
  {__pyx_k_AMPL__obj, sizeof(__pyx_k_AMPL__obj), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__obj */
  {__pyx_k_AMPL__option, sizeof(__pyx_k_AMPL__option), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__option */
  {__pyx_k_AMPL__param, sizeof(__pyx_k_AMPL__param), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__param */
  {__pyx_k_AMPL__set, sizeof(__pyx_k_AMPL__set), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__set */
  {__pyx_k_AMPL__set_option, sizeof(__pyx_k_AMPL__set_option), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__set_option */
  {__pyx_k_AMPL__start_recording, sizeof(__pyx_k_AMPL__start_recording), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__start_recording */
  {__pyx_k_AMPL__stop_recording, sizeof(__pyx_k_AMPL__stop_recording), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__stop_recording */
  {__pyx_k_AMPL__var, sizeof(__pyx_k_AMPL__var), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL__var */
  {__pyx_k_AMPL_cd, sizeof(__pyx_k_AMPL_cd), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_cd */
  {__pyx_k_AMPL_close, sizeof(__pyx_k_AMPL_close), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_close */
  {__pyx_k_AMPL_could_not_be_started, sizeof(__pyx_k_AMPL_could_not_be_started), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_AMPL_could_not_be_started */
  {__pyx_k_AMPL_display, sizeof(__pyx_k_AMPL_display), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_display */
  {__pyx_k_AMPL_eval, sizeof(__pyx_k_AMPL_eval), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_eval */
  {__pyx_k_AMPL_export_data, sizeof(__pyx_k_AMPL_export_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_export_data */
  {__pyx_k_AMPL_export_model, sizeof(__pyx_k_AMPL_export_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_export_model */
  {__pyx_k_AMPL_get_constraint, sizeof(__pyx_k_AMPL_get_constraint), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_constraint */
  {__pyx_k_AMPL_get_constraints, sizeof(__pyx_k_AMPL_get_constraints), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_constraints */
  {__pyx_k_AMPL_get_current_objective, sizeof(__pyx_k_AMPL_get_current_objective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_current_objective */
  {__pyx_k_AMPL_get_data, sizeof(__pyx_k_AMPL_get_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_data */
  {__pyx_k_AMPL_get_entity, sizeof(__pyx_k_AMPL_get_entity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_entity */
  {__pyx_k_AMPL_get_error_handler, sizeof(__pyx_k_AMPL_get_error_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_error_handler */
  {__pyx_k_AMPL_get_iis, sizeof(__pyx_k_AMPL_get_iis), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_iis */
  {__pyx_k_AMPL_get_objective, sizeof(__pyx_k_AMPL_get_objective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_objective */
  {__pyx_k_AMPL_get_objectives, sizeof(__pyx_k_AMPL_get_objectives), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_objectives */
  {__pyx_k_AMPL_get_option, sizeof(__pyx_k_AMPL_get_option), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_option */
  {__pyx_k_AMPL_get_output, sizeof(__pyx_k_AMPL_get_output), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_output */
  {__pyx_k_AMPL_get_output_handler, sizeof(__pyx_k_AMPL_get_output_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_output_handler */
  {__pyx_k_AMPL_get_parameter, sizeof(__pyx_k_AMPL_get_parameter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_parameter */
  {__pyx_k_AMPL_get_parameters, sizeof(__pyx_k_AMPL_get_parameters), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_parameters */
  {__pyx_k_AMPL_get_set, sizeof(__pyx_k_AMPL_get_set), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_set */
  {__pyx_k_AMPL_get_sets, sizeof(__pyx_k_AMPL_get_sets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_sets */
  {__pyx_k_AMPL_get_solution, sizeof(__pyx_k_AMPL_get_solution), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_solution */
  {__pyx_k_AMPL_get_value, sizeof(__pyx_k_AMPL_get_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_value */
  {__pyx_k_AMPL_get_variable, sizeof(__pyx_k_AMPL_get_variable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_variable */
  {__pyx_k_AMPL_get_variables, sizeof(__pyx_k_AMPL_get_variables), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_get_variables */
  {__pyx_k_AMPL_import_ampls_solution, sizeof(__pyx_k_AMPL_import_ampls_solution), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_import_ampls_solution */
  {__pyx_k_AMPL_is_running, sizeof(__pyx_k_AMPL_is_running), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_is_running */
  {__pyx_k_AMPL_read, sizeof(__pyx_k_AMPL_read), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_read */
  {__pyx_k_AMPL_read_data, sizeof(__pyx_k_AMPL_read_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_read_data */
  {__pyx_k_AMPL_read_table, sizeof(__pyx_k_AMPL_read_table), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_read_table */
  {__pyx_k_AMPL_reset, sizeof(__pyx_k_AMPL_reset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_reset */
  {__pyx_k_AMPL_set_data, sizeof(__pyx_k_AMPL_set_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_set_data */
  {__pyx_k_AMPL_set_data_arrow, sizeof(__pyx_k_AMPL_set_data_arrow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_set_data_arrow */
  {__pyx_k_AMPL_set_error_handler, sizeof(__pyx_k_AMPL_set_error_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_set_error_handler */
  {__pyx_k_AMPL_set_option, sizeof(__pyx_k_AMPL_set_option), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_set_option */
  {__pyx_k_AMPL_set_output_handler, sizeof(__pyx_k_AMPL_set_output_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_set_output_handler */
  {__pyx_k_AMPL_snapshot, sizeof(__pyx_k_AMPL_snapshot), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_snapshot */
  {__pyx_k_AMPL_solve, sizeof(__pyx_k_AMPL_solve), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_solve */
  {__pyx_k_AMPL_to_ampls, sizeof(__pyx_k_AMPL_to_ampls), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_to_ampls */
  {__pyx_k_AMPL_to_string, sizeof(__pyx_k_AMPL_to_string), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_to_string */
  {__pyx_k_AMPL_write, sizeof(__pyx_k_AMPL_write), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_write */
  {__pyx_k_AMPL_write_table, sizeof(__pyx_k_AMPL_write_table), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AMPL_write_table */
  {__pyx_k_A_constraint_called, sizeof(__pyx_k_A_constraint_called), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_A_constraint_called */
  {__pyx_k_A_parameter_called, sizeof(__pyx_k_A_parameter_called), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_A_parameter_called */
  {__pyx_k_A_set_called, sizeof(__pyx_k_A_set_called), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_A_set_called */
  {__pyx_k_A_variable_called, sizeof(__pyx_k_A_variable_called), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_A_variable_called */
  {__pyx_k_All_values_must_be_either_number, sizeof(__pyx_k_All_values_must_be_either_number), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_All_values_must_be_either_number */
  {__pyx_k_An_objective_called, sizeof(__pyx_k_An_objective_called), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_An_objective_called */
  {__pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AssertionError */
  {__pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AttributeError */
  {__pyx_k_BREAK, sizeof(__pyx_k_BREAK), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BREAK */
  {__pyx_k_BREAKPOINT, sizeof(__pyx_k_BREAKPOINT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BREAKPOINT */
  {__pyx_k_CALL, sizeof(__pyx_k_CALL), 0, 1, 1}, /* PyObject cname: __pyx_n_u_CALL */
  {__pyx_k_CD, sizeof(__pyx_k_CD), 0, 1, 1}, /* PyObject cname: __pyx_n_u_CD */
  {__pyx_k_CHECK, sizeof(__pyx_k_CHECK), 0, 1, 1}, /* PyObject cname: __pyx_n_u_CHECK */
  {__pyx_k_CLOSE, sizeof(__pyx_k_CLOSE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_CLOSE */
  {__pyx_k_COMMANDS, sizeof(__pyx_k_COMMANDS), 0, 1, 1}, /* PyObject cname: __pyx_n_u_COMMANDS */
  {__pyx_k_CONTINUE, sizeof(__pyx_k_CONTINUE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_CONTINUE */
  {__pyx_k_Cannot_create_DataFrameArrow_fro, sizeof(__pyx_k_Cannot_create_DataFrameArrow_fro), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_create_DataFrameArrow_fro */
  {__pyx_k_ColIterator, sizeof(__pyx_k_ColIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ColIterator */
  {__pyx_k_ColIterator___reduce_cython, sizeof(__pyx_k_ColIterator___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ColIterator___reduce_cython */
  {__pyx_k_ColIterator___setstate_cython, sizeof(__pyx_k_ColIterator___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ColIterator___setstate_cython */
  {__pyx_k_Column, sizeof(__pyx_k_Column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Column */
  {__pyx_k_Column___reduce_cython, sizeof(__pyx_k_Column___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Column___reduce_cython */
  {__pyx_k_Column___setstate_cython, sizeof(__pyx_k_Column___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Column___setstate_cython */
  {__pyx_k_Column_to_list, sizeof(__pyx_k_Column_to_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Column_to_list */
  {__pyx_k_Column_to_string, sizeof(__pyx_k_Column_to_string), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Column_to_string */
  {__pyx_k_Constraint, sizeof(__pyx_k_Constraint), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint */
  {__pyx_k_Constraint___reduce_cython, sizeof(__pyx_k_Constraint___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint___reduce_cython */
  {__pyx_k_Constraint___setstate_cython, sizeof(__pyx_k_Constraint___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint___setstate_cython */
  {__pyx_k_Constraint_astatus, sizeof(__pyx_k_Constraint_astatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_astatus */
  {__pyx_k_Constraint_body, sizeof(__pyx_k_Constraint_body), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_body */
  {__pyx_k_Constraint_defvar, sizeof(__pyx_k_Constraint_defvar), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_defvar */
  {__pyx_k_Constraint_dinit, sizeof(__pyx_k_Constraint_dinit), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_dinit */
  {__pyx_k_Constraint_dinit0, sizeof(__pyx_k_Constraint_dinit0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_dinit0 */
  {__pyx_k_Constraint_drop, sizeof(__pyx_k_Constraint_drop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_drop */
  {__pyx_k_Constraint_dual, sizeof(__pyx_k_Constraint_dual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_dual */
  {__pyx_k_Constraint_is_logical, sizeof(__pyx_k_Constraint_is_logical), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_is_logical */
  {__pyx_k_Constraint_lb, sizeof(__pyx_k_Constraint_lb), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_lb */
  {__pyx_k_Constraint_lbs, sizeof(__pyx_k_Constraint_lbs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_lbs */
  {__pyx_k_Constraint_ldual, sizeof(__pyx_k_Constraint_ldual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_ldual */
  {__pyx_k_Constraint_lslack, sizeof(__pyx_k_Constraint_lslack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_lslack */
  {__pyx_k_Constraint_restore, sizeof(__pyx_k_Constraint_restore), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_restore */
  {__pyx_k_Constraint_set_dual, sizeof(__pyx_k_Constraint_set_dual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_set_dual */
  {__pyx_k_Constraint_slack, sizeof(__pyx_k_Constraint_slack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_slack */
  {__pyx_k_Constraint_sstatus, sizeof(__pyx_k_Constraint_sstatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_sstatus */
  {__pyx_k_Constraint_status, sizeof(__pyx_k_Constraint_status), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_status */
  {__pyx_k_Constraint_ub, sizeof(__pyx_k_Constraint_ub), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_ub */
  {__pyx_k_Constraint_ubs, sizeof(__pyx_k_Constraint_ubs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_ubs */
  {__pyx_k_Constraint_udual, sizeof(__pyx_k_Constraint_udual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_udual */
  {__pyx_k_Constraint_uslack, sizeof(__pyx_k_Constraint_uslack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_uslack */
  {__pyx_k_Constraint_val, sizeof(__pyx_k_Constraint_val), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraint_val */
  {__pyx_k_Constraints, sizeof(__pyx_k_Constraints), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Constraints */
  {__pyx_k_DATA, sizeof(__pyx_k_DATA), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DATA */
  {__pyx_k_DELETECMD, sizeof(__pyx_k_DELETECMD), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DELETECMD */
  {__pyx_k_DISPLAY, sizeof(__pyx_k_DISPLAY), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DISPLAY */
  {__pyx_k_DROP, sizeof(__pyx_k_DROP), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DROP */
  {__pyx_k_DROP_OR_RESTORE_ALL, sizeof(__pyx_k_DROP_OR_RESTORE_ALL), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DROP_OR_RESTORE_ALL */
  {__pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame */
  {__pyx_k_DataFrameArrow, sizeof(__pyx_k_DataFrameArrow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrameArrow */
  {__pyx_k_DataFrameArrow___reduce_cython, sizeof(__pyx_k_DataFrameArrow___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrameArrow___reduce_cython */
  {__pyx_k_DataFrameArrow___setstate_cython, sizeof(__pyx_k_DataFrameArrow___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrameArrow___setstate_cython */
  {__pyx_k_DataFrameArrow_from_pandas, sizeof(__pyx_k_DataFrameArrow_from_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrameArrow_from_pandas */
  {__pyx_k_DataFrameArrow_from_polars, sizeof(__pyx_k_DataFrameArrow_from_polars), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrameArrow_from_polars */
  {__pyx_k_DataFrame___reduce_cython, sizeof(__pyx_k_DataFrame___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame___reduce_cython */
  {__pyx_k_DataFrame___setstate_cython, sizeof(__pyx_k_DataFrame___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame___setstate_cython */
  {__pyx_k_DataFrame__add_column, sizeof(__pyx_k_DataFrame__add_column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__add_column */
  {__pyx_k_DataFrame__add_row, sizeof(__pyx_k_DataFrame__add_row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__add_row */
  {__pyx_k_DataFrame__from_data_frame_ref, sizeof(__pyx_k_DataFrame__from_data_frame_ref), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__from_data_frame_ref */
  {__pyx_k_DataFrame__get_column, sizeof(__pyx_k_DataFrame__get_column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__get_column */
  {__pyx_k_DataFrame__get_headers, sizeof(__pyx_k_DataFrame__get_headers), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__get_headers */
  {__pyx_k_DataFrame__get_num_cols, sizeof(__pyx_k_DataFrame__get_num_cols), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__get_num_cols */
  {__pyx_k_DataFrame__get_num_indices, sizeof(__pyx_k_DataFrame__get_num_indices), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__get_num_indices */
  {__pyx_k_DataFrame__get_num_rows, sizeof(__pyx_k_DataFrame__get_num_rows), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__get_num_rows */
  {__pyx_k_DataFrame__get_row, sizeof(__pyx_k_DataFrame__get_row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__get_row */
  {__pyx_k_DataFrame__get_row_by_index, sizeof(__pyx_k_DataFrame__get_row_by_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__get_row_by_index */
  {__pyx_k_DataFrame__set_column, sizeof(__pyx_k_DataFrame__set_column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__set_column */
  {__pyx_k_DataFrame__set_values, sizeof(__pyx_k_DataFrame__set_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame__set_values */
  {__pyx_k_DataFrame_from_dict, sizeof(__pyx_k_DataFrame_from_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame_from_dict */
  {__pyx_k_DataFrame_from_numpy, sizeof(__pyx_k_DataFrame_from_numpy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame_from_numpy */
  {__pyx_k_DataFrame_from_pandas, sizeof(__pyx_k_DataFrame_from_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame_from_pandas */
  {__pyx_k_DataFrame_to_dict, sizeof(__pyx_k_DataFrame_to_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame_to_dict */
  {__pyx_k_DataFrame_to_list, sizeof(__pyx_k_DataFrame_to_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame_to_list */
  {__pyx_k_DataFrame_to_pandas, sizeof(__pyx_k_DataFrame_to_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame_to_pandas */
  {__pyx_k_DataFrame_to_string, sizeof(__pyx_k_DataFrame_to_string), 0, 1, 1}, /* PyObject cname: __pyx_n_u_DataFrame_to_string */
  {__pyx_k_Dictionary_must_contain_either_a, sizeof(__pyx_k_Dictionary_must_contain_either_a), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Dictionary_must_contain_either_a */
  {__pyx_k_ELSE, sizeof(__pyx_k_ELSE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ELSE */
  {__pyx_k_ELSE_CHECK, sizeof(__pyx_k_ELSE_CHECK), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ELSE_CHECK */
  {__pyx_k_ENDIF, sizeof(__pyx_k_ENDIF), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ENDIF */
  {__pyx_k_ENVIRON, sizeof(__pyx_k_ENVIRON), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ENVIRON */
  {__pyx_k_EXIT, sizeof(__pyx_k_EXIT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EXIT */
  {__pyx_k_EXPAND, sizeof(__pyx_k_EXPAND), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EXPAND */
  {__pyx_k_Entity, sizeof(__pyx_k_Entity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity */
  {__pyx_k_EntityMap, sizeof(__pyx_k_EntityMap), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EntityMap */
  {__pyx_k_EntityMap___reduce_cython, sizeof(__pyx_k_EntityMap___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EntityMap___reduce_cython */
  {__pyx_k_EntityMap___setstate_cython, sizeof(__pyx_k_EntityMap___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EntityMap___setstate_cython */
  {__pyx_k_EntityMap_size, sizeof(__pyx_k_EntityMap_size), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EntityMap_size */
  {__pyx_k_Entity___reduce_cython, sizeof(__pyx_k_Entity___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity___reduce_cython */
  {__pyx_k_Entity___setstate_cython, sizeof(__pyx_k_Entity___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity___setstate_cython */
  {__pyx_k_Entity_find, sizeof(__pyx_k_Entity_find), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_find */
  {__pyx_k_Entity_get, sizeof(__pyx_k_Entity_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_get */
  {__pyx_k_Entity_get_indexing_sets, sizeof(__pyx_k_Entity_get_indexing_sets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_get_indexing_sets */
  {__pyx_k_Entity_get_values, sizeof(__pyx_k_Entity_get_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_get_values */
  {__pyx_k_Entity_indexarity, sizeof(__pyx_k_Entity_indexarity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_indexarity */
  {__pyx_k_Entity_instances, sizeof(__pyx_k_Entity_instances), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_instances */
  {__pyx_k_Entity_is_scalar, sizeof(__pyx_k_Entity_is_scalar), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_is_scalar */
  {__pyx_k_Entity_name, sizeof(__pyx_k_Entity_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_name */
  {__pyx_k_Entity_num_instances, sizeof(__pyx_k_Entity_num_instances), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_num_instances */
  {__pyx_k_Entity_set_values, sizeof(__pyx_k_Entity_set_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_set_values */
  {__pyx_k_Entity_to_dict, sizeof(__pyx_k_Entity_to_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_to_dict */
  {__pyx_k_Entity_to_list, sizeof(__pyx_k_Entity_to_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_to_list */
  {__pyx_k_Entity_to_pandas, sizeof(__pyx_k_Entity_to_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_to_pandas */
  {__pyx_k_Entity_to_string, sizeof(__pyx_k_Entity_to_string), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_to_string */
  {__pyx_k_Entity_xref, sizeof(__pyx_k_Entity_xref), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Entity_xref */
  {__pyx_k_EnvIterator, sizeof(__pyx_k_EnvIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EnvIterator */
  {__pyx_k_EnvIterator___reduce_cython, sizeof(__pyx_k_EnvIterator___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EnvIterator___reduce_cython */
  {__pyx_k_EnvIterator___setstate_cython, sizeof(__pyx_k_EnvIterator___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_EnvIterator___setstate_cython */
  {__pyx_k_Environment, sizeof(__pyx_k_Environment), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment */
  {__pyx_k_Environment___reduce_cython, sizeof(__pyx_k_Environment___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment___reduce_cython */
  {__pyx_k_Environment___setstate_cython, sizeof(__pyx_k_Environment___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment___setstate_cython */
  {__pyx_k_Environment_get_bin_dir, sizeof(__pyx_k_Environment_get_bin_dir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment_get_bin_dir */
  {__pyx_k_Environment_get_bin_name, sizeof(__pyx_k_Environment_get_bin_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment_get_bin_name */
  {__pyx_k_Environment_set_bin_dir, sizeof(__pyx_k_Environment_set_bin_dir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment_set_bin_dir */
  {__pyx_k_Environment_set_bin_name, sizeof(__pyx_k_Environment_set_bin_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment_set_bin_name */
  {__pyx_k_Environment_to_string, sizeof(__pyx_k_Environment_to_string), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Environment_to_string */
  {__pyx_k_ErrorHandler, sizeof(__pyx_k_ErrorHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ErrorHandler */
  {__pyx_k_ErrorHandlerWrapper, sizeof(__pyx_k_ErrorHandlerWrapper), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ErrorHandlerWrapper */
  {__pyx_k_ErrorHandler___reduce_cython, sizeof(__pyx_k_ErrorHandler___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ErrorHandler___reduce_cython */
  {__pyx_k_ErrorHandler___setstate_cython, sizeof(__pyx_k_ErrorHandler___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ErrorHandler___setstate_cython */
  {__pyx_k_ErrorHandler_error, sizeof(__pyx_k_ErrorHandler_error), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ErrorHandler_error */
  {__pyx_k_ErrorHandler_warning, sizeof(__pyx_k_ErrorHandler_warning), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ErrorHandler_warning */
  {__pyx_k_Excepted_dictionary_of_set_membe, sizeof(__pyx_k_Excepted_dictionary_of_set_membe), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Excepted_dictionary_of_set_membe */
  {__pyx_k_Excepted_string_or_real, sizeof(__pyx_k_Excepted_string_or_real), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Excepted_string_or_real */
  {__pyx_k_Excepted_tuple_of_arity, sizeof(__pyx_k_Excepted_tuple_of_arity), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Excepted_tuple_of_arity */
  {__pyx_k_Expected_a_dictionary, sizeof(__pyx_k_Expected_a_dictionary), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Expected_a_dictionary */
  {__pyx_k_Expected_tuples_of_arity, sizeof(__pyx_k_Expected_tuples_of_arity), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Expected_tuples_of_arity */
  {__pyx_k_FIX, sizeof(__pyx_k_FIX), 0, 1, 1}, /* PyObject cname: __pyx_n_u_FIX */
  {__pyx_k_FOR, sizeof(__pyx_k_FOR), 0, 1, 1}, /* PyObject cname: __pyx_n_u_FOR */
  {__pyx_k_Failed_to_access_value, sizeof(__pyx_k_Failed_to_access_value), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Failed_to_access_value */
  {__pyx_k_Failed_to_cast_value_to_int_floa, sizeof(__pyx_k_Failed_to_cast_value_to_int_floa), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Failed_to_cast_value_to_int_floa */
  {__pyx_k_Formatter, sizeof(__pyx_k_Formatter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Formatter */
  {__pyx_k_IF, sizeof(__pyx_k_IF), 0, 1, 1}, /* PyObject cname: __pyx_n_u_IF */
  {__pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_IOError */
  {__pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ImportError */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0 */
  {__pyx_k_InfeasibilityException, sizeof(__pyx_k_InfeasibilityException), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InfeasibilityException */
  {__pyx_k_InfeasibilityException_2, sizeof(__pyx_k_InfeasibilityException_2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_InfeasibilityException_2 */
  {__pyx_k_InstanceIterator, sizeof(__pyx_k_InstanceIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InstanceIterator */
  {__pyx_k_InstanceIterator___reduce_cython, sizeof(__pyx_k_InstanceIterator___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InstanceIterator___reduce_cython */
  {__pyx_k_InstanceIterator___setstate_cyth, sizeof(__pyx_k_InstanceIterator___setstate_cyth), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InstanceIterator___setstate_cyth */
  {__pyx_k_InstanceIterator_size, sizeof(__pyx_k_InstanceIterator_size), 0, 1, 1}, /* PyObject cname: __pyx_n_u_InstanceIterator_size */
  {__pyx_k_Iterable, sizeof(__pyx_k_Iterable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Iterable */
  {__pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_KeyError */
  {__pyx_k_Kind, sizeof(__pyx_k_Kind), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Kind */
  {__pyx_k_LET, sizeof(__pyx_k_LET), 0, 1, 1}, /* PyObject cname: __pyx_n_u_LET */
  {__pyx_k_LOAD, sizeof(__pyx_k_LOAD), 0, 1, 1}, /* PyObject cname: __pyx_n_u_LOAD */
  {__pyx_k_LOOPEND, sizeof(__pyx_k_LOOPEND), 0, 1, 1}, /* PyObject cname: __pyx_n_u_LOOPEND */
  {__pyx_k_MISC, sizeof(__pyx_k_MISC), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MISC */
  {__pyx_k_MemberRangeIterator, sizeof(__pyx_k_MemberRangeIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MemberRangeIterator */
  {__pyx_k_MemberRangeIterator___reduce_cyt, sizeof(__pyx_k_MemberRangeIterator___reduce_cyt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MemberRangeIterator___reduce_cyt */
  {__pyx_k_MemberRangeIterator___setstate_c, sizeof(__pyx_k_MemberRangeIterator___setstate_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MemberRangeIterator___setstate_c */
  {__pyx_k_MemberRangeIterator_size, sizeof(__pyx_k_MemberRangeIterator_size), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MemberRangeIterator_size */
  {__pyx_k_MultiIndex, sizeof(__pyx_k_MultiIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MultiIndex */
  {__pyx_k_None, sizeof(__pyx_k_None), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_None */
  {__pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_NotImplementedError */
  {__pyx_k_OBJECTIVE, sizeof(__pyx_k_OBJECTIVE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OBJECTIVE */
  {__pyx_k_OPTION, sizeof(__pyx_k_OPTION), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OPTION */
  {__pyx_k_OPTION_RESET, sizeof(__pyx_k_OPTION_RESET), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OPTION_RESET */
  {__pyx_k_Objective, sizeof(__pyx_k_Objective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective */
  {__pyx_k_Objective___reduce_cython, sizeof(__pyx_k_Objective___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective___reduce_cython */
  {__pyx_k_Objective___setstate_cython, sizeof(__pyx_k_Objective___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective___setstate_cython */
  {__pyx_k_Objective_astatus, sizeof(__pyx_k_Objective_astatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_astatus */
  {__pyx_k_Objective_drop, sizeof(__pyx_k_Objective_drop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_drop */
  {__pyx_k_Objective_exitcode, sizeof(__pyx_k_Objective_exitcode), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_exitcode */
  {__pyx_k_Objective_message, sizeof(__pyx_k_Objective_message), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_message */
  {__pyx_k_Objective_minimization, sizeof(__pyx_k_Objective_minimization), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_minimization */
  {__pyx_k_Objective_restore, sizeof(__pyx_k_Objective_restore), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_restore */
  {__pyx_k_Objective_result, sizeof(__pyx_k_Objective_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_result */
  {__pyx_k_Objective_sstatus, sizeof(__pyx_k_Objective_sstatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_sstatus */
  {__pyx_k_Objective_value, sizeof(__pyx_k_Objective_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objective_value */
  {__pyx_k_Objectives, sizeof(__pyx_k_Objectives), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Objectives */
  {__pyx_k_Options, sizeof(__pyx_k_Options), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Options */
  {__pyx_k_OutputHandler, sizeof(__pyx_k_OutputHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OutputHandler */
  {__pyx_k_OutputHandler___reduce_cython, sizeof(__pyx_k_OutputHandler___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OutputHandler___reduce_cython */
  {__pyx_k_OutputHandler___setstate_cython, sizeof(__pyx_k_OutputHandler___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OutputHandler___setstate_cython */
  {__pyx_k_OutputHandler_output, sizeof(__pyx_k_OutputHandler_output), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OutputHandler_output */
  {__pyx_k_PRINT, sizeof(__pyx_k_PRINT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PRINT */
  {__pyx_k_PRINTF, sizeof(__pyx_k_PRINTF), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PRINTF */
  {__pyx_k_PROBLEM, sizeof(__pyx_k_PROBLEM), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PROBLEM */
  {__pyx_k_PROMPT, sizeof(__pyx_k_PROMPT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PROMPT */
  {__pyx_k_PURGE, sizeof(__pyx_k_PURGE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PURGE */
  {__pyx_k_Parameter, sizeof(__pyx_k_Parameter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter */
  {__pyx_k_Parameter___reduce_cython, sizeof(__pyx_k_Parameter___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter___reduce_cython */
  {__pyx_k_Parameter___setstate_cython, sizeof(__pyx_k_Parameter___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter___setstate_cython */
  {__pyx_k_Parameter_has_default, sizeof(__pyx_k_Parameter_has_default), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter_has_default */
  {__pyx_k_Parameter_is_symbolic, sizeof(__pyx_k_Parameter_is_symbolic), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter_is_symbolic */
  {__pyx_k_Parameter_set, sizeof(__pyx_k_Parameter_set), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter_set */
  {__pyx_k_Parameter_set_values, sizeof(__pyx_k_Parameter_set_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter_set_values */
  {__pyx_k_Parameter_value, sizeof(__pyx_k_Parameter_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameter_value */
  {__pyx_k_Parameters, sizeof(__pyx_k_Parameters), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Parameters */
  {__pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PickleError */
  {__pyx_k_Please_make_sure_that_the_AMPL, sizeof(__pyx_k_Please_make_sure_that_the_AMPL), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Please_make_sure_that_the_AMPL */
  {__pyx_k_PresolveException, sizeof(__pyx_k_PresolveException), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PresolveException */
  {__pyx_k_PresolveException_2, sizeof(__pyx_k_PresolveException_2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_PresolveException_2 */
  {__pyx_k_RBRACE, sizeof(__pyx_k_RBRACE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RBRACE */
  {__pyx_k_READ, sizeof(__pyx_k_READ), 0, 1, 1}, /* PyObject cname: __pyx_n_u_READ */
  {__pyx_k_READTABLE, sizeof(__pyx_k_READTABLE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_READTABLE */
  {__pyx_k_READ_TABLE, sizeof(__pyx_k_READ_TABLE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_READ_TABLE */
  {__pyx_k_RELOAD, sizeof(__pyx_k_RELOAD), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RELOAD */
  {__pyx_k_REMOVE, sizeof(__pyx_k_REMOVE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_REMOVE */
  {__pyx_k_REPEAT, sizeof(__pyx_k_REPEAT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_REPEAT */
  {__pyx_k_REPEAT_END, sizeof(__pyx_k_REPEAT_END), 0, 1, 1}, /* PyObject cname: __pyx_n_u_REPEAT_END */
  {__pyx_k_RESET, sizeof(__pyx_k_RESET), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RESET */
  {__pyx_k_RESTORE, sizeof(__pyx_k_RESTORE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RESTORE */
  {__pyx_k_RUN_ARGS, sizeof(__pyx_k_RUN_ARGS), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RUN_ARGS */
  {__pyx_k_Real, sizeof(__pyx_k_Real), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Real */
  {__pyx_k_Represents_the_type_of_the_outp, sizeof(__pyx_k_Represents_the_type_of_the_outp), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Represents_the_type_of_the_outp */
  {__pyx_k_Row, sizeof(__pyx_k_Row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Row */
  {__pyx_k_RowIterator, sizeof(__pyx_k_RowIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RowIterator */
  {__pyx_k_RowIterator___reduce_cython, sizeof(__pyx_k_RowIterator___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RowIterator___reduce_cython */
  {__pyx_k_RowIterator___setstate_cython, sizeof(__pyx_k_RowIterator___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RowIterator___setstate_cython */
  {__pyx_k_Row___reduce_cython, sizeof(__pyx_k_Row___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Row___reduce_cython */
  {__pyx_k_Row___setstate_cython, sizeof(__pyx_k_Row___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Row___setstate_cython */
  {__pyx_k_Row_to_string, sizeof(__pyx_k_Row_to_string), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Row_to_string */
  {__pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RuntimeError */
  {__pyx_k_SEMICOLON, sizeof(__pyx_k_SEMICOLON), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SEMICOLON */
  {__pyx_k_SHELL_MESSAGE, sizeof(__pyx_k_SHELL_MESSAGE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SHELL_MESSAGE */
  {__pyx_k_SHELL_OUTPUT, sizeof(__pyx_k_SHELL_OUTPUT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SHELL_OUTPUT */
  {__pyx_k_SHOW, sizeof(__pyx_k_SHOW), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SHOW */
  {__pyx_k_SOLUTION, sizeof(__pyx_k_SOLUTION), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SOLUTION */
  {__pyx_k_SOLVE, sizeof(__pyx_k_SOLVE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SOLVE */
  {__pyx_k_SSTEP, sizeof(__pyx_k_SSTEP), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SSTEP */
  {__pyx_k_SUPPORT_MESSAGE, sizeof(__pyx_k_SUPPORT_MESSAGE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SUPPORT_MESSAGE */
  {__pyx_k_Series, sizeof(__pyx_k_Series), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Series */
  {__pyx_k_Set, sizeof(__pyx_k_Set), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set */
  {__pyx_k_Set___reduce_cython, sizeof(__pyx_k_Set___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set___reduce_cython */
  {__pyx_k_Set___setstate_cython, sizeof(__pyx_k_Set___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set___setstate_cython */
  {__pyx_k_Set_arity, sizeof(__pyx_k_Set_arity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set_arity */
  {__pyx_k_Set_contains, sizeof(__pyx_k_Set_contains), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set_contains */
  {__pyx_k_Set_get_values, sizeof(__pyx_k_Set_get_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set_get_values */
  {__pyx_k_Set_instances, sizeof(__pyx_k_Set_instances), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set_instances */
  {__pyx_k_Set_members, sizeof(__pyx_k_Set_members), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set_members */
  {__pyx_k_Set_set_values, sizeof(__pyx_k_Set_set_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set_set_values */
  {__pyx_k_Set_size, sizeof(__pyx_k_Set_size), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Set_size */
  {__pyx_k_Sets, sizeof(__pyx_k_Sets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Sets */
  {__pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 1, 1}, /* PyObject cname: __pyx_n_u_StopIteration */
  {__pyx_k_StreamHandler, sizeof(__pyx_k_StreamHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_StreamHandler */
  {__pyx_k_SystemError, sizeof(__pyx_k_SystemError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SystemError */
  {__pyx_k_THEN, sizeof(__pyx_k_THEN), 0, 1, 1}, /* PyObject cname: __pyx_n_u_THEN */
  {__pyx_k_Table, sizeof(__pyx_k_Table), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Table */
  {__pyx_k_Trying_to_assign_tuples_to_set_o, sizeof(__pyx_k_Trying_to_assign_tuples_to_set_o), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Trying_to_assign_tuples_to_set_o */
  {__pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TypeError */
  {__pyx_k_UNFIX, sizeof(__pyx_k_UNFIX), 0, 1, 1}, /* PyObject cname: __pyx_n_u_UNFIX */
  {__pyx_k_UNLOAD, sizeof(__pyx_k_UNLOAD), 0, 1, 1}, /* PyObject cname: __pyx_n_u_UNLOAD */
  {__pyx_k_UPDATE, sizeof(__pyx_k_UPDATE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_UPDATE */
  {__pyx_k_Unexpected_data_type, sizeof(__pyx_k_Unexpected_data_type), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unexpected_data_type */
  {__pyx_k_Unknown_entity_class, sizeof(__pyx_k_Unknown_entity_class), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unknown_entity_class */
  {__pyx_k_Unknown_exception, sizeof(__pyx_k_Unknown_exception), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unknown_exception */
  {__pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ValueError */
  {__pyx_k_Variable, sizeof(__pyx_k_Variable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable */
  {__pyx_k_Variable___reduce_cython, sizeof(__pyx_k_Variable___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable___reduce_cython */
  {__pyx_k_Variable___setstate_cython, sizeof(__pyx_k_Variable___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable___setstate_cython */
  {__pyx_k_Variable_astatus, sizeof(__pyx_k_Variable_astatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_astatus */
  {__pyx_k_Variable_defeqn, sizeof(__pyx_k_Variable_defeqn), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_defeqn */
  {__pyx_k_Variable_dual, sizeof(__pyx_k_Variable_dual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_dual */
  {__pyx_k_Variable_fix, sizeof(__pyx_k_Variable_fix), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_fix */
  {__pyx_k_Variable_init, sizeof(__pyx_k_Variable_init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_init */
  {__pyx_k_Variable_init0, sizeof(__pyx_k_Variable_init0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_init0 */
  {__pyx_k_Variable_lb, sizeof(__pyx_k_Variable_lb), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_lb */
  {__pyx_k_Variable_lb0, sizeof(__pyx_k_Variable_lb0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_lb0 */
  {__pyx_k_Variable_lb1, sizeof(__pyx_k_Variable_lb1), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_lb1 */
  {__pyx_k_Variable_lb2, sizeof(__pyx_k_Variable_lb2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_lb2 */
  {__pyx_k_Variable_lrc, sizeof(__pyx_k_Variable_lrc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_lrc */
  {__pyx_k_Variable_lslack, sizeof(__pyx_k_Variable_lslack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_lslack */
  {__pyx_k_Variable_rc, sizeof(__pyx_k_Variable_rc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_rc */
  {__pyx_k_Variable_set_value, sizeof(__pyx_k_Variable_set_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_set_value */
  {__pyx_k_Variable_slack, sizeof(__pyx_k_Variable_slack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_slack */
  {__pyx_k_Variable_sstatus, sizeof(__pyx_k_Variable_sstatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_sstatus */
  {__pyx_k_Variable_status, sizeof(__pyx_k_Variable_status), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_status */
  {__pyx_k_Variable_ub, sizeof(__pyx_k_Variable_ub), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_ub */
  {__pyx_k_Variable_ub0, sizeof(__pyx_k_Variable_ub0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_ub0 */
  {__pyx_k_Variable_ub1, sizeof(__pyx_k_Variable_ub1), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_ub1 */
  {__pyx_k_Variable_ub2, sizeof(__pyx_k_Variable_ub2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_ub2 */
  {__pyx_k_Variable_unfix, sizeof(__pyx_k_Variable_unfix), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_unfix */
  {__pyx_k_Variable_urc, sizeof(__pyx_k_Variable_urc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_urc */
  {__pyx_k_Variable_uslack, sizeof(__pyx_k_Variable_uslack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_uslack */
  {__pyx_k_Variable_value, sizeof(__pyx_k_Variable_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variable_value */
  {__pyx_k_Variables, sizeof(__pyx_k_Variables), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Variables */
  {__pyx_k_WAITING, sizeof(__pyx_k_WAITING), 0, 1, 1}, /* PyObject cname: __pyx_n_u_WAITING */
  {__pyx_k_WARNING, sizeof(__pyx_k_WARNING), 0, 1, 1}, /* PyObject cname: __pyx_n_u_WARNING */
  {__pyx_k_WRITE, sizeof(__pyx_k_WRITE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_WRITE */
  {__pyx_k_WRITETABLE, sizeof(__pyx_k_WRITETABLE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_WRITETABLE */
  {__pyx_k_WRITE_TABLE, sizeof(__pyx_k_WRITE_TABLE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_WRITE_TABLE */
  {__pyx_k_XREF, sizeof(__pyx_k_XREF), 0, 1, 1}, /* PyObject cname: __pyx_n_u_XREF */
  {__pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__10 */
  {__pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__11 */
  {__pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__12 */
  {__pyx_k__13, sizeof(__pyx_k__13), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__13 */
  {__pyx_k__14, sizeof(__pyx_k__14), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__14 */
  {__pyx_k__15, sizeof(__pyx_k__15), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__15 */
  {__pyx_k__16, sizeof(__pyx_k__16), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__16 */
  {__pyx_k__17, sizeof(__pyx_k__17), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__17 */
  {__pyx_k__18, sizeof(__pyx_k__18), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__18 */
  {__pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__2 */
  {__pyx_k__21, sizeof(__pyx_k__21), 0, 1, 1}, /* PyObject cname: __pyx_n_u__21 */
  {__pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__3 */
  {__pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__4 */
  {__pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__5 */
  {__pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__6 */
  {__pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__7 */
  {__pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__8 */
  {__pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__9 */
  {__pyx_k_addColumn, sizeof(__pyx_k_addColumn), 0, 1, 1}, /* PyObject cname: __pyx_n_u_addColumn */
  {__pyx_k_addHandler, sizeof(__pyx_k_addHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_addHandler */
  {__pyx_k_addRow, sizeof(__pyx_k_addRow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_addRow */
  {__pyx_k_add_column, sizeof(__pyx_k_add_column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_column */
  {__pyx_k_add_column_locals_genexpr, sizeof(__pyx_k_add_column_locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_column_locals_genexpr */
  {__pyx_k_add_row, sizeof(__pyx_k_add_row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_row */
  {__pyx_k_ampl, sizeof(__pyx_k_ampl), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ampl */
  {__pyx_k_ampl_expressions, sizeof(__pyx_k_ampl_expressions), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ampl_expressions */
  {__pyx_k_ampl_instance, sizeof(__pyx_k_ampl_instance), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ampl_instance */
  {__pyx_k_ampl_libpath, sizeof(__pyx_k_ampl_libpath), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ampl_libpath */
  {__pyx_k_amplpy, sizeof(__pyx_k_amplpy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy */
  {__pyx_k_amplpy_ampl, sizeof(__pyx_k_amplpy_ampl), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy_ampl */
  {__pyx_k_amplpy_ampl_pyx, sizeof(__pyx_k_amplpy_ampl_pyx), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_ampl_pyx */
  {__pyx_k_amplpy_constraint_pxi, sizeof(__pyx_k_amplpy_constraint_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_constraint_pxi */
  {__pyx_k_amplpy_copt, sizeof(__pyx_k_amplpy_copt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy_copt */
  {__pyx_k_amplpy_copt_package_not_found, sizeof(__pyx_k_amplpy_copt_package_not_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_copt_package_not_found */
  {__pyx_k_amplpy_cplex, sizeof(__pyx_k_amplpy_cplex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy_cplex */
  {__pyx_k_amplpy_cplex_package_not_found, sizeof(__pyx_k_amplpy_cplex_package_not_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_cplex_package_not_found */
  {__pyx_k_amplpy_dataframe_arrow_pxi, sizeof(__pyx_k_amplpy_dataframe_arrow_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_dataframe_arrow_pxi */
  {__pyx_k_amplpy_dataframe_pxi, sizeof(__pyx_k_amplpy_dataframe_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_dataframe_pxi */
  {__pyx_k_amplpy_entity_pxi, sizeof(__pyx_k_amplpy_entity_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_entity_pxi */
  {__pyx_k_amplpy_environment_pxi, sizeof(__pyx_k_amplpy_environment_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_environment_pxi */
  {__pyx_k_amplpy_errorhandler_pxi, sizeof(__pyx_k_amplpy_errorhandler_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_errorhandler_pxi */
  {__pyx_k_amplpy_exceptions_pxi, sizeof(__pyx_k_amplpy_exceptions_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_exceptions_pxi */
  {__pyx_k_amplpy_gurobi, sizeof(__pyx_k_amplpy_gurobi), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy_gurobi */
  {__pyx_k_amplpy_gurobi_package_not_found, sizeof(__pyx_k_amplpy_gurobi_package_not_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_gurobi_package_not_found */
  {__pyx_k_amplpy_highs, sizeof(__pyx_k_amplpy_highs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy_highs */
  {__pyx_k_amplpy_highs_package_not_found, sizeof(__pyx_k_amplpy_highs_package_not_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_highs_package_not_found */
  {__pyx_k_amplpy_iterators_pxi, sizeof(__pyx_k_amplpy_iterators_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_iterators_pxi */
  {__pyx_k_amplpy_objective_pxi, sizeof(__pyx_k_amplpy_objective_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_objective_pxi */
  {__pyx_k_amplpy_outputhandler_pxi, sizeof(__pyx_k_amplpy_outputhandler_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_outputhandler_pxi */
  {__pyx_k_amplpy_parameter_pxi, sizeof(__pyx_k_amplpy_parameter_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_parameter_pxi */
  {__pyx_k_amplpy_scip, sizeof(__pyx_k_amplpy_scip), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy_scip */
  {__pyx_k_amplpy_scip_package_not_found, sizeof(__pyx_k_amplpy_scip_package_not_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_scip_package_not_found */
  {__pyx_k_amplpy_set_pxi, sizeof(__pyx_k_amplpy_set_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_set_pxi */
  {__pyx_k_amplpy_variable_pxi, sizeof(__pyx_k_amplpy_variable_pxi), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_variable_pxi */
  {__pyx_k_amplpy_xpress, sizeof(__pyx_k_amplpy_xpress), 0, 1, 1}, /* PyObject cname: __pyx_n_u_amplpy_xpress */
  {__pyx_k_amplpy_xpress_package_not_found, sizeof(__pyx_k_amplpy_xpress_package_not_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_amplpy_xpress_package_not_found */
  {__pyx_k_args, sizeof(__pyx_k_args), 0, 1, 1}, /* PyObject cname: __pyx_n_u_args */
  {__pyx_k_arity, sizeof(__pyx_k_arity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_arity */
  {__pyx_k_array, sizeof(__pyx_k_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_array */
  {__pyx_k_array_ptr, sizeof(__pyx_k_array_ptr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_array_ptr */
  {__pyx_k_array_stream, sizeof(__pyx_k_array_stream), 0, 1, 1}, /* PyObject cname: __pyx_n_u_array_stream */
  {__pyx_k_arrow_array_ptr, sizeof(__pyx_k_arrow_array_ptr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_arrow_array_ptr */
  {__pyx_k_arrow_c_array, sizeof(__pyx_k_arrow_c_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_arrow_c_array */
  {__pyx_k_arrow_c_schema, sizeof(__pyx_k_arrow_c_schema), 0, 1, 1}, /* PyObject cname: __pyx_n_u_arrow_c_schema */
  {__pyx_k_arrow_schema_ptr, sizeof(__pyx_k_arrow_schema_ptr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_arrow_schema_ptr */
  {__pyx_k_ast, sizeof(__pyx_k_ast), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ast */
  {__pyx_k_astatus, sizeof(__pyx_k_astatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_astatus */
  {__pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 1, 1}, /* PyObject cname: __pyx_n_u_asyncio_coroutines */
  {__pyx_k_auxfiles, sizeof(__pyx_k_auxfiles), 0, 1, 1}, /* PyObject cname: __pyx_n_u_auxfiles */
  {__pyx_k_bin_dir, sizeof(__pyx_k_bin_dir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bin_dir */
  {__pyx_k_bin_dir_c, sizeof(__pyx_k_bin_dir_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bin_dir_c */
  {__pyx_k_bin_name, sizeof(__pyx_k_bin_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bin_name */
  {__pyx_k_bin_name_c, sizeof(__pyx_k_bin_name_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bin_name_c */
  {__pyx_k_binary_directory, sizeof(__pyx_k_binary_directory), 0, 1, 1}, /* PyObject cname: __pyx_n_u_binary_directory */
  {__pyx_k_binary_name, sizeof(__pyx_k_binary_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_binary_name */
  {__pyx_k_body, sizeof(__pyx_k_body), 0, 1, 1}, /* PyObject cname: __pyx_n_u_body */
  {__pyx_k_bool, sizeof(__pyx_k_bool), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bool */
  {__pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 1, 1}, /* PyObject cname: __pyx_n_u_builtins */
  {__pyx_k_c, sizeof(__pyx_k_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c */
  {__pyx_k_c_array, sizeof(__pyx_k_c_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c_array */
  {__pyx_k_c_array_capsule, sizeof(__pyx_k_c_array_capsule), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c_array_capsule */
  {__pyx_k_c_array_stream, sizeof(__pyx_k_c_array_stream), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c_array_stream */
  {__pyx_k_c_double_array, sizeof(__pyx_k_c_double_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c_double_array */
  {__pyx_k_c_schema, sizeof(__pyx_k_c_schema), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c_schema */
  {__pyx_k_c_schema_capsule, sizeof(__pyx_k_c_schema_capsule), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c_schema_capsule */
  {__pyx_k_c_string_array, sizeof(__pyx_k_c_string_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c_string_array */
  {__pyx_k_cannot_be_found, sizeof(__pyx_k_cannot_be_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_be_found */
  {__pyx_k_cannot_convert_to_dictionary_wit, sizeof(__pyx_k_cannot_convert_to_dictionary_wit), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_convert_to_dictionary_wit */
  {__pyx_k_cast_row, sizeof(__pyx_k_cast_row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cast_row */
  {__pyx_k_cast_value, sizeof(__pyx_k_cast_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cast_value */
  {__pyx_k_cd, sizeof(__pyx_k_cd), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cd */
  {__pyx_k_chain, sizeof(__pyx_k_chain), 0, 1, 1}, /* PyObject cname: __pyx_n_u_chain */
  {__pyx_k_check, sizeof(__pyx_k_check), 0, 1, 1}, /* PyObject cname: __pyx_n_u_check */
  {__pyx_k_cindex, sizeof(__pyx_k_cindex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cindex */
  {__pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_class_getitem */
  {__pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cline_in_traceback */
  {__pyx_k_close, sizeof(__pyx_k_close), 0, 1, 1}, /* PyObject cname: __pyx_n_u_close */
  {__pyx_k_cls, sizeof(__pyx_k_cls), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cls */
  {__pyx_k_cname, sizeof(__pyx_k_cname), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cname */
  {__pyx_k_col, sizeof(__pyx_k_col), 0, 1, 1}, /* PyObject cname: __pyx_n_u_col */
  {__pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_collections_abc */
  {__pyx_k_column, sizeof(__pyx_k_column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_column */
  {__pyx_k_column_names, sizeof(__pyx_k_column_names), 0, 1, 1}, /* PyObject cname: __pyx_n_u_column_names */
  {__pyx_k_columns, sizeof(__pyx_k_columns), 0, 1, 1}, /* PyObject cname: __pyx_n_u_columns */
  {__pyx_k_con, sizeof(__pyx_k_con), 0, 1, 1}, /* PyObject cname: __pyx_n_u_con */
  {__pyx_k_con_2, sizeof(__pyx_k_con_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_con_2 */
  {__pyx_k_con_locals_Constraints, sizeof(__pyx_k_con_locals_Constraints), 0, 1, 1}, /* PyObject cname: __pyx_n_u_con_locals_Constraints */
  {__pyx_k_con_locals_Constraints___getite, sizeof(__pyx_k_con_locals_Constraints___getite), 0, 1, 1}, /* PyObject cname: __pyx_n_u_con_locals_Constraints___getite */
  {__pyx_k_con_locals_Constraints___init, sizeof(__pyx_k_con_locals_Constraints___init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_con_locals_Constraints___init */
  {__pyx_k_con_locals_Constraints___iter, sizeof(__pyx_k_con_locals_Constraints___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_con_locals_Constraints___iter */
  {__pyx_k_con_locals_Constraints___setite, sizeof(__pyx_k_con_locals_Constraints___setite), 0, 1, 1}, /* PyObject cname: __pyx_n_u_con_locals_Constraints___setite */
  {__pyx_k_contains, sizeof(__pyx_k_contains), 0, 1, 1}, /* PyObject cname: __pyx_n_u_contains */
  {__pyx_k_contains_c, sizeof(__pyx_k_contains_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_contains_c */
  {__pyx_k_conv_to_list, sizeof(__pyx_k_conv_to_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_conv_to_list */
  {__pyx_k_copt, sizeof(__pyx_k_copt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_copt */
  {__pyx_k_copt_cplex_gurobi_highs_scip_xpr, sizeof(__pyx_k_copt_cplex_gurobi_highs_scip_xpr), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_copt_cplex_gurobi_highs_scip_xpr */
  {__pyx_k_cplex, sizeof(__pyx_k_cplex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cplex */
  {__pyx_k_d, sizeof(__pyx_k_d), 0, 1, 1}, /* PyObject cname: __pyx_n_u_d */
  {__pyx_k_data, sizeof(__pyx_k_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_data */
  {__pyx_k_data_c, sizeof(__pyx_k_data_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_data_c */
  {__pyx_k_data_frame, sizeof(__pyx_k_data_frame), 0, 1, 1}, /* PyObject cname: __pyx_n_u_data_frame */
  {__pyx_k_decode, sizeof(__pyx_k_decode), 0, 1, 1}, /* PyObject cname: __pyx_n_u_decode */
  {__pyx_k_defeqn, sizeof(__pyx_k_defeqn), 0, 1, 1}, /* PyObject cname: __pyx_n_u_defeqn */
  {__pyx_k_defvar, sizeof(__pyx_k_defvar), 0, 1, 1}, /* PyObject cname: __pyx_n_u_defvar */
  {__pyx_k_df, sizeof(__pyx_k_df), 0, 1, 1}, /* PyObject cname: __pyx_n_u_df */
  {__pyx_k_df_c, sizeof(__pyx_k_df_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_df_c */
  {__pyx_k_df_ref, sizeof(__pyx_k_df_ref), 0, 1, 1}, /* PyObject cname: __pyx_n_u_df_ref */
  {__pyx_k_df_reset, sizeof(__pyx_k_df_reset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_df_reset */
  {__pyx_k_dic, sizeof(__pyx_k_dic), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dic */
  {__pyx_k_dict, sizeof(__pyx_k_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dict */
  {__pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dict_2 */
  {__pyx_k_dimen, sizeof(__pyx_k_dimen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dimen */
  {__pyx_k_dinit, sizeof(__pyx_k_dinit), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dinit */
  {__pyx_k_dinit0, sizeof(__pyx_k_dinit0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dinit0 */
  {__pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_disable */
  {__pyx_k_display, sizeof(__pyx_k_display), 0, 1, 1}, /* PyObject cname: __pyx_n_u_display */
  {__pyx_k_display_error_message, sizeof(__pyx_k_display_error_message), 0, 1, 1}, /* PyObject cname: __pyx_n_u_display_error_message */
  {__pyx_k_doc, sizeof(__pyx_k_doc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_doc */
  {__pyx_k_driver, sizeof(__pyx_k_driver), 0, 1, 1}, /* PyObject cname: __pyx_n_u_driver */
  {__pyx_k_drop, sizeof(__pyx_k_drop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_drop */
  {__pyx_k_dual, sizeof(__pyx_k_dual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dual */
  {__pyx_k_e, sizeof(__pyx_k_e), 0, 1, 1}, /* PyObject cname: __pyx_n_u_e */
  {__pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_enable */
  {__pyx_k_encode, sizeof(__pyx_k_encode), 0, 1, 1}, /* PyObject cname: __pyx_n_u_encode */
  {__pyx_k_end, sizeof(__pyx_k_end), 0, 1, 1}, /* PyObject cname: __pyx_n_u_end */
  {__pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 1, 1}, /* PyObject cname: __pyx_n_u_endswith */
  {__pyx_k_entity, sizeof(__pyx_k_entity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_entity */
  {__pyx_k_entitytype, sizeof(__pyx_k_entitytype), 0, 1, 1}, /* PyObject cname: __pyx_n_u_entitytype */
  {__pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_enumerate */
  {__pyx_k_environ, sizeof(__pyx_k_environ), 0, 1, 1}, /* PyObject cname: __pyx_n_u_environ */
  {__pyx_k_environment, sizeof(__pyx_k_environment), 0, 1, 1}, /* PyObject cname: __pyx_n_u_environment */
  {__pyx_k_error, sizeof(__pyx_k_error), 0, 1, 1}, /* PyObject cname: __pyx_n_u_error */
  {__pyx_k_error_handler, sizeof(__pyx_k_error_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_error_handler */
  {__pyx_k_error_handler_wrapper, sizeof(__pyx_k_error_handler_wrapper), 0, 1, 1}, /* PyObject cname: __pyx_n_u_error_handler_wrapper */
  {__pyx_k_errorinfo, sizeof(__pyx_k_errorinfo), 0, 1, 1}, /* PyObject cname: __pyx_n_u_errorinfo */
  {__pyx_k_errors, sizeof(__pyx_k_errors), 0, 1, 1}, /* PyObject cname: __pyx_n_u_errors */
  {__pyx_k_eval, sizeof(__pyx_k_eval), 0, 1, 1}, /* PyObject cname: __pyx_n_u_eval */
  {__pyx_k_exception, sizeof(__pyx_k_exception), 0, 1, 1}, /* PyObject cname: __pyx_n_u_exception */
  {__pyx_k_exists, sizeof(__pyx_k_exists), 0, 1, 1}, /* PyObject cname: __pyx_n_u_exists */
  {__pyx_k_exitcode, sizeof(__pyx_k_exitcode), 0, 1, 1}, /* PyObject cname: __pyx_n_u_exitcode */
  {__pyx_k_exp, sizeof(__pyx_k_exp), 0, 1, 1}, /* PyObject cname: __pyx_n_u_exp */
  {__pyx_k_exportData, sizeof(__pyx_k_exportData), 0, 1, 1}, /* PyObject cname: __pyx_n_u_exportData */
  {__pyx_k_exportModel, sizeof(__pyx_k_exportModel), 0, 1, 1}, /* PyObject cname: __pyx_n_u_exportModel */
  {__pyx_k_export_copt_model, sizeof(__pyx_k_export_copt_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_copt_model */
  {__pyx_k_export_cplex_model, sizeof(__pyx_k_export_cplex_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_cplex_model */
  {__pyx_k_export_data, sizeof(__pyx_k_export_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_data */
  {__pyx_k_export_gurobi_model, sizeof(__pyx_k_export_gurobi_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_gurobi_model */
  {__pyx_k_export_highs_model, sizeof(__pyx_k_export_highs_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_highs_model */
  {__pyx_k_export_model, sizeof(__pyx_k_export_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_model */
  {__pyx_k_export_scip_model, sizeof(__pyx_k_export_scip_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_scip_model */
  {__pyx_k_export_xpress_model, sizeof(__pyx_k_export_xpress_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_export_xpress_model */
  {__pyx_k_exprs, sizeof(__pyx_k_exprs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_exprs */
  {__pyx_k_file, sizeof(__pyx_k_file), 0, 1, 1}, /* PyObject cname: __pyx_n_u_file */
  {__pyx_k_filename, sizeof(__pyx_k_filename), 0, 1, 1}, /* PyObject cname: __pyx_n_u_filename */
  {__pyx_k_find, sizeof(__pyx_k_find), 0, 1, 1}, /* PyObject cname: __pyx_n_u_find */
  {__pyx_k_fix, sizeof(__pyx_k_fix), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fix */
  {__pyx_k_flat, sizeof(__pyx_k_flat), 0, 1, 1}, /* PyObject cname: __pyx_n_u_flat */
  {__pyx_k_flush, sizeof(__pyx_k_flush), 0, 1, 1}, /* PyObject cname: __pyx_n_u_flush */
  {__pyx_k_format, sizeof(__pyx_k_format), 0, 1, 1}, /* PyObject cname: __pyx_n_u_format */
  {__pyx_k_formatter, sizeof(__pyx_k_formatter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_formatter */
  {__pyx_k_fromDict, sizeof(__pyx_k_fromDict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fromDict */
  {__pyx_k_fromNumpy, sizeof(__pyx_k_fromNumpy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fromNumpy */
  {__pyx_k_fromPandas, sizeof(__pyx_k_fromPandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fromPandas */
  {__pyx_k_from_arrays, sizeof(__pyx_k_from_arrays), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_arrays */
  {__pyx_k_from_data_frame_ref, sizeof(__pyx_k_from_data_frame_ref), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_data_frame_ref */
  {__pyx_k_from_dict, sizeof(__pyx_k_from_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_dict */
  {__pyx_k_from_dict_locals_genexpr, sizeof(__pyx_k_from_dict_locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_dict_locals_genexpr */
  {__pyx_k_from_dict_locals_to_tuple, sizeof(__pyx_k_from_dict_locals_to_tuple), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_dict_locals_to_tuple */
  {__pyx_k_from_numpy, sizeof(__pyx_k_from_numpy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_numpy */
  {__pyx_k_from_pandas, sizeof(__pyx_k_from_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_pandas */
  {__pyx_k_from_polars, sizeof(__pyx_k_from_polars), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_polars */
  {__pyx_k_from_tuples, sizeof(__pyx_k_from_tuples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_from_tuples */
  {__pyx_k_func, sizeof(__pyx_k_func), 0, 1, 1}, /* PyObject cname: __pyx_n_u_func */
  {__pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_gc */
  {__pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_genexpr */
  {__pyx_k_get, sizeof(__pyx_k_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get */
  {__pyx_k_getBinDir, sizeof(__pyx_k_getBinDir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getBinDir */
  {__pyx_k_getBinName, sizeof(__pyx_k_getBinName), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getBinName */
  {__pyx_k_getColumn, sizeof(__pyx_k_getColumn), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getColumn */
  {__pyx_k_getConstraint, sizeof(__pyx_k_getConstraint), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getConstraint */
  {__pyx_k_getConstraints, sizeof(__pyx_k_getConstraints), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getConstraints */
  {__pyx_k_getCurrentObjective, sizeof(__pyx_k_getCurrentObjective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getCurrentObjective */
  {__pyx_k_getData, sizeof(__pyx_k_getData), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getData */
  {__pyx_k_getEntity, sizeof(__pyx_k_getEntity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getEntity */
  {__pyx_k_getErrorHandler, sizeof(__pyx_k_getErrorHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getErrorHandler */
  {__pyx_k_getHeaders, sizeof(__pyx_k_getHeaders), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getHeaders */
  {__pyx_k_getIndexingSets, sizeof(__pyx_k_getIndexingSets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getIndexingSets */
  {__pyx_k_getLineNumber, sizeof(__pyx_k_getLineNumber), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getLineNumber */
  {__pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getLogger */
  {__pyx_k_getMessage, sizeof(__pyx_k_getMessage), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getMessage */
  {__pyx_k_getNumCols, sizeof(__pyx_k_getNumCols), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getNumCols */
  {__pyx_k_getNumIndices, sizeof(__pyx_k_getNumIndices), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getNumIndices */
  {__pyx_k_getNumRows, sizeof(__pyx_k_getNumRows), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getNumRows */
  {__pyx_k_getObjective, sizeof(__pyx_k_getObjective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getObjective */
  {__pyx_k_getObjectives, sizeof(__pyx_k_getObjectives), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getObjectives */
  {__pyx_k_getOffset, sizeof(__pyx_k_getOffset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getOffset */
  {__pyx_k_getOption, sizeof(__pyx_k_getOption), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getOption */
  {__pyx_k_getOutput, sizeof(__pyx_k_getOutput), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getOutput */
  {__pyx_k_getOutputHandler, sizeof(__pyx_k_getOutputHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getOutputHandler */
  {__pyx_k_getParameter, sizeof(__pyx_k_getParameter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getParameter */
  {__pyx_k_getParameters, sizeof(__pyx_k_getParameters), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getParameters */
  {__pyx_k_getRecordedEntities, sizeof(__pyx_k_getRecordedEntities), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getRecordedEntities */
  {__pyx_k_getRow, sizeof(__pyx_k_getRow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getRow */
  {__pyx_k_getRowByIndex, sizeof(__pyx_k_getRowByIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getRowByIndex */
  {__pyx_k_getSet, sizeof(__pyx_k_getSet), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getSet */
  {__pyx_k_getSets, sizeof(__pyx_k_getSets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getSets */
  {__pyx_k_getSourceName, sizeof(__pyx_k_getSourceName), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getSourceName */
  {__pyx_k_getValue, sizeof(__pyx_k_getValue), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getValue */
  {__pyx_k_getValues, sizeof(__pyx_k_getValues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getValues */
  {__pyx_k_getVariable, sizeof(__pyx_k_getVariable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getVariable */
  {__pyx_k_getVariables, sizeof(__pyx_k_getVariables), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getVariables */
  {__pyx_k_get_bin_dir, sizeof(__pyx_k_get_bin_dir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_bin_dir */
  {__pyx_k_get_bin_name, sizeof(__pyx_k_get_bin_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_bin_name */
  {__pyx_k_get_column, sizeof(__pyx_k_get_column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_column */
  {__pyx_k_get_constraint, sizeof(__pyx_k_get_constraint), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_constraint */
  {__pyx_k_get_constraints, sizeof(__pyx_k_get_constraints), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_constraints */
  {__pyx_k_get_current_objective, sizeof(__pyx_k_get_current_objective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_current_objective */
  {__pyx_k_get_data, sizeof(__pyx_k_get_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_data */
  {__pyx_k_get_entity, sizeof(__pyx_k_get_entity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_entity */
  {__pyx_k_get_error_handler, sizeof(__pyx_k_get_error_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_error_handler */
  {__pyx_k_get_headers, sizeof(__pyx_k_get_headers), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_headers */
  {__pyx_k_get_headers_locals_genexpr, sizeof(__pyx_k_get_headers_locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_headers_locals_genexpr */
  {__pyx_k_get_iis, sizeof(__pyx_k_get_iis), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_iis */
  {__pyx_k_get_indexing_sets, sizeof(__pyx_k_get_indexing_sets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_indexing_sets */
  {__pyx_k_get_line_number, sizeof(__pyx_k_get_line_number), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_line_number */
  {__pyx_k_get_message, sizeof(__pyx_k_get_message), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_message */
  {__pyx_k_get_next, sizeof(__pyx_k_get_next), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_next */
  {__pyx_k_get_num_cols, sizeof(__pyx_k_get_num_cols), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_num_cols */
  {__pyx_k_get_num_indices, sizeof(__pyx_k_get_num_indices), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_num_indices */
  {__pyx_k_get_num_rows, sizeof(__pyx_k_get_num_rows), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_num_rows */
  {__pyx_k_get_objective, sizeof(__pyx_k_get_objective), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_objective */
  {__pyx_k_get_objectives, sizeof(__pyx_k_get_objectives), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_objectives */
  {__pyx_k_get_offset, sizeof(__pyx_k_get_offset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_offset */
  {__pyx_k_get_option, sizeof(__pyx_k_get_option), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_option */
  {__pyx_k_get_output, sizeof(__pyx_k_get_output), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_output */
  {__pyx_k_get_output_handler, sizeof(__pyx_k_get_output_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_output_handler */
  {__pyx_k_get_parameter, sizeof(__pyx_k_get_parameter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_parameter */
  {__pyx_k_get_parameters, sizeof(__pyx_k_get_parameters), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_parameters */
  {__pyx_k_get_row, sizeof(__pyx_k_get_row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_row */
  {__pyx_k_get_row_by_index, sizeof(__pyx_k_get_row_by_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_row_by_index */
  {__pyx_k_get_schema, sizeof(__pyx_k_get_schema), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_schema */
  {__pyx_k_get_set, sizeof(__pyx_k_get_set), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_set */
  {__pyx_k_get_sets, sizeof(__pyx_k_get_sets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_sets */
  {__pyx_k_get_solution, sizeof(__pyx_k_get_solution), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_solution */
  {__pyx_k_get_source_name, sizeof(__pyx_k_get_source_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_source_name */
  {__pyx_k_get_value, sizeof(__pyx_k_get_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_value */
  {__pyx_k_get_values, sizeof(__pyx_k_get_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_values */
  {__pyx_k_get_variable, sizeof(__pyx_k_get_variable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_variable */
  {__pyx_k_get_variables, sizeof(__pyx_k_get_variables), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_variables */
  {__pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getitem */
  {__pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getstate */
  {__pyx_k_gurobi, sizeof(__pyx_k_gurobi), 0, 1, 1}, /* PyObject cname: __pyx_n_u_gurobi */
  {__pyx_k_handler, sizeof(__pyx_k_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_handler */
  {__pyx_k_hasDefault, sizeof(__pyx_k_hasDefault), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hasDefault */
  {__pyx_k_hasHandlers, sizeof(__pyx_k_hasHandlers), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hasHandlers */
  {__pyx_k_has_default, sizeof(__pyx_k_has_default), 0, 1, 1}, /* PyObject cname: __pyx_n_u_has_default */
  {__pyx_k_header, sizeof(__pyx_k_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_header */
  {__pyx_k_headers, sizeof(__pyx_k_headers), 0, 1, 1}, /* PyObject cname: __pyx_n_u_headers */
  {__pyx_k_headers_py, sizeof(__pyx_k_headers_py), 0, 1, 1}, /* PyObject cname: __pyx_n_u_headers_py */
  {__pyx_k_highs, sizeof(__pyx_k_highs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_highs */
  {__pyx_k_i, sizeof(__pyx_k_i), 0, 1, 1}, /* PyObject cname: __pyx_n_u_i */
  {__pyx_k_i_in_1__ncons__con_i_iis_non__c, sizeof(__pyx_k_i_in_1__ncons__con_i_iis_non__c), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_i_in_1__ncons__con_i_iis_non__c */
  {__pyx_k_i_in_1__nvars__var_i_iis_non__v, sizeof(__pyx_k_i_in_1__nvars__var_i_iis_non__v), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_i_in_1__nvars__var_i_iis_non__v */
  {__pyx_k_i_in_1__nvars__var_i_val_0__var, sizeof(__pyx_k_i_in_1__nvars__var_i_val_0__var), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_i_in_1__nvars__var_i_val_0__var */
  {__pyx_k_i_in_1__nvars__varname_i__var_i, sizeof(__pyx_k_i_in_1__nvars__varname_i__var_i), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_i_in_1__nvars__varname_i__var_i */
  {__pyx_k_idx, sizeof(__pyx_k_idx), 0, 1, 1}, /* PyObject cname: __pyx_n_u_idx */
  {__pyx_k_iis_con, sizeof(__pyx_k_iis_con), 0, 1, 1}, /* PyObject cname: __pyx_n_u_iis_con */
  {__pyx_k_iis_var, sizeof(__pyx_k_iis_var), 0, 1, 1}, /* PyObject cname: __pyx_n_u_iis_var */
  {__pyx_k_impl, sizeof(__pyx_k_impl), 0, 1, 1}, /* PyObject cname: __pyx_n_u_impl */
  {__pyx_k_import_ampls_solution, sizeof(__pyx_k_import_ampls_solution), 0, 1, 1}, /* PyObject cname: __pyx_n_u_import_ampls_solution */
  {__pyx_k_import_ampls_solution_locals_gen, sizeof(__pyx_k_import_ampls_solution_locals_gen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_import_ampls_solution_locals_gen */
  {__pyx_k_import_entities, sizeof(__pyx_k_import_entities), 0, 1, 1}, /* PyObject cname: __pyx_n_u_import_entities */
  {__pyx_k_index, sizeof(__pyx_k_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_index */
  {__pyx_k_index_c, sizeof(__pyx_k_index_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_index_c */
  {__pyx_k_index_names, sizeof(__pyx_k_index_names), 0, 1, 1}, /* PyObject cname: __pyx_n_u_index_names */
  {__pyx_k_indexarity, sizeof(__pyx_k_indexarity), 0, 1, 1}, /* PyObject cname: __pyx_n_u_indexarity */
  {__pyx_k_indices_c, sizeof(__pyx_k_indices_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_indices_c */
  {__pyx_k_init, sizeof(__pyx_k_init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_init */
  {__pyx_k_init0, sizeof(__pyx_k_init0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_init0 */
  {__pyx_k_init_2, sizeof(__pyx_k_init_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_init_2 */
  {__pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 1, 1}, /* PyObject cname: __pyx_n_u_initializing */
  {__pyx_k_instances, sizeof(__pyx_k_instances), 0, 1, 1}, /* PyObject cname: __pyx_n_u_instances */
  {__pyx_k_isLogical, sizeof(__pyx_k_isLogical), 0, 1, 1}, /* PyObject cname: __pyx_n_u_isLogical */
  {__pyx_k_isRunning, sizeof(__pyx_k_isRunning), 0, 1, 1}, /* PyObject cname: __pyx_n_u_isRunning */
  {__pyx_k_isScalar, sizeof(__pyx_k_isScalar), 0, 1, 1}, /* PyObject cname: __pyx_n_u_isScalar */
  {__pyx_k_isSymbolic, sizeof(__pyx_k_isSymbolic), 0, 1, 1}, /* PyObject cname: __pyx_n_u_isSymbolic */
  {__pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_coroutine */
  {__pyx_k_is_logical, sizeof(__pyx_k_is_logical), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_logical */
  {__pyx_k_is_not_supported_please_choose, sizeof(__pyx_k_is_not_supported_please_choose), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_is_not_supported_please_choose */
  {__pyx_k_is_running, sizeof(__pyx_k_is_running), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_running */
  {__pyx_k_is_scalar, sizeof(__pyx_k_is_scalar), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_scalar */
  {__pyx_k_is_symbolic, sizeof(__pyx_k_is_symbolic), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_symbolic */
  {__pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_isenabled */
  {__pyx_k_isrunning, sizeof(__pyx_k_isrunning), 0, 1, 1}, /* PyObject cname: __pyx_n_u_isrunning */
  {__pyx_k_items, sizeof(__pyx_k_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_items */
  {__pyx_k_iter, sizeof(__pyx_k_iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_iter */
  {__pyx_k_iter___locals_genexpr, sizeof(__pyx_k_iter___locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_iter___locals_genexpr */
  {__pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 1, 1}, /* PyObject cname: __pyx_n_u_itertools */
  {__pyx_k_j, sizeof(__pyx_k_j), 0, 1, 1}, /* PyObject cname: __pyx_n_u_j */
  {__pyx_k_k, sizeof(__pyx_k_k), 0, 1, 1}, /* PyObject cname: __pyx_n_u_k */
  {__pyx_k_keep_files, sizeof(__pyx_k_keep_files), 0, 1, 1}, /* PyObject cname: __pyx_n_u_keep_files */
  {__pyx_k_key, sizeof(__pyx_k_key), 0, 1, 1}, /* PyObject cname: __pyx_n_u_key */
  {__pyx_k_keys, sizeof(__pyx_k_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_keys */
  {__pyx_k_kind, sizeof(__pyx_k_kind), 0, 1, 1}, /* PyObject cname: __pyx_n_u_kind */
  {__pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_kwargs */
  {__pyx_k_last_exception, sizeof(__pyx_k_last_exception), 0, 1, 1}, /* PyObject cname: __pyx_n_u_last_exception */
  {__pyx_k_lb, sizeof(__pyx_k_lb), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lb */
  {__pyx_k_lb0, sizeof(__pyx_k_lb0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lb0 */
  {__pyx_k_lb1, sizeof(__pyx_k_lb1), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lb1 */
  {__pyx_k_lb2, sizeof(__pyx_k_lb2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lb2 */
  {__pyx_k_lbs, sizeof(__pyx_k_lbs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lbs */
  {__pyx_k_ldual, sizeof(__pyx_k_ldual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ldual */
  {__pyx_k_let, sizeof(__pyx_k_let), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_let */
  {__pyx_k_levelname_s_message_s, sizeof(__pyx_k_levelname_s_message_s), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_levelname_s_message_s */
  {__pyx_k_line, sizeof(__pyx_k_line), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_line */
  {__pyx_k_line_2, sizeof(__pyx_k_line_2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_line_2 */
  {__pyx_k_line_number, sizeof(__pyx_k_line_number), 0, 1, 1}, /* PyObject cname: __pyx_n_u_line_number */
  {__pyx_k_literal_eval, sizeof(__pyx_k_literal_eval), 0, 1, 1}, /* PyObject cname: __pyx_n_u_literal_eval */
  {__pyx_k_loadSession, sizeof(__pyx_k_loadSession), 0, 1, 1}, /* PyObject cname: __pyx_n_u_loadSession */
  {__pyx_k_load_session, sizeof(__pyx_k_load_session), 0, 1, 1}, /* PyObject cname: __pyx_n_u_load_session */
  {__pyx_k_logger, sizeof(__pyx_k_logger), 0, 1, 1}, /* PyObject cname: __pyx_n_u_logger */
  {__pyx_k_logging, sizeof(__pyx_k_logging), 0, 1, 1}, /* PyObject cname: __pyx_n_u_logging */
  {__pyx_k_lrc, sizeof(__pyx_k_lrc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lrc */
  {__pyx_k_lslack, sizeof(__pyx_k_lslack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lslack */
  {__pyx_k_lst, sizeof(__pyx_k_lst), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lst */
  {__pyx_k_lst_columns, sizeof(__pyx_k_lst_columns), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lst_columns */
  {__pyx_k_lst_index, sizeof(__pyx_k_lst_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lst_index */
  {__pyx_k_lst_solution, sizeof(__pyx_k_lst_solution), 0, 1, 1}, /* PyObject cname: __pyx_n_u_lst_solution */
  {__pyx_k_main, sizeof(__pyx_k_main), 0, 1, 1}, /* PyObject cname: __pyx_n_u_main */
  {__pyx_k_map, sizeof(__pyx_k_map), 0, 1, 1}, /* PyObject cname: __pyx_n_u_map */
  {__pyx_k_members, sizeof(__pyx_k_members), 0, 1, 1}, /* PyObject cname: __pyx_n_u_members */
  {__pyx_k_message, sizeof(__pyx_k_message), 0, 1, 1}, /* PyObject cname: __pyx_n_u_message */
  {__pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 1, 1}, /* PyObject cname: __pyx_n_u_metaclass */
  {__pyx_k_minimization, sizeof(__pyx_k_minimization), 0, 1, 1}, /* PyObject cname: __pyx_n_u_minimization */
  {__pyx_k_minimize, sizeof(__pyx_k_minimize), 0, 1, 1}, /* PyObject cname: __pyx_n_u_minimize */
  {__pyx_k_model, sizeof(__pyx_k_model), 0, 1, 1}, /* PyObject cname: __pyx_n_u_model */
  {__pyx_k_model_c, sizeof(__pyx_k_model_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_model_c */
  {__pyx_k_module, sizeof(__pyx_k_module), 0, 1, 1}, /* PyObject cname: __pyx_n_u_module */
  {__pyx_k_mro_entries, sizeof(__pyx_k_mro_entries), 0, 1, 1}, /* PyObject cname: __pyx_n_u_mro_entries */
  {__pyx_k_msg, sizeof(__pyx_k_msg), 0, 1, 1}, /* PyObject cname: __pyx_n_u_msg */
  {__pyx_k_multi_index, sizeof(__pyx_k_multi_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_multi_index */
  {__pyx_k_n, sizeof(__pyx_k_n), 0, 1, 1}, /* PyObject cname: __pyx_n_u_n */
  {__pyx_k_na, sizeof(__pyx_k_na), 0, 1, 1}, /* PyObject cname: __pyx_n_u_na */
  {__pyx_k_name, sizeof(__pyx_k_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_name */
  {__pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_name_2 */
  {__pyx_k_name_c, sizeof(__pyx_k_name_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_name_c */
  {__pyx_k_name_c_2, sizeof(__pyx_k_name_c_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_name_c_2 */
  {__pyx_k_names, sizeof(__pyx_k_names), 0, 1, 1}, /* PyObject cname: __pyx_n_u_names */
  {__pyx_k_nanoarrow, sizeof(__pyx_k_nanoarrow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_nanoarrow */
  {__pyx_k_ncols, sizeof(__pyx_k_ncols), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ncols */
  {__pyx_k_ncolumns, sizeof(__pyx_k_ncolumns), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ncolumns */
  {__pyx_k_ndarray, sizeof(__pyx_k_ndarray), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ndarray */
  {__pyx_k_nested, sizeof(__pyx_k_nested), 0, 1, 1}, /* PyObject cname: __pyx_n_u_nested */
  {__pyx_k_nested_dict_of_suffixes, sizeof(__pyx_k_nested_dict_of_suffixes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_nested_dict_of_suffixes */
  {__pyx_k_new, sizeof(__pyx_k_new), 0, 1, 1}, /* PyObject cname: __pyx_n_u_new */
  {__pyx_k_next, sizeof(__pyx_k_next), 0, 1, 1}, /* PyObject cname: __pyx_n_u_next */
  {__pyx_k_nindices, sizeof(__pyx_k_nindices), 0, 1, 1}, /* PyObject cname: __pyx_n_u_nindices */
  {__pyx_k_nlevels, sizeof(__pyx_k_nlevels), 0, 1, 1}, /* PyObject cname: __pyx_n_u_nlevels */
  {__pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_no_default___reduce___due_to_non */
  {__pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, /* PyObject cname: __pyx_n_u_np */
  {__pyx_k_nt, sizeof(__pyx_k_nt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_nt */
  {__pyx_k_num, sizeof(__pyx_k_num), 0, 1, 1}, /* PyObject cname: __pyx_n_u_num */
  {__pyx_k_numInstances, sizeof(__pyx_k_numInstances), 0, 1, 1}, /* PyObject cname: __pyx_n_u_numInstances */
  {__pyx_k_num_instances, sizeof(__pyx_k_num_instances), 0, 1, 1}, /* PyObject cname: __pyx_n_u_num_instances */
  {__pyx_k_number, sizeof(__pyx_k_number), 0, 1, 1}, /* PyObject cname: __pyx_n_u_number */
  {__pyx_k_numbers, sizeof(__pyx_k_numbers), 0, 1, 1}, /* PyObject cname: __pyx_n_u_numbers */
  {__pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_numpy */
  {__pyx_k_obj, sizeof(__pyx_k_obj), 0, 1, 1}, /* PyObject cname: __pyx_n_u_obj */
  {__pyx_k_obj_2, sizeof(__pyx_k_obj_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_obj_2 */
  {__pyx_k_obj_locals_Objectives, sizeof(__pyx_k_obj_locals_Objectives), 0, 1, 1}, /* PyObject cname: __pyx_n_u_obj_locals_Objectives */
  {__pyx_k_obj_locals_Objectives___getitem, sizeof(__pyx_k_obj_locals_Objectives___getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_obj_locals_Objectives___getitem */
  {__pyx_k_obj_locals_Objectives___init, sizeof(__pyx_k_obj_locals_Objectives___init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_obj_locals_Objectives___init */
  {__pyx_k_obj_locals_Objectives___iter, sizeof(__pyx_k_obj_locals_Objectives___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_obj_locals_Objectives___iter */
  {__pyx_k_object, sizeof(__pyx_k_object), 0, 1, 1}, /* PyObject cname: __pyx_n_u_object */
  {__pyx_k_objname, sizeof(__pyx_k_objname), 0, 1, 1}, /* PyObject cname: __pyx_n_u_objname */
  {__pyx_k_objname_c, sizeof(__pyx_k_objname_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_objname_c */
  {__pyx_k_offset, sizeof(__pyx_k_offset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_offset */
  {__pyx_k_offset_2, sizeof(__pyx_k_offset_2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_offset_2 */
  {__pyx_k_open, sizeof(__pyx_k_open), 0, 1, 1}, /* PyObject cname: __pyx_n_u_open */
  {__pyx_k_option, sizeof(__pyx_k_option), 0, 1, 1}, /* PyObject cname: __pyx_n_u_option */
  {__pyx_k_option_2, sizeof(__pyx_k_option_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_option_2 */
  {__pyx_k_option_locals_Options, sizeof(__pyx_k_option_locals_Options), 0, 1, 1}, /* PyObject cname: __pyx_n_u_option_locals_Options */
  {__pyx_k_option_locals_Options___getitem, sizeof(__pyx_k_option_locals_Options___getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_option_locals_Options___getitem */
  {__pyx_k_option_locals_Options___init, sizeof(__pyx_k_option_locals_Options___init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_option_locals_Options___init */
  {__pyx_k_option_locals_Options___setitem, sizeof(__pyx_k_option_locals_Options___setitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_option_locals_Options___setitem */
  {__pyx_k_option_locals_Options___setitem_2, sizeof(__pyx_k_option_locals_Options___setitem_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_option_locals_Options___setitem_2 */
  {__pyx_k_options, sizeof(__pyx_k_options), 0, 1, 1}, /* PyObject cname: __pyx_n_u_options */
  {__pyx_k_options_2, sizeof(__pyx_k_options_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_options_2 */
  {__pyx_k_options_c, sizeof(__pyx_k_options_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_options_c */
  {__pyx_k_options_dict, sizeof(__pyx_k_options_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_options_dict */
  {__pyx_k_os, sizeof(__pyx_k_os), 0, 1, 1}, /* PyObject cname: __pyx_n_u_os */
  {__pyx_k_output, sizeof(__pyx_k_output), 0, 1, 1}, /* PyObject cname: __pyx_n_u_output */
  {__pyx_k_output_c, sizeof(__pyx_k_output_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_output_c */
  {__pyx_k_output_handler, sizeof(__pyx_k_output_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_output_handler */
  {__pyx_k_p, sizeof(__pyx_k_p), 0, 1, 1}, /* PyObject cname: __pyx_n_u_p */
  {__pyx_k_pa, sizeof(__pyx_k_pa), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pa */
  {__pyx_k_pa_df, sizeof(__pyx_k_pa_df), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pa_df */
  {__pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pandas */
  {__pyx_k_param, sizeof(__pyx_k_param), 0, 1, 1}, /* PyObject cname: __pyx_n_u_param */
  {__pyx_k_param_2, sizeof(__pyx_k_param_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_param_2 */
  {__pyx_k_param_locals_Parameters, sizeof(__pyx_k_param_locals_Parameters), 0, 1, 1}, /* PyObject cname: __pyx_n_u_param_locals_Parameters */
  {__pyx_k_param_locals_Parameters___getit, sizeof(__pyx_k_param_locals_Parameters___getit), 0, 1, 1}, /* PyObject cname: __pyx_n_u_param_locals_Parameters___getit */
  {__pyx_k_param_locals_Parameters___init, sizeof(__pyx_k_param_locals_Parameters___init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_param_locals_Parameters___init */
  {__pyx_k_param_locals_Parameters___iter, sizeof(__pyx_k_param_locals_Parameters___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_param_locals_Parameters___iter */
  {__pyx_k_param_locals_Parameters___setit, sizeof(__pyx_k_param_locals_Parameters___setit), 0, 1, 1}, /* PyObject cname: __pyx_n_u_param_locals_Parameters___setit */
  {__pyx_k_path, sizeof(__pyx_k_path), 0, 1, 1}, /* PyObject cname: __pyx_n_u_path */
  {__pyx_k_pd, sizeof(__pyx_k_pd), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pd */
  {__pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pickle */
  {__pyx_k_pl, sizeof(__pyx_k_pl), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pl */
  {__pyx_k_polars, sizeof(__pyx_k_polars), 0, 1, 1}, /* PyObject cname: __pyx_n_u_polars */
  {__pyx_k_pop, sizeof(__pyx_k_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pop */
  {__pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 1, 1}, /* PyObject cname: __pyx_n_u_prepare */
  {__pyx_k_preserve_index, sizeof(__pyx_k_preserve_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_preserve_index */
  {__pyx_k_print, sizeof(__pyx_k_print), 0, 1, 1}, /* PyObject cname: __pyx_n_u_print */
  {__pyx_k_problem, sizeof(__pyx_k_problem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_problem */
  {__pyx_k_propagate, sizeof(__pyx_k_propagate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_propagate */
  {__pyx_k_property, sizeof(__pyx_k_property), 0, 1, 1}, /* PyObject cname: __pyx_n_u_property */
  {__pyx_k_py_list, sizeof(__pyx_k_py_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_py_list */
  {__pyx_k_py_variant, sizeof(__pyx_k_py_variant), 0, 1, 1}, /* PyObject cname: __pyx_n_u_py_variant */
  {__pyx_k_pyarrow, sizeof(__pyx_k_pyarrow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyarrow */
  {__pyx_k_pylist, sizeof(__pyx_k_pylist), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pylist */
  {__pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_PickleError */
  {__pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_checksum */
  {__pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_result */
  {__pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_state */
  {__pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_type */
  {__pyx_k_pyx_unpickle_AMPLException, sizeof(__pyx_k_pyx_unpickle_AMPLException), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_AMPLException */
  {__pyx_k_pyx_unpickle_ErrorHandler, sizeof(__pyx_k_pyx_unpickle_ErrorHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_ErrorHandler */
  {__pyx_k_pyx_unpickle_OutputHandler, sizeof(__pyx_k_pyx_unpickle_OutputHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_OutputHandler */
  {__pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_vtable */
  {__pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 1, 1}, /* PyObject cname: __pyx_n_u_qualname */
  {__pyx_k_range, sizeof(__pyx_k_range), 0, 1, 1}, /* PyObject cname: __pyx_n_u_range */
  {__pyx_k_rc, sizeof(__pyx_k_rc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rc */
  {__pyx_k_read, sizeof(__pyx_k_read), 0, 1, 1}, /* PyObject cname: __pyx_n_u_read */
  {__pyx_k_readData, sizeof(__pyx_k_readData), 0, 1, 1}, /* PyObject cname: __pyx_n_u_readData */
  {__pyx_k_readTable, sizeof(__pyx_k_readTable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_readTable */
  {__pyx_k_read_data, sizeof(__pyx_k_read_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_read_data */
  {__pyx_k_read_table, sizeof(__pyx_k_read_table), 0, 1, 1}, /* PyObject cname: __pyx_n_u_read_table */
  {__pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reduce */
  {__pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reduce_cython */
  {__pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reduce_ex */
  {__pyx_k_replace, sizeof(__pyx_k_replace), 0, 1, 1}, /* PyObject cname: __pyx_n_u_replace */
  {__pyx_k_reset, sizeof(__pyx_k_reset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reset */
  {__pyx_k_reset_index, sizeof(__pyx_k_reset_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reset_index */
  {__pyx_k_restore, sizeof(__pyx_k_restore), 0, 1, 1}, /* PyObject cname: __pyx_n_u_restore */
  {__pyx_k_result, sizeof(__pyx_k_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_result */
  {__pyx_k_return_output, sizeof(__pyx_k_return_output), 0, 1, 1}, /* PyObject cname: __pyx_n_u_return_output */
  {__pyx_k_rmtree, sizeof(__pyx_k_rmtree), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rmtree */
  {__pyx_k_row, sizeof(__pyx_k_row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_row */
  {__pyx_k_rowindex, sizeof(__pyx_k_rowindex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rowindex */
  {__pyx_k_scalar_expression, sizeof(__pyx_k_scalar_expression), 0, 1, 1}, /* PyObject cname: __pyx_n_u_scalar_expression */
  {__pyx_k_schema_ptr, sizeof(__pyx_k_schema_ptr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_schema_ptr */
  {__pyx_k_scip, sizeof(__pyx_k_scip), 0, 1, 1}, /* PyObject cname: __pyx_n_u_scip */
  {__pyx_k_self, sizeof(__pyx_k_self), 0, 1, 1}, /* PyObject cname: __pyx_n_u_self */
  {__pyx_k_self__c_ampl_cannot_be_converted, sizeof(__pyx_k_self__c_ampl_cannot_be_converted), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self__c_ampl_cannot_be_converted */
  {__pyx_k_self__c_ampl_self__index_self_be, sizeof(__pyx_k_self__c_ampl_self__index_self_be), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self__c_ampl_self__index_self_be */
  {__pyx_k_self__df_cannot_be_converted_to, sizeof(__pyx_k_self__df_cannot_be_converted_to), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self__df_cannot_be_converted_to */
  {__pyx_k_self__index_cannot_be_converted, sizeof(__pyx_k_self__index_cannot_be_converted), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self__index_cannot_be_converted */
  {__pyx_k_self_begin_cannot_be_converted_t, sizeof(__pyx_k_self_begin_cannot_be_converted_t), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self_begin_cannot_be_converted_t */
  {__pyx_k_self_begin_self_end_self_env_c_s, sizeof(__pyx_k_self_begin_self_end_self_env_c_s), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self_begin_self_end_self_env_c_s */
  {__pyx_k_send, sizeof(__pyx_k_send), 0, 1, 1}, /* PyObject cname: __pyx_n_u_send */
  {__pyx_k_set, sizeof(__pyx_k_set), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set */
  {__pyx_k_setBinDir, sizeof(__pyx_k_setBinDir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setBinDir */
  {__pyx_k_setBinName, sizeof(__pyx_k_setBinName), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setBinName */
  {__pyx_k_setColumn, sizeof(__pyx_k_setColumn), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setColumn */
  {__pyx_k_setData, sizeof(__pyx_k_setData), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setData */
  {__pyx_k_setDual, sizeof(__pyx_k_setDual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setDual */
  {__pyx_k_setErrorHandler, sizeof(__pyx_k_setErrorHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setErrorHandler */
  {__pyx_k_setFormatter, sizeof(__pyx_k_setFormatter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setFormatter */
  {__pyx_k_setLevel, sizeof(__pyx_k_setLevel), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setLevel */
  {__pyx_k_setOption, sizeof(__pyx_k_setOption), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setOption */
  {__pyx_k_setOutputHandler, sizeof(__pyx_k_setOutputHandler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setOutputHandler */
  {__pyx_k_setValue, sizeof(__pyx_k_setValue), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setValue */
  {__pyx_k_setValues, sizeof(__pyx_k_setValues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setValues */
  {__pyx_k_setValues_2, sizeof(__pyx_k_setValues_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setValues_2 */
  {__pyx_k_set_2, sizeof(__pyx_k_set_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_2 */
  {__pyx_k_set_bin_dir, sizeof(__pyx_k_set_bin_dir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_bin_dir */
  {__pyx_k_set_bin_name, sizeof(__pyx_k_set_bin_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_bin_name */
  {__pyx_k_set_column, sizeof(__pyx_k_set_column), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_column */
  {__pyx_k_set_data, sizeof(__pyx_k_set_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_data */
  {__pyx_k_set_data_arrow, sizeof(__pyx_k_set_data_arrow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_data_arrow */
  {__pyx_k_set_dual, sizeof(__pyx_k_set_dual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_dual */
  {__pyx_k_set_error_handler, sizeof(__pyx_k_set_error_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_error_handler */
  {__pyx_k_set_error_handler_locals_ErrorHa, sizeof(__pyx_k_set_error_handler_locals_ErrorHa), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_error_handler_locals_ErrorHa */
  {__pyx_k_set_error_handler_locals_ErrorHa_2, sizeof(__pyx_k_set_error_handler_locals_ErrorHa_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_error_handler_locals_ErrorHa_2 */
  {__pyx_k_set_error_handler_locals_ErrorHa_3, sizeof(__pyx_k_set_error_handler_locals_ErrorHa_3), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_error_handler_locals_ErrorHa_3 */
  {__pyx_k_set_error_handler_locals_ErrorHa_4, sizeof(__pyx_k_set_error_handler_locals_ErrorHa_4), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_error_handler_locals_ErrorHa_4 */
  {__pyx_k_set_error_handler_locals_ErrorHa_5, sizeof(__pyx_k_set_error_handler_locals_ErrorHa_5), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_error_handler_locals_ErrorHa_5 */
  {__pyx_k_set_locals_Sets, sizeof(__pyx_k_set_locals_Sets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_locals_Sets */
  {__pyx_k_set_locals_Sets___getitem, sizeof(__pyx_k_set_locals_Sets___getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_locals_Sets___getitem */
  {__pyx_k_set_locals_Sets___init, sizeof(__pyx_k_set_locals_Sets___init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_locals_Sets___init */
  {__pyx_k_set_locals_Sets___iter, sizeof(__pyx_k_set_locals_Sets___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_locals_Sets___iter */
  {__pyx_k_set_locals_Sets___setitem, sizeof(__pyx_k_set_locals_Sets___setitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_locals_Sets___setitem */
  {__pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_name */
  {__pyx_k_set_name_2, sizeof(__pyx_k_set_name_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_name_2 */
  {__pyx_k_set_option, sizeof(__pyx_k_set_option), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_option */
  {__pyx_k_set_option_2, sizeof(__pyx_k_set_option_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_option_2 */
  {__pyx_k_set_option_locals_genexpr, sizeof(__pyx_k_set_option_locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_option_locals_genexpr */
  {__pyx_k_set_output_handler, sizeof(__pyx_k_set_output_handler), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_output_handler */
  {__pyx_k_set_value, sizeof(__pyx_k_set_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_value */
  {__pyx_k_set_values, sizeof(__pyx_k_set_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_values */
  {__pyx_k_set_values_2, sizeof(__pyx_k_set_values_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_values_2 */
  {__pyx_k_set_values_locals_cast_row, sizeof(__pyx_k_set_values_locals_cast_row), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_values_locals_cast_row */
  {__pyx_k_set_values_locals_cast_value, sizeof(__pyx_k_set_values_locals_cast_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_values_locals_cast_value */
  {__pyx_k_set_values_locals_conv_to_list, sizeof(__pyx_k_set_values_locals_conv_to_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_values_locals_conv_to_list */
  {__pyx_k_set_values_locals_genexpr, sizeof(__pyx_k_set_values_locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_values_locals_genexpr */
  {__pyx_k_setitem, sizeof(__pyx_k_setitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setitem */
  {__pyx_k_sets, sizeof(__pyx_k_sets), 0, 1, 1}, /* PyObject cname: __pyx_n_u_sets */
  {__pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setstate */
  {__pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setstate_cython */
  {__pyx_k_shape, sizeof(__pyx_k_shape), 0, 1, 1}, /* PyObject cname: __pyx_n_u_shape */
  {__pyx_k_shutil, sizeof(__pyx_k_shutil), 0, 1, 1}, /* PyObject cname: __pyx_n_u_shutil */
  {__pyx_k_size, sizeof(__pyx_k_size), 0, 1, 1}, /* PyObject cname: __pyx_n_u_size */
  {__pyx_k_skip_index, sizeof(__pyx_k_skip_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_skip_index */
  {__pyx_k_slack, sizeof(__pyx_k_slack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_slack */
  {__pyx_k_snapshot, sizeof(__pyx_k_snapshot), 0, 1, 1}, /* PyObject cname: __pyx_n_u_snapshot */
  {__pyx_k_sol, sizeof(__pyx_k_sol), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_sol */
  {__pyx_k_solfile, sizeof(__pyx_k_solfile), 0, 1, 1}, /* PyObject cname: __pyx_n_u_solfile */
  {__pyx_k_solution, sizeof(__pyx_k_solution), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_solution */
  {__pyx_k_solve, sizeof(__pyx_k_solve), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_solve */
  {__pyx_k_solve_2, sizeof(__pyx_k_solve_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_solve_2 */
  {__pyx_k_solve_result, sizeof(__pyx_k_solve_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_solve_result */
  {__pyx_k_solve_result_num, sizeof(__pyx_k_solve_result_num), 0, 1, 1}, /* PyObject cname: __pyx_n_u_solve_result_num */
  {__pyx_k_solver, sizeof(__pyx_k_solver), 0, 1, 1}, /* PyObject cname: __pyx_n_u_solver */
  {__pyx_k_solver_list, sizeof(__pyx_k_solver_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_solver_list */
  {__pyx_k_source_name, sizeof(__pyx_k_source_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_source_name */
  {__pyx_k_spec, sizeof(__pyx_k_spec), 0, 1, 1}, /* PyObject cname: __pyx_n_u_spec */
  {__pyx_k_split, sizeof(__pyx_k_split), 0, 1, 1}, /* PyObject cname: __pyx_n_u_split */
  {__pyx_k_sstatus, sizeof(__pyx_k_sstatus), 0, 1, 1}, /* PyObject cname: __pyx_n_u_sstatus */
  {__pyx_k_stack, sizeof(__pyx_k_stack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stack */
  {__pyx_k_startRecording, sizeof(__pyx_k_startRecording), 0, 1, 1}, /* PyObject cname: __pyx_n_u_startRecording */
  {__pyx_k_start_recording, sizeof(__pyx_k_start_recording), 0, 1, 1}, /* PyObject cname: __pyx_n_u_start_recording */
  {__pyx_k_state, sizeof(__pyx_k_state), 0, 1, 1}, /* PyObject cname: __pyx_n_u_state */
  {__pyx_k_statements, sizeof(__pyx_k_statements), 0, 1, 1}, /* PyObject cname: __pyx_n_u_statements */
  {__pyx_k_statements_c, sizeof(__pyx_k_statements_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_statements_c */
  {__pyx_k_status, sizeof(__pyx_k_status), 0, 1, 1}, /* PyObject cname: __pyx_n_u_status */
  {__pyx_k_stderr, sizeof(__pyx_k_stderr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stderr */
  {__pyx_k_stmt, sizeof(__pyx_k_stmt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stmt */
  {__pyx_k_stopRecording, sizeof(__pyx_k_stopRecording), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stopRecording */
  {__pyx_k_stop_recording, sizeof(__pyx_k_stop_recording), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stop_recording */
  {__pyx_k_stream, sizeof(__pyx_k_stream), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stream */
  {__pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_stringsource */
  {__pyx_k_suffixes, sizeof(__pyx_k_suffixes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_suffixes */
  {__pyx_k_suffixes_c, sizeof(__pyx_k_suffixes_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_suffixes_c */
  {__pyx_k_super, sizeof(__pyx_k_super), 0, 1, 1}, /* PyObject cname: __pyx_n_u_super */
  {__pyx_k_sys, sizeof(__pyx_k_sys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_sys */
  {__pyx_k_t, sizeof(__pyx_k_t), 0, 1, 1}, /* PyObject cname: __pyx_n_u_t */
  {__pyx_k_t_c, sizeof(__pyx_k_t_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_t_c */
  {__pyx_k_table_name, sizeof(__pyx_k_table_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_table_name */
  {__pyx_k_test, sizeof(__pyx_k_test), 0, 1, 1}, /* PyObject cname: __pyx_n_u_test */
  {__pyx_k_throw, sizeof(__pyx_k_throw), 0, 1, 1}, /* PyObject cname: __pyx_n_u_throw */
  {__pyx_k_throw_on_warnings, sizeof(__pyx_k_throw_on_warnings), 0, 1, 1}, /* PyObject cname: __pyx_n_u_throw_on_warnings */
  {__pyx_k_tmpdir, sizeof(__pyx_k_tmpdir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tmpdir */
  {__pyx_k_toDict, sizeof(__pyx_k_toDict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_toDict */
  {__pyx_k_toList, sizeof(__pyx_k_toList), 0, 1, 1}, /* PyObject cname: __pyx_n_u_toList */
  {__pyx_k_toPandas, sizeof(__pyx_k_toPandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_toPandas */
  {__pyx_k_toString, sizeof(__pyx_k_toString), 0, 1, 1}, /* PyObject cname: __pyx_n_u_toString */
  {__pyx_k_to_ampls, sizeof(__pyx_k_to_ampls), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_ampls */
  {__pyx_k_to_arrow, sizeof(__pyx_k_to_arrow), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_arrow */
  {__pyx_k_to_dict, sizeof(__pyx_k_to_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_dict */
  {__pyx_k_to_list, sizeof(__pyx_k_to_list), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_list */
  {__pyx_k_to_pandas, sizeof(__pyx_k_to_pandas), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_pandas */
  {__pyx_k_to_string, sizeof(__pyx_k_to_string), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_string */
  {__pyx_k_to_string_c, sizeof(__pyx_k_to_string_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_string_c */
  {__pyx_k_to_tuple, sizeof(__pyx_k_to_tuple), 0, 1, 1}, /* PyObject cname: __pyx_n_u_to_tuple */
  {__pyx_k_tolist, sizeof(__pyx_k_tolist), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tolist */
  {__pyx_k_tools, sizeof(__pyx_k_tools), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tools */
  {__pyx_k_tuple, sizeof(__pyx_k_tuple), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tuple */
  {__pyx_k_tuple_c, sizeof(__pyx_k_tuple_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tuple_c */
  {__pyx_k_ub, sizeof(__pyx_k_ub), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ub */
  {__pyx_k_ub0, sizeof(__pyx_k_ub0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ub0 */
  {__pyx_k_ub1, sizeof(__pyx_k_ub1), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ub1 */
  {__pyx_k_ub2, sizeof(__pyx_k_ub2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ub2 */
  {__pyx_k_ubs, sizeof(__pyx_k_ubs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ubs */
  {__pyx_k_udual, sizeof(__pyx_k_udual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_udual */
  {__pyx_k_unfix, sizeof(__pyx_k_unfix), 0, 1, 1}, /* PyObject cname: __pyx_n_u_unfix */
  {__pyx_k_unsupported_type, sizeof(__pyx_k_unsupported_type), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unsupported_type */
  {__pyx_k_update, sizeof(__pyx_k_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_update */
  {__pyx_k_urc, sizeof(__pyx_k_urc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_urc */
  {__pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_use_setstate */
  {__pyx_k_uslack, sizeof(__pyx_k_uslack), 0, 1, 1}, /* PyObject cname: __pyx_n_u_uslack */
  {__pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_utf_8 */
  {__pyx_k_v, sizeof(__pyx_k_v), 0, 1, 1}, /* PyObject cname: __pyx_n_u_v */
  {__pyx_k_val, sizeof(__pyx_k_val), 0, 1, 1}, /* PyObject cname: __pyx_n_u_val */
  {__pyx_k_value, sizeof(__pyx_k_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_value */
  {__pyx_k_value_c, sizeof(__pyx_k_value_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_value_c */
  {__pyx_k_values, sizeof(__pyx_k_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_values */
  {__pyx_k_var, sizeof(__pyx_k_var), 0, 1, 1}, /* PyObject cname: __pyx_n_u_var */
  {__pyx_k_var_2, sizeof(__pyx_k_var_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_var_2 */
  {__pyx_k_var_locals_Variables, sizeof(__pyx_k_var_locals_Variables), 0, 1, 1}, /* PyObject cname: __pyx_n_u_var_locals_Variables */
  {__pyx_k_var_locals_Variables___getitem, sizeof(__pyx_k_var_locals_Variables___getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_var_locals_Variables___getitem */
  {__pyx_k_var_locals_Variables___init, sizeof(__pyx_k_var_locals_Variables___init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_var_locals_Variables___init */
  {__pyx_k_var_locals_Variables___iter, sizeof(__pyx_k_var_locals_Variables___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_var_locals_Variables___iter */
  {__pyx_k_var_locals_Variables___setitem, sizeof(__pyx_k_var_locals_Variables___setitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_var_locals_Variables___setitem */
  {__pyx_k_verbose, sizeof(__pyx_k_verbose), 0, 1, 1}, /* PyObject cname: __pyx_n_u_verbose */
  {__pyx_k_warning, sizeof(__pyx_k_warning), 0, 1, 1}, /* PyObject cname: __pyx_n_u_warning */
  {__pyx_k_workdir, sizeof(__pyx_k_workdir), 0, 1, 1}, /* PyObject cname: __pyx_n_u_workdir */
  {__pyx_k_workdir_c, sizeof(__pyx_k_workdir_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_workdir_c */
  {__pyx_k_write, sizeof(__pyx_k_write), 0, 1, 1}, /* PyObject cname: __pyx_n_u_write */
  {__pyx_k_writeTable, sizeof(__pyx_k_writeTable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_writeTable */
  {__pyx_k_write_sol, sizeof(__pyx_k_write_sol), 0, 1, 1}, /* PyObject cname: __pyx_n_u_write_sol */
  {__pyx_k_write_table, sizeof(__pyx_k_write_table), 0, 1, 1}, /* PyObject cname: __pyx_n_u_write_table */
  {__pyx_k_xpress, sizeof(__pyx_k_xpress), 0, 1, 1}, /* PyObject cname: __pyx_n_u_xpress */
  {__pyx_k_xref, sizeof(__pyx_k_xref), 0, 1, 1}, /* PyObject cname: __pyx_n_u_xref */
  {__pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 1, 1}, /* PyObject cname: __pyx_n_u_zeros */
  {__pyx_k_zip, sizeof(__pyx_k_zip), 0, 1, 1}, /* PyObject cname: __pyx_n_u_zip */
  {0, 0, 0, 0, 0}
};
/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry const *t, PyObject **target, const char* const* encoding_names);

/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 13, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 55, __pyx_L1_error)
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_object); if (!__pyx_builtin_object) __PYX_ERR(3, 33, __pyx_L1_error)
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_property); if (!__pyx_builtin_property) __PYX_ERR(0, 956, __pyx_L1_error)
  __pyx_builtin_SystemError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_SystemError); if (!__pyx_builtin_SystemError) __PYX_ERR(4, 24, __pyx_L1_error)
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(4, 27, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(4, 30, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(4, 55, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(4, 58, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_range); if (!__pyx_builtin_range) __PYX_ERR(4, 71, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(5, 61, __pyx_L1_error)
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 248, __pyx_L1_error)
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_map); if (!__pyx_builtin_map) __PYX_ERR(1, 290, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(1, 299, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(1, 435, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 535, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_super); if (!__pyx_builtin_super) __PYX_ERR(2, 10, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(6, 26, __pyx_L1_error)
  __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(3, 27, __pyx_L1_error)
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_open); if (!__pyx_builtin_open) __PYX_ERR(0, 1181, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "amplpy/dataframe.pxi":595
 *     @classmethod
 *     def _from_data_frame_ref(cls, df_ref):
 *         return cls(None, None, _impl=df_ref)             # <<<<<<<<<<<<<<
 * 
 *     # Aliases
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "amplpy/environment.pxi":29
 *         if os.name == "nt":
 *             # Workaround for Windows issue with environment variables
 *             for option_name in ["ampl_libpath", "solver"]:             # <<<<<<<<<<<<<<
 *                 option_value = os.environ.get(option_name, "")
 *                 if option_value:
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_ampl_libpath, __pyx_mstate_global->__pyx_n_u_solver); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(11, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

  /* "amplpy/ampl.pyx":378
 *         """
 *         # Workaround for #56
 *         if not statements.endswith((" ", ";", "\n")):             # <<<<<<<<<<<<<<
 *             statements += "\n"
 *         PY_AMPL_CALL(campl.AMPL_Eval(self._c_ampl, statements.encode('utf-8')))
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_kp_u__14, __pyx_mstate_global->__pyx_kp_u__15, __pyx_mstate_global->__pyx_kp_u__5); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "amplpy/ampl.pyx":826
 *         """
 * 
 *         class Variables(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

  /* "amplpy/ampl.pyx":849
 *         """
 * 
 *         class Constraints(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);

  /* "amplpy/ampl.pyx":872
 *         """
 * 
 *         class Objectives(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);
  __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "amplpy/ampl.pyx":889
 *         """
 * 
 *         class Sets(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);
  __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "amplpy/ampl.pyx":909
 *         """
 * 
 *         class Parameters(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);
  __pyx_mstate_global->__pyx_tuple[12] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[12])) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[12]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[12]);

  /* "amplpy/ampl.pyx":932
 *         """
 * 
 *         class Options(object):             # <<<<<<<<<<<<<<
 *             def __init__(self, ampl):
 *                 self.ampl = ampl
*/
  __pyx_mstate_global->__pyx_tuple[13] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[13])) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[13]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[13]);
  __pyx_mstate_global->__pyx_tuple[14] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[14])) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[14]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[14]);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xe3b0c44, 0xda39a3e, 0xd41d8cd):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())" % __pyx_checksum
*/
  __pyx_mstate_global->__pyx_tuple[15] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_238750788, __pyx_mstate_global->__pyx_int_228825662, __pyx_mstate_global->__pyx_int_222419149); if (unlikely(!__pyx_mstate_global->__pyx_tuple[15])) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[15]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[15]);

  /* "amplpy/dataframe.pxi":255
 *             PY_AMPL_CALL(errorinfo)
 * 
 *     def _add_column(self, header, values=None):             # <<<<<<<<<<<<<<
 *         """
 *         Add a new column with the corresponding header and values to the
*/
  __pyx_mstate_global->__pyx_tuple[16] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[16])) __PYX_ERR(1, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[16]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[16]);

  /* "amplpy/dataframe.pxi":451
 *         return d
 * 
 *     def to_list(self, skip_index=False):             # <<<<<<<<<<<<<<
 *         """
 *         Return a list with the DataFrame data.
*/
  __pyx_mstate_global->__pyx_tuple[17] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[17])) __PYX_ERR(1, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[17]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[17]);

  /* "amplpy/dataframe.pxi":474
 *             return lst
 * 
 *     def to_pandas(self, multi_index=True):             # <<<<<<<<<<<<<<
 *         """
 *         Return a pandas.DataFrame with the DataFrame data.
*/
  __pyx_mstate_global->__pyx_tuple[18] = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_mstate_global->__pyx_tuple[18])) __PYX_ERR(1, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[18]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[18]);

  /* "amplpy/exceptions.pxi":55
 * 
 * 
 * class PresolveException(RuntimeError):             # <<<<<<<<<<<<<<
 *     pass
 * 
*/
  __pyx_mstate_global->__pyx_tuple[19] = PyTuple_Pack(1, __pyx_builtin_RuntimeError); if (unlikely(!__pyx_mstate_global->__pyx_tuple[19])) __PYX_ERR(2, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[19]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[19]);
  __pyx_mstate_global->__pyx_tuple[20] = PyTuple_Pack(1, __pyx_builtin_RuntimeError); if (unlikely(!__pyx_mstate_global->__pyx_tuple[20])) __PYX_ERR(2, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[20]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[20]);

  /* "amplpy/exceptions.pxi":59
 * 
 * 
 * class InfeasibilityException(RuntimeError):             # <<<<<<<<<<<<<<
 *     pass
*/
  __pyx_mstate_global->__pyx_tuple[21] = PyTuple_Pack(1, __pyx_builtin_RuntimeError); if (unlikely(!__pyx_mstate_global->__pyx_tuple[21])) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[21]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[21]);
  __pyx_mstate_global->__pyx_tuple[22] = PyTuple_Pack(1, __pyx_builtin_RuntimeError); if (unlikely(!__pyx_mstate_global->__pyx_tuple[22])) __PYX_ERR(2, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[22]);

  /* "amplpy/outputhandler.pxi":33
 *     PyOutputHandler.output(kind, msg.decode('utf-8'))
 * 
 * class Kind(object):             # <<<<<<<<<<<<<<
 *     """
 *     Represents the type of the output coming from the interpreter.
*/
  __pyx_mstate_global->__pyx_tuple[23] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[23])) __PYX_ERR(3, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[23]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[23]);
  __pyx_mstate_global->__pyx_tuple[24] = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_mstate_global->__pyx_tuple[24])) __PYX_ERR(3, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[24]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[24]);

  /* "amplpy/ampl.pyx":430
 *         return isrunning
 * 
 *     def solve(self, problem="", solver="", verbose=True, return_output=False, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Solve the current model or the problem specified by ``problem``.
*/
  __pyx_mstate_global->__pyx_tuple[25] = PyTuple_Pack(4, __pyx_mstate_global->__pyx_kp_u__3, __pyx_mstate_global->__pyx_kp_u__3, Py_True, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[25])) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[25]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[25]);

  /* "amplpy/ampl.pyx":963
 *     option = property(_option, _set_option)
 * 
 *     def export_model(self, filename=""):             # <<<<<<<<<<<<<<
 *         """
 *         Create a .mod file with the model that has been loaded.
*/
  __pyx_mstate_global->__pyx_tuple[26] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u__3); if (unlikely(!__pyx_mstate_global->__pyx_tuple[26])) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[26]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[26]);

  /* "amplpy/ampl.pyx":999
 *         return output
 * 
 *     def snapshot(self, filename="", model=True, data=True, options=True):             # <<<<<<<<<<<<<<
 *         """
 *         Create a snapshot file that replicates the current session.
*/
  __pyx_mstate_global->__pyx_tuple[27] = PyTuple_Pack(4, __pyx_mstate_global->__pyx_kp_u__3, Py_True, Py_True, Py_True); if (unlikely(!__pyx_mstate_global->__pyx_tuple[27])) __PYX_ERR(0, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[27]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[27]);

  /* "amplpy/ampl.pyx":1131
 *         return iis_var, iis_con
 * 
 *     def get_solution(self, flat=True, zeros=False):             # <<<<<<<<<<<<<<
 *         """
 *         Get solution values for all variables.
*/
  __pyx_mstate_global->__pyx_tuple[28] = PyTuple_Pack(2, Py_True, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[28])) __PYX_ERR(0, 1131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[28]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[28]);

  /* "amplpy/ampl.pyx":1225
 *         raise ValueError(f"{driver} is not supported, please choose from: {solver_list}")
 * 
 *     def import_ampls_solution(self, model, number=None, import_entities=False, keep_files=False):             # <<<<<<<<<<<<<<
 *         if isinstance(model, dict):
 *             self.eval(
*/
  __pyx_mstate_global->__pyx_tuple[29] = PyTuple_Pack(3, Py_None, Py_False, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[29])) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[29]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[29]);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  if (__Pyx_InitStrings(__pyx_string_tab, __pyx_mstate->__pyx_string_tab, __pyx_string_tab_encodings) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_mstate->__pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_mstate->__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_0 = PyLong_FromLong(0); if (unlikely(!__pyx_mstate->__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_1 = PyLong_FromLong(1); if (unlikely(!__pyx_mstate->__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_222419149 = PyLong_FromLong(222419149L); if (unlikely(!__pyx_mstate->__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_228825662 = PyLong_FromLong(228825662L); if (unlikely(!__pyx_mstate->__pyx_int_228825662)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_238750788 = PyLong_FromLong(238750788L); if (unlikely(!__pyx_mstate->__pyx_int_238750788)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_neg_1 = PyLong_FromLong(-1); if (unlikely(!__pyx_mstate->__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
\
        typedef struct {
            unsigned int argcount : 3;
            unsigned int num_posonly_args : 1;
            unsigned int num_kwonly_args : 1;
            unsigned int nlocals : 5;
            unsigned int flags : 10;
            unsigned int first_line : 11;
            unsigned int line_table_length : 14;
        } __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        __Pyx_PyCode_New_function_description descr,
        PyObject **varnames,
        PyObject *filename,
        PyObject *funcname,
        const char *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 199, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 276, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 289, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 396, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 412, 43};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_conv_to_list, __pyx_k_z_q_1G1_t1A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 523, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__19, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 524, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__19, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 512, 29};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_e};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_tuple, __pyx_k_z_gQ_uAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 198, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_parameter_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 204, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_parameter_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 147, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 153, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 183, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_row};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 189, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_row};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 160, 45};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_cast_value, __pyx_k_z_q_1G1_uAQ_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 168, 92};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_row};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_cast_row, __pyx_k_z_q_q_1E_uAQ_1E_uAS_Q_6_A_1A_AR, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 720, 25};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl_instance, __pyx_mstate->__pyx_n_u_error_handler};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 725, 43};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exception, __pyx_mstate->__pyx_n_u_exp};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_error, __pyx_k_A_fAQ_A_t_3a_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 732, 63};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exception, __pyx_mstate->__pyx_n_u_exp};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_warning, __pyx_k_A_haq_A_t_3a_4uKq0Fc_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 742, 36};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exp};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_check, __pyx_k_A_Qd_31_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 827, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 830, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_t5_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 833, 47};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_k_A_QgQ_5_1_5_1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 839, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_t5_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 850, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 853, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_t5_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 856, 47};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_k_A_QgQ__AU_1A__AU_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 862, 14};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_t5_0, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 873, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 876, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_t5_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 879, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_t5_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 890, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 893, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_t5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 896, 19};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_values};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_k_A_E_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 899, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_t5_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 910, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 913, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_t5_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 916, 49};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_k_A_QhfA_1E_Qa_1E_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 922, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_t5_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 942, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 933, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 936, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_t5_1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 939, 56};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_k_A_QgQ_t9AQ_E_AV3e1A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 952, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1229, 2};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__20, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 48, 47};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_is_logical, __pyx_k_A_7q_F_DPXXYYZ_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 64, 24};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_drop, __pyx_k_A_F_4vZt1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 71, 24};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_restore, __pyx_k_A_F_Qd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 78, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_body, __pyx_k_A_F_7q_F_DPXX_J_J_K_K_L_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 86, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_astatus, __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 100, 56};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_defvar, __pyx_k_A_F_4AT_z_XUYYz_I_I_J_J_K_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 109, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_dinit, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 117, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_dinit0, __pyx_k_A_F_7q_F_DPXX_L_L_M_M_N_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 125, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_dual, __pyx_k_A_F_7q_F_DPXX_J_J_K_K_L_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 138, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_lb, __pyx_k_A_F_7q_F_DPXX_H_H_I_I_J_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 146, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_ub, __pyx_k_A_F_7q_F_DPXX_H_H_I_I_J_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 154, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_lbs, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 163, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_ubs, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 172, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[58] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_ldual, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[58])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 180, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[59] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_udual, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[59])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 188, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[60] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_lslack, __pyx_k_A_F_7q_F_DPXX_L_L_M_M_N_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[60])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 196, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[61] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_uslack, __pyx_k_A_F_7q_F_DPXX_L_L_M_M_N_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[61])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 204, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[62] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_slack, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[62])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 212, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[63] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_sstatus, __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[63])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 227, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[64] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_status, __pyx_k_A_6at6_4xW_J_J_K_K_L_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[64])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 241, 40};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_dual};
    __pyx_mstate_global->__pyx_codeobj_tab[65] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_set_dual, __pyx_k_A_F_9_fJdRZZ_ggllmmn, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[65])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 258, 76};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[66] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_constraint_pxi, __pyx_mstate->__pyx_n_u_val, __pyx_k_A_4_1D_jPTT_a_B_B_M_M_N_N_O_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[66])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[67] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[67])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[68] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[68])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 46, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[69] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_string, __pyx_k_A_s_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[69])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[70] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[70])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[71] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[71])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 73, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[72] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_string, __pyx_k_A_s_4xq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[72])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 76, 81};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_py_list, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_rowindex, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[73] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_list, __pyx_k_A_F_31D_aq_E_aq_4AT_s_iqPQ_7_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[73])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[74] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[74])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[75] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[75])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 187, 49};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[76] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_string, __pyx_k_A_F_1_haq_1G7_1_Qaq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[76])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 201, 31};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_num};
    __pyx_mstate_global->__pyx_codeobj_tab[77] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_get_num_cols, __pyx_k_A_F_31D_s_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[77])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 213, 31};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_num};
    __pyx_mstate_global->__pyx_codeobj_tab[78] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_get_num_rows, __pyx_k_A_F_31D_s_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[78])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 224, 31};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_num};
    __pyx_mstate_global->__pyx_codeobj_tab[79] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_get_num_indices, __pyx_k_A_F_6at81A_s_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[79])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 235, 107};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_tuple_c};
    __pyx_mstate_global->__pyx_codeobj_tab[80] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_add_row, __pyx_k_A_3awc_4z_q_WA_E_s_7_T_q_1E_at81, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[80])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 255, 355};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_size, __pyx_mstate->__pyx_n_u_c_string_array, __pyx_mstate->__pyx_n_u_c_double_array, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[81] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_add_column, __pyx_k_3aq_1_a_7_Q_Q_5_1_1D_gUVVW_3axs, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[81])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 301, 47};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_index};
    __pyx_mstate_global->__pyx_codeobj_tab[82] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_get_column, __pyx_k_A_F_7q_HF_QRR_WAT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[82])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 312, 313};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_c_double_array, __pyx_mstate->__pyx_n_u_c_string_array, __pyx_mstate->__pyx_n_u_size, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[83] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_set_column, __pyx_k_A_a_Q_3aq_QfAT_YfAU_A_U_1_auF_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[83])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 351, 65};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_tuple};
    __pyx_mstate_global->__pyx_codeobj_tab[84] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_get_row, __pyx_k_A_z_31D_q_AQa_1_ha, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[84])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 371, 17};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_index};
    __pyx_mstate_global->__pyx_codeobj_tab[85] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_get_row_by_index, __pyx_k_A_ha, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[85])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 383, 81};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_size, __pyx_mstate->__pyx_n_u_headers, __pyx_mstate->__pyx_n_u_headers_py, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[86] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_get_headers, __pyx_k_A_2_4xq_aq_1_U_a_E_aq_7_1_AQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[86])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 402, 102};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_ncols, __pyx_mstate->__pyx_n_u_nindices, __pyx_mstate->__pyx_n_u_conv_to_list, __pyx_mstate->__pyx_n_u_conv_to_list, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[87] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_set_values_2, __pyx_k_A_N_4_E_a_aq_3auCq_L_3awc_r_b, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[87])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 427, 184};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_nindices, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_header};
    __pyx_mstate_global->__pyx_codeobj_tab[88] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_dict, __pyx_k_A_A_4_9Cq_AQ_s_d_awhc_Zt_PQ_G1_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[88])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 451, 173};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_skip_index, __pyx_mstate->__pyx_n_u_lst, __pyx_mstate->__pyx_n_u_ncols, __pyx_mstate->__pyx_n_u_nindices, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_row};
    __pyx_mstate_global->__pyx_codeobj_tab[89] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_list, __pyx_k_4_S_Qd_AT_U_q_NRS_4_AS_E_at_QR, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[89])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 474, 242};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_multi_index, __pyx_mstate->__pyx_n_u_nindices, __pyx_mstate->__pyx_n_u_headers, __pyx_mstate->__pyx_n_u_columns, __pyx_mstate->__pyx_n_u_index_names, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[90] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_to_pandas, __pyx_k_A_s_4_m1_D_AWHCt_WAQ_gRq_3a_Cr, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[90])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {4, 0, 0, 21, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 499, 305};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_dic, __pyx_mstate->__pyx_n_u_index_names, __pyx_mstate->__pyx_n_u_column_names, __pyx_mstate->__pyx_n_u_to_tuple, __pyx_mstate->__pyx_n_u_to_tuple, __pyx_mstate->__pyx_n_u_lst_index, __pyx_mstate->__pyx_n_u_lst_columns, __pyx_mstate->__pyx_n_u_nindices, __pyx_mstate->__pyx_n_u_ncolumns, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_columns, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_cindex, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_column};
    __pyx_mstate_global->__pyx_codeobj_tab[91] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_from_dict, __pyx_k_A_1_z_q_s_5_1_D_AZs_q_d_3az_G1_S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[91])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {4, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 541, 366};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_df, __pyx_mstate->__pyx_n_u_index_names, __pyx_mstate->__pyx_n_u_indexarity, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_columns, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_cindex, __pyx_mstate->__pyx_n_u_cname};
    __pyx_mstate_global->__pyx_codeobj_tab[92] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_from_pandas, __pyx_k_A_s_Qd_A_Qa_Qd_A_3at3a_3avRvXXRx, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[92])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 575, 131};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_columns, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_col};
    __pyx_mstate_global->__pyx_codeobj_tab[93] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_from_numpy, __pyx_k_A_s_QfBa_A_s_4xs_IT_AT_A_Be2U_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[93])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 593, 17};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_df_ref};
    __pyx_mstate_global->__pyx_codeobj_tab[94] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_pxi, __pyx_mstate->__pyx_n_u_from_data_frame_ref, __pyx_k_A_s_6_vQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[94])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[95] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[95])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[96] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[96])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 64, 133};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_df, __pyx_mstate->__pyx_n_u_stream, __pyx_mstate->__pyx_n_u_c_schema_capsule, __pyx_mstate->__pyx_n_u__21, __pyx_mstate->__pyx_n_u_c_array_capsule, __pyx_mstate->__pyx_n_u_schema_ptr, __pyx_mstate->__pyx_n_u_array_ptr, __pyx_mstate->__pyx_n_u_obj_2};
    __pyx_mstate_global->__pyx_codeobj_tab[97] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_arrow_pxi, __pyx_mstate->__pyx_n_u_from_polars, __pyx_k_A_s_d_AT_1_2Ya_6_B_A_V9B_33MMaab, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[97])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {4, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 83, 421};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_df, __pyx_mstate->__pyx_n_u_index_names, __pyx_mstate->__pyx_n_u_indexarity, __pyx_mstate->__pyx_n_u_df_reset, __pyx_mstate->__pyx_n_u_pa_df, __pyx_mstate->__pyx_n_u_array_stream, __pyx_mstate->__pyx_n_u_c_schema_capsule, __pyx_mstate->__pyx_n_u_c_array_capsule, __pyx_mstate->__pyx_n_u_arrow_schema_ptr, __pyx_mstate->__pyx_n_u_arrow_array_ptr, __pyx_mstate->__pyx_n_u_obj_2, __pyx_mstate->__pyx_n_u_nindices, __pyx_mstate->__pyx_n_u_idx};
    __pyx_mstate_global->__pyx_codeobj_tab[98] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_dataframe_arrow_pxi, __pyx_mstate->__pyx_n_u_from_pandas, __pyx_k_A_uHD_D_JauBl_A_Qd_A_Qa_3at3a_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[98])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[99] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[99])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[100] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[100])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 79, 69};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_output_c, __pyx_mstate->__pyx_n_u_output};
    __pyx_mstate_global->__pyx_codeobj_tab[101] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_to_string, __pyx_k_A_31D_j_HTUUV_1_AXWAQ_Qaq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[101])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 103, 230};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_tuple_c, __pyx_mstate->__pyx_n_u_name_c, __pyx_mstate->__pyx_n_u_entity};
    __pyx_mstate_global->__pyx_codeobj_tab[102] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_get, __pyx_k_A_t_3awc_4z_q_WA_E_D_3awc_5T_XVS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[102])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 131, 202};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_index_c, __pyx_mstate->__pyx_n_u_indices_c, __pyx_mstate->__pyx_n_u_size, __pyx_mstate->__pyx_n_u_j};
    __pyx_mstate_global->__pyx_codeobj_tab[103] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_find, __pyx_k_A_t_1A_at6_4xqP_1_E_aq_ay_c_E_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[103])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 159, 27};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[104] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_instances, __pyx_k_A_wat84xtCSST, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[104])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 165, 17};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[105] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_name, __pyx_k_A_t6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[105])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 171, 52};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_indexarity};
    __pyx_mstate_global->__pyx_codeobj_tab[106] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_indexarity, __pyx_k_A_4xwa_7q_F_DPXXYYZ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[106])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 197, 25};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[107] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_is_scalar, __pyx_k_A_4_S_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[107])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 210, 39};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_size};
    __pyx_mstate_global->__pyx_codeobj_tab[108] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_num_instances, __pyx_k_A_F_5Qd_hVWWX_s_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[108])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 218, 118};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_size, __pyx_mstate->__pyx_n_u_sets, __pyx_mstate->__pyx_n_u_pylist};
    __pyx_mstate_global->__pyx_codeobj_tab[109] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_get_indexing_sets, __pyx_k_A_1_F_5Qd_hVWW___E_aq_t1Cs_gQd_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[109])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 243, 116};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_size, __pyx_mstate->__pyx_n_u_xref, __pyx_mstate->__pyx_n_u_pylist, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[110] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_xref, __pyx_k_A_1_F_Qd_havUVVW_E_aq_t1Cs_gQd_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[110])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 263, 226};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_suffixes, __pyx_mstate->__pyx_n_u_df_c, __pyx_mstate->__pyx_n_u_suffixes_c, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[111] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_get_values, __pyx_k_9Cq_31D_j_HTZZ___z_A_1A_4q_1E_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[111])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 305, 19};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[112] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_to_pandas, __pyx_k_A_t_b_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[112])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 311, 19};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[113] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_to_dict, __pyx_k_A_t_b_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[113])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 317, 19};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[114] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_to_list, __pyx_k_A_t_b_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[114])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 323, 381};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_df, __pyx_mstate->__pyx_n_u_data_frame, __pyx_mstate->__pyx_n_u_df_c, __pyx_mstate->__pyx_n_u_name_c_2};
    __pyx_mstate_global->__pyx_codeobj_tab[115] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_entity_pxi, __pyx_mstate->__pyx_n_u_set_values, __pyx_k_A4_F_q_F_D_PTT___QfA_2XQ_2_4vZyP, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[115])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[116] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[116])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[117] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[117])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 72, 35};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_to_string_c, __pyx_mstate->__pyx_n_u_to_string};
    __pyx_mstate_global->__pyx_codeobj_tab[118] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_environment_pxi, __pyx_mstate->__pyx_n_u_to_string, __pyx_k_A_at9AQ_Cq_7_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[118])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 78, 24};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_binary_directory};
    __pyx_mstate_global->__pyx_codeobj_tab[119] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_environment_pxi, __pyx_mstate->__pyx_n_u_set_bin_dir, __pyx_k_A_1_Y_NgUVVW, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[119])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 87, 37};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bin_dir_c, __pyx_mstate->__pyx_n_u_bin_dir};
    __pyx_mstate_global->__pyx_codeobj_tab[120] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_environment_pxi, __pyx_mstate->__pyx_n_u_get_bin_dir, __pyx_k_A_1_Yaq_Qiwaq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[120])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 96, 21};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_binary_name};
    __pyx_mstate_global->__pyx_codeobj_tab[121] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_environment_pxi, __pyx_mstate->__pyx_n_u_set_bin_name, __pyx_k_A_1D_G1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[121])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 105, 37};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bin_name_c, __pyx_mstate->__pyx_n_u_bin_name};
    __pyx_mstate_global->__pyx_codeobj_tab[122] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_environment_pxi, __pyx_mstate->__pyx_n_u_get_bin_name, __pyx_k_A_1D_3az_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[122])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[123] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[123])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[124] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[124])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 19, 77};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_exception, __pyx_mstate->__pyx_n_u_error, __pyx_mstate->__pyx_n_u_msg};
    __pyx_mstate_global->__pyx_codeobj_tab[125] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_errorhandler_pxi, __pyx_mstate->__pyx_n_u_display_error_message, __pyx_k_Q_1G1_r_AZxq_XQfA_q_fARvQ_har_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[125])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 38, 16};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exception};
    __pyx_mstate_global->__pyx_codeobj_tab[126] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_errorhandler_pxi, __pyx_mstate->__pyx_n_u_error, __pyx_k_A_Qa_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[126])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 45, 20};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exception};
    __pyx_mstate_global->__pyx_codeobj_tab[127] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_errorhandler_pxi, __pyx_mstate->__pyx_n_u_warning, __pyx_k_A_Qk_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[127])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 85};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[128] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_A_G1F_a_vWA_q_q_q_T_G1_T_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[128])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[129] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[129])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[130] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_exceptions_pxi, __pyx_mstate->__pyx_n_u_get_source_name, __pyx_k_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[130])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 22, 11};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[131] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_exceptions_pxi, __pyx_mstate->__pyx_n_u_get_line_number, __pyx_k_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[131])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 28, 11};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[132] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_exceptions_pxi, __pyx_mstate->__pyx_n_u_get_offset, __pyx_k_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[132])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 34, 11};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[133] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_exceptions_pxi, __pyx_mstate->__pyx_n_u_get_message, __pyx_k_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[133])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 85};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[134] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_A_G1F_a_vWA_q_q_q_d_7_WA_d_7_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[134])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[135] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[135])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[136] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[136])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[137] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[137])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 105, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[138] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_iterators_pxi, __pyx_mstate->__pyx_n_u_size, __pyx_k_A_s_4q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[138])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[139] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[139])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[140] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[140])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 173, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[141] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_iterators_pxi, __pyx_mstate->__pyx_n_u_size, __pyx_k_A_s_4q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[141])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[142] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[142])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[143] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[143])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 218, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[144] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_iterators_pxi, __pyx_mstate->__pyx_n_u_size, __pyx_k_A_s_4q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[144])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[145] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[145])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[146] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[146])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[147] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[147])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[148] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[148])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[149] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[149])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[150] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[150])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 37, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[151] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_value, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[151])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 45, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[152] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_astatus, __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[152])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 59, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[153] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_sstatus, __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[153])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 73, 56};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[154] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_exitcode, __pyx_k_A_F_4AT_z_XUYYz_K_K_L_L_M_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[154])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 82, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[155] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_message, __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[155])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 97, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[156] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_result, __pyx_k_A_6at6_4xW_J_J_K_K_L_1_1G7_1_Qaq_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[156])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 112, 24};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[157] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_drop, __pyx_k_A_F_4vZt1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[157])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 118, 24};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[158] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_restore, __pyx_k_A_F_Qd_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[158])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 124, 104};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[159] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_objective_pxi, __pyx_mstate->__pyx_n_u_minimization, __pyx_k_A_6at6_4xW_I_I_J_J_K_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[159])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[160] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[160])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[161] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[161])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 17, 19};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kind, __pyx_mstate->__pyx_n_u_msg};
    __pyx_mstate_global->__pyx_codeobj_tab[162] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_outputhandler_pxi, __pyx_mstate->__pyx_n_u_output, __pyx_k_A_Qe4t6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[162])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 85};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[163] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_A_G1F_a_vWA_q_q_q_d_7_WA_d_7_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[163])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[164] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[164])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 58, 35};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[165] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_parameter_pxi, __pyx_mstate->__pyx_n_u_is_symbolic, __pyx_k_A_F_31D_j_HTUUV_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[165])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 67, 35};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[166] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_parameter_pxi, __pyx_mstate->__pyx_n_u_has_default, __pyx_k_A_F_31D_j_HTUUV_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[166])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 108, 60};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_py_variant};
    __pyx_mstate_global->__pyx_codeobj_tab[167] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_parameter_pxi, __pyx_mstate->__pyx_n_u_value, __pyx_k_A_q_F_D_1_1_aq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[167])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 121, 298};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_index_c, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_index};
    __pyx_mstate_global->__pyx_codeobj_tab[168] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_parameter_pxi, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_s_6_S_3avS_D_z_4vZtS_aab_1G1_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[168])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 165, 322};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[169] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_parameter_pxi, __pyx_mstate->__pyx_n_u_set_values, __pyx_k_A_Qha_t1_q_F_D_q_AQ_q_QfA_uD_9Bl, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[169])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[170] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[170])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[171] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[171])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 53, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[172] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_instances, __pyx_k_A_vZq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[172])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 59, 37};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_arity};
    __pyx_mstate_global->__pyx_codeobj_tab[173] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_arity, __pyx_k_A_F_1D_j_HAQ_s_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[173])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 68, 47};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_df_c};
    __pyx_mstate_global->__pyx_codeobj_tab[174] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_get_values, __pyx_k_A_F_Qd_RVV_bbkkllm_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[174])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 76, 28};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[175] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_members, __pyx_k_A_fJd_iWX, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[175])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 82, 45};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_size};
    __pyx_mstate_global->__pyx_codeobj_tab[176] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_size, __pyx_k_A_F_2_4vZt8SWW_aab_s_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[176])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 90, 69};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_contains_c, __pyx_mstate->__pyx_n_u_t_c};
    __pyx_mstate_global->__pyx_codeobj_tab[177] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_Zq_2_4vZt8SYY____AQa_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[177])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 17, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 107, 430};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_df, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_members, __pyx_mstate->__pyx_n_u_dimen, __pyx_mstate->__pyx_n_u_cast_value, __pyx_mstate->__pyx_n_u_cast_value, __pyx_mstate->__pyx_n_u_cast_row, __pyx_mstate->__pyx_n_u_cast_row, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[178] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_set_pxi, __pyx_mstate->__pyx_n_u_set_values, __pyx_k_A_A_4t_Q_t_Qha_iq_a_AV_aq_q_A_fJ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[178])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[179] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[179])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[180] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[180])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 39, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[181] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_value, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[181])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 47, 74};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[182] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_fix, __pyx_k_6_A_7q_F_DPXX_at6_SWW__ccllm, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[182])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 60, 30};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[183] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_unfix, __pyx_k_A_F_5Qd_hVZZ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[183])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 66, 89};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[184] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_set_value, __pyx_k_A_QgQ_AT_zQUU_aajjoouuv_AT_zQUU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[184])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 79, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[185] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_astatus, __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[185])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 93, 56};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[186] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_defeqn, __pyx_k_A_F_4AT_z_XUYYz_I_I_J_J_K_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[186])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 102, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[187] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_dual, __pyx_k_A_F_7q_F_DPXX_J_J_K_K_L_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[187])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 110, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[188] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_init_2, __pyx_k_A_F_7q_F_DPXX_J_J_K_K_L_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[188])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 118, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[189] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_init0, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[189])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 127, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[190] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_lb, __pyx_k_A_F_7q_F_DPXX_H_H_I_I_J_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[190])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 135, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[191] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_ub, __pyx_k_A_F_7q_F_DPXX_H_H_I_I_J_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[191])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 143, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[192] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_lb0, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[192])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 151, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[193] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_ub0, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[193])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 159, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[194] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_lb1, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[194])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 167, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[195] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_ub1, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[195])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 175, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[196] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_lb2, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[196])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 183, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[197] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_ub2, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[197])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 191, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[198] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_lrc, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[198])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 199, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[199] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_urc, __pyx_k_A_F_7q_F_DPXX_I_I_J_J_K_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[199])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 207, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[200] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_lslack, __pyx_k_A_F_7q_F_DPXX_L_L_M_M_N_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[200])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 215, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[201] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_uslack, __pyx_k_A_F_7q_F_DPXX_L_L_M_M_N_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[201])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 223, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[202] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_rc, __pyx_k_A_F_7q_F_DPXX_H_H_I_I_J_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[202])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 231, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[203] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_slack, __pyx_k_A_F_7q_F_DPXX_K_K_L_L_M_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[203])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 240, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[204] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_sstatus, __pyx_k_A_6at6_4xW_K_K_L_L_M_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[204])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 254, 90};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[205] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_variable_pxi, __pyx_mstate->__pyx_n_u_status, __pyx_k_A_6at6_4xW_J_J_K_K_L_1_1G7_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[205])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[206] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[206])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[207] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[207])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 36, 134};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_lst, __pyx_mstate->__pyx_n_u_nested, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_index};
    __pyx_mstate_global->__pyx_codeobj_tab[208] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_nested_dict_of_suffixes, __pyx_k_Q_iq_4wa_81_E_xt2T_Qb_T_1Cq_r_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[208])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 179, 141};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_statements, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_statements_c, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[209] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_data, __pyx_k_AD_9F_3a_2Q_E_as_1_fAZq_at_3a_TU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[209])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 224, 34};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_name_c};
    __pyx_mstate_global->__pyx_codeobj_tab[210] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_entity, __pyx_k_A_F_4waq_WAV86, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[210])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 241, 97};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_entitytype, __pyx_mstate->__pyx_n_u_name_c};
    __pyx_mstate_global->__pyx_codeobj_tab[211] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_variable, __pyx_k_A_F_4waq_AT_81A_1_ha_q_wavXV1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[211])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 263, 97};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_entitytype, __pyx_mstate->__pyx_n_u_name_c};
    __pyx_mstate_global->__pyx_codeobj_tab[212] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_constraint, __pyx_k_A_F_4waq_AT_81A_1_ha_1_xvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[212])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 285, 97};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_entitytype, __pyx_mstate->__pyx_n_u_name_c};
    __pyx_mstate_global->__pyx_codeobj_tab[213] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_objective, __pyx_k_A_F_4waq_AT_81A_1_ha_0_q_hfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[213])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 307, 96};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_entitytype, __pyx_mstate->__pyx_n_u_name_c};
    __pyx_mstate_global->__pyx_codeobj_tab[214] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_set, __pyx_k_A_F_4waq_AT_81A_1_ha_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[214])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 329, 97};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_entitytype, __pyx_mstate->__pyx_n_u_name_c};
    __pyx_mstate_global->__pyx_codeobj_tab[215] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_parameter, __pyx_k_A_F_4waq_AT_81A_1_ha_0_q_hfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[215])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 351, 57};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_statements};
    __pyx_mstate_global->__pyx_codeobj_tab[216] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_eval, __pyx_k_A6_4z_E_a_F_AT_WAQ_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[216])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 383, 82};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_statements, __pyx_mstate->__pyx_n_u_output_c, __pyx_mstate->__pyx_n_u_output};
    __pyx_mstate_global->__pyx_codeobj_tab[217] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_output, __pyx_k_A_4z_E_a_F_j_TUUV_AXWAQ_Qaq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[217])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 404, 17};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[218] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_reset, __pyx_k_A_F_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[218])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 411, 46};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[219] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_k_A_4y_q_k_a_1AT_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[219])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 422, 26};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_isrunning};
    __pyx_mstate_global->__pyx_codeobj_tab[220] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_is_running, __pyx_k_A_F_j_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[220])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {5, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 430, 138};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_problem, __pyx_mstate->__pyx_n_u_solver, __pyx_mstate->__pyx_n_u_verbose, __pyx_mstate->__pyx_n_u_return_output, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_option_2, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_output};
    __pyx_mstate_global->__pyx_codeobj_tab[221] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_solve_2, __pyx_k_K_3Gq_HIV6_vYaq_Kq_4xs_wc_Kq_T, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[221])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 460, 95};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_workdir_c, __pyx_mstate->__pyx_n_u_workdir};
    __pyx_mstate_global->__pyx_codeobj_tab[222] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_cd, __pyx_k_a_5_1_XQd_AQ_Yat_T_1A_1_Qiwaq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[222])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 488, 153};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[223] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_set_option, __pyx_k_A_q_1_j_G1JVW_q_q_0_Zt7_UV_q_q_0, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[223])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 513, 105};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_exists, __pyx_mstate->__pyx_n_u_value_c, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[224] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_option, __pyx_k_A_Zt7_QhVWWX_1_waq_Qaq_1_s_1_5_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[224])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 546, 39};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename};
    __pyx_mstate_global->__pyx_codeobj_tab[225] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_read, __pyx_k_A_F_AT_3ay_q_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[225])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 562, 39};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename};
    __pyx_mstate_global->__pyx_codeobj_tab[226] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_read_data, __pyx_k_A_F_Zs_9G1A_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[226])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 579, 65};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_scalar_expression, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_py_variant};
    __pyx_mstate_global->__pyx_codeobj_tab[227] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_value, __pyx_k_A_q_J6GwazYZZ_1_1_aq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[227])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 605, 121};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_set_name, __pyx_mstate->__pyx_n_u_data_frame, __pyx_mstate->__pyx_n_u_data_c};
    __pyx_mstate_global->__pyx_codeobj_tab[228] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_set_data, __pyx_k_a_4z_s_d_AWBl_A_y_AQ_A_Jha_9Cq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[228])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 630, 116};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_set_name, __pyx_mstate->__pyx_n_u_data_frame, __pyx_mstate->__pyx_n_u_data_c};
    __pyx_mstate_global->__pyx_codeobj_tab[229] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_set_data_arrow, __pyx_k_A_4z_s_d_AWBl_A_q_1_81_9Cq_0_Zx, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[229])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 641, 25};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_table_name};
    __pyx_mstate_global->__pyx_codeobj_tab[230] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_read_table, __pyx_k_A_F_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[230])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 655, 26};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_table_name};
    __pyx_mstate_global->__pyx_codeobj_tab[231] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_write_table, __pyx_k_A_F_4z_7_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[231])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 669, 163};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ampl_expressions, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_exprs, __pyx_mstate->__pyx_n_u_size, __pyx_mstate->__pyx_n_u_array, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_display};
    __pyx_mstate_global->__pyx_codeobj_tab[232] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_display, __pyx_k_A_AS_a_1A_auBa_E_aq_vQe1BgQa_at, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[232])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 701, 33};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_output_handler};
    __pyx_mstate_global->__pyx_codeobj_tab[233] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_set_output_handler, __pyx_k_A_q_F_0_Zz_PQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[233])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 712, 80};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_error_handler, __pyx_mstate->__pyx_n_u_ErrorHandlerWrapper, __pyx_mstate->__pyx_n_u_error_handler_wrapper};
    __pyx_mstate_global->__pyx_codeobj_tab[234] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_set_error_handler, __pyx_k_A_31F_a_a_F_q_JiwdRS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[234])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 755, 29};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_output_handler};
    __pyx_mstate_global->__pyx_codeobj_tab[235] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_output_handler, __pyx_k_A_F_0_Zq_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[235])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 766, 13};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[236] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_error_handler, __pyx_k_A_T, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[236])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 775, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[237] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_variables, __pyx_k_A_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[237])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 781, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[238] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_constraints, __pyx_k_A_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[238])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 787, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[239] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_objectives, __pyx_k_A_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[239])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 793, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[240] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_sets, __pyx_k_A_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[240])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 799, 15};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[241] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_parameters, __pyx_k_A_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[241])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 805, 81};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_objname_c, __pyx_mstate->__pyx_n_u_objname};
    __pyx_mstate_global->__pyx_codeobj_tab[242] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_current_objective, __pyx_k_A_2_4z_1_Qiwaq_Qaq_83a_1_4_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[242])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 821, 38};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_Variables};
    __pyx_mstate_global->__pyx_codeobj_tab[243] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_var, __pyx_k_A_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[243])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 844, 38};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_Constraints};
    __pyx_mstate_global->__pyx_codeobj_tab[244] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_con, __pyx_k_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[244])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 867, 33};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_Objectives};
    __pyx_mstate_global->__pyx_codeobj_tab[245] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_obj, __pyx_k_A_z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[245])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 884, 38};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_Sets};
    __pyx_mstate_global->__pyx_codeobj_tab[246] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_set_2, __pyx_k_A_1_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[246])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 904, 38};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_Parameters};
    __pyx_mstate_global->__pyx_codeobj_tab[247] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_param, __pyx_k_A_z_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[247])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 927, 33};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_Options};
    __pyx_mstate_global->__pyx_codeobj_tab[248] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_option, __pyx_k_A_a_waq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[248])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 948, 65};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_options_dict, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[249] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_set_option_2, __pyx_k_A_F_vQ_z_4y_1F_U_1_Kq_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[249])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 963, 82};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_output_c, __pyx_mstate->__pyx_n_u_output};
    __pyx_mstate_global->__pyx_codeobj_tab[250] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_export_model, __pyx_k_A_q_JhgQjPSSVVYYZZ_1_AXWAQ_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[250])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 981, 82};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_output_c, __pyx_mstate->__pyx_n_u_output};
    __pyx_mstate_global->__pyx_codeobj_tab[251] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_export_data, __pyx_k_1_q_JhgQjPSSVVYYZZ_1_AXWAQ_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[251])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {5, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 999, 103};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_options_2, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_model_c, __pyx_mstate->__pyx_n_u_data_c, __pyx_mstate->__pyx_n_u_options_c, __pyx_mstate->__pyx_n_u_output_c, __pyx_mstate->__pyx_n_u_output};
    __pyx_mstate_global->__pyx_codeobj_tab[252] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_snapshot, __pyx_k_1_1_Q_q_JhgQjPYYaallmmn_1_AXWAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[252])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1026, 39};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_auxfiles};
    __pyx_mstate_global->__pyx_codeobj_tab[253] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_write, __pyx_k_q_F_Qd_HG1JhV, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[253])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1087, 103};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_flat, __pyx_mstate->__pyx_n_u_iis_var, __pyx_mstate->__pyx_n_u_iis_con};
    __pyx_mstate_global->__pyx_codeobj_tab[254] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_iis, __pyx_k_1_iq_Q_iq_Q_5_1_Qa_Qa_d_1_d_1_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[254])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1131, 67};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_flat, __pyx_mstate->__pyx_n_u_zeros, __pyx_mstate->__pyx_n_u_stmt, __pyx_mstate->__pyx_n_u_lst_solution};
    __pyx_mstate_global->__pyx_codeobj_tab[255] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_get_solution, __pyx_k_A_1_1_1_t9AU_a_1_4q_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[255])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1160, 77};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename};
    __pyx_mstate_global->__pyx_codeobj_tab[256] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_start_recording, __pyx_k_A_3aq_F_j8J_RYYZZ_F_AT_Na_F_AT_8, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[256])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1169, 22};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[257] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_stop_recording, __pyx_k_A_F_AT_81, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[257])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1175, 48};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_exp};
    __pyx_mstate_global->__pyx_codeobj_tab[258] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_load_session, __pyx_k_A_3aq_Qd_9E_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[258])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1185, 280};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_driver, __pyx_mstate->__pyx_n_u_options_2, __pyx_mstate->__pyx_n_u_export_gurobi_model, __pyx_mstate->__pyx_n_u_export_cplex_model, __pyx_mstate->__pyx_n_u_export_scip_model, __pyx_mstate->__pyx_n_u_export_copt_model, __pyx_mstate->__pyx_n_u_export_highs_model, __pyx_mstate->__pyx_n_u_export_xpress_model, __pyx_mstate->__pyx_n_u_solver_list};
    __pyx_mstate_global->__pyx_codeobj_tab[259] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_to_ampls, __pyx_k_q_7_Q_k_avQ_Cq_k_QfA_Cq_k_AV1_C, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[259])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {5, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1225, 158};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_number, __pyx_mstate->__pyx_n_u_import_entities, __pyx_mstate->__pyx_n_u_keep_files, __pyx_mstate->__pyx_n_u_shutil, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[260] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_import_ampls_solution, __pyx_k_22HHZZ_QgQ_Q_q_QgQ_wc_E_N_E_N_Z, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[260])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1247, 60};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_errorinfo, __pyx_mstate->__pyx_n_u_output_c, __pyx_mstate->__pyx_n_u_output};
    __pyx_mstate_global->__pyx_codeobj_tab[261] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_amplpy_ampl_pyx, __pyx_mstate->__pyx_n_u_to_string, __pyx_k_A_q_Jaq_1_AXWAQ_Qaq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[261])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[262] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[262])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[263] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[263])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 75};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[264] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_ErrorHandler, __pyx_k_hk_A_1_kkmmn_xq_7_a_nA_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[264])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 76};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[265] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_AMPLException, __pyx_k_hk_A_1_kkmmn_7_q0_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[265])) goto bad;
  }
  {
    __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 76};
    PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[266] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_OutputHandler, __pyx_k_hk_A_1_kkmmn_7_q0_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[266])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else

if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else

if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CachedMethodType.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
{
    PyObject *typesModule=NULL;
    typesModule = PyImport_ImportModule("types");
    if (typesModule) {
        __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
        Py_DECREF(typesModule);
    }
} // error handling follows
#endif

if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* decode_c_string */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject *const *args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
    PyObject *kwdefs;
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
        return NULL;
    }
    if (
            co->co_kwonlyargcount == 0 &&
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectFastCall */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    #if PY_VERSION_HEX < 0x030800B1
    #if CYTHON_FAST_PYCCALL
    if (PyCFunction_Check(func)) {
        if (kwargs) {
            return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
        } else {
            return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
        }
    }
    if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
        return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
    }
    #endif
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
    }
    #endif
    #endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
        vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
        if (f) {
            return f(func, args, _nargs, NULL);
        }
        #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
        if (__Pyx_CyFunction_CheckExact(func)) {
            __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
            if (f) return f(func, args, _nargs, NULL);
        }
        #elif CYTHON_COMPILING_IN_LIMITED_API && CYTHON_VECTORCALL
        return PyObject_Vectorcall(func, args, _nargs, NULL);
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* RaiseException */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if PY_VERSION_HEX >= 0x030C00A6
        PyException_SetTraceback(value, tb);
#elif CYTHON_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS && !CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_PyList_GetItemRef(o, n);
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* ModFloat[double] */
static CYTHON_INLINE double __Pyx_mod_double(double a, double b, int b_is_constant) {
    CYTHON_UNUSED_VAR(b_is_constant);
    double r = fmod(a, b);
    r += ((r != 0) & ((r < 0) ^ (b < 0))) * b;
    return r;
}

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind, kind_shift;
    Py_ssize_t i, char_pos;
    void *result_udata;
    if (max_char > 1114111) max_char = 1114111;
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_DATA(result_uval);
    assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
    if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0))
        goto overflow;
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = values[i];
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (__Pyx_PyUnicode_READY(uval) == (-1))
            goto bad;
        #endif
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(ulength < 0)) goto bad;
        #endif
        if (unlikely(!ulength))
            continue;
        if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (ukind == result_ukind) {
            memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
        } else {
            #if PY_VERSION_HEX >= 0x030d0000
            if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
            #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    Py_ssize_t i;
    PyObject *result = NULL;
    PyObject *value_tuple = PyTuple_New(value_count);
    if (unlikely(!value_tuple)) return NULL;
    CYTHON_UNUSED_VAR(max_char);
    CYTHON_UNUSED_VAR(result_ulength);
    for (i=0; i<value_count; i++) {
        if (__Pyx_PyTuple_SET_ITEM(value_tuple, i, values[i]) != (0)) goto bad;
        Py_INCREF(values[i]);
    }
    result = PyUnicode_Join(__pyx_mstate_global->__pyx_empty_unicode, value_tuple);
bad:
    Py_DECREF(value_tuple);
    return result;
#endif
}

/* TupleAndListFromArray */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < 0)) {
            Py_DECREF(res);
            return NULL;
        }
        Py_INCREF(src[i]);
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
    PyObject *key = NULL;
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
        key = __Pyx_PySequence_ITEM(kwds, 0);
    } else {
        Py_ssize_t pos = 0;
        if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
        PyDict_Next(kwds, &pos, &key, NULL);
        Py_INCREF(key);
    }
    if (likely(key)) {
        PyErr_Format(PyExc_TypeError,
            "%s() got an unexpected keyword argument '%U'",
            function_name, key);
        Py_DECREF(key);
    }
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
}

/* UnpackUnboundCMethod */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
        }
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *result = NULL;
        PyObject *args = PyTuple_New(2);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
        return result;
    }
#endif
    {
        PyObject *args[4] = {NULL, self, arg1, arg2};
        return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
    }
}

/* ParseKeywords */
static int __Pyx_ValidateDuplicatePosArgs(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char* function_name)
{
    PyObject ** const *name = argnames;
    while (name != first_kw_arg) {
        PyObject *key = **name;
        int found = PyDict_Contains(kwds, key);
        if (unlikely(found)) {
            if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
            goto bad;
        }
        name++;
    }
    return 0;
bad:
    return -1;
}
#if CYTHON_USE_UNICODE_INTERNALS
static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
    int kind;
    Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
    if (len != PyUnicode_GET_LENGTH(s2)) return 0;
    kind = PyUnicode_KIND(s1);
    if (kind != PyUnicode_KIND(s2)) return 0;
    const void *data1 = PyUnicode_DATA(s1);
    const void *data2 = PyUnicode_DATA(s2);
    return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
}
#endif
static int __Pyx_MatchKeywordArg_str(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    #if CYTHON_USE_UNICODE_INTERNALS
    Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
    if (unlikely(key_hash == -1)) {
        key_hash = PyObject_Hash(key);
        if (unlikely(key_hash == -1))
            goto bad;
    }
    #endif
    name = first_kw_arg;
    while (*name) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) {
                *index_found = (size_t) (name - argnames);
                return 1;
            }
        }
        #endif
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
            if (__Pyx_UnicodeKeywordsEqual(name_str, key))
                goto arg_passed_twice;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            if (unlikely(name_str == key)) goto arg_passed_twice;
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) goto arg_passed_twice;
        }
        #endif
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
bad:
    return -1;
}
static int __Pyx_MatchKeywordArg_nostr(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
    name = first_kw_arg;
    while (*name) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (cmp == 1) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        if (unlikely(cmp == -1)) goto bad;
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (unlikely(cmp != 0)) {
            if (cmp == 1) goto arg_passed_twice;
            else goto bad;
        }
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
bad:
    return -1;
}
static CYTHON_INLINE int __Pyx_MatchKeywordArg(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    return likely(PyUnicode_CheckExact(key)) ?
        __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
        __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
}
static void __Pyx_RejectUnknownKeyword(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char *function_name)
{
    Py_ssize_t pos = 0;
    PyObject *key = NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(kwds);
    while (PyDict_Next(kwds, &pos, &key, NULL)) {
        PyObject** const *name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (!*name) {
            #if CYTHON_AVOID_BORROWED_REFS
            Py_INCREF(key);
            #endif
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp != 1) {
                if (cmp == 0) {
                    PyErr_Format(PyExc_TypeError,
                        "%s() got an unexpected keyword argument '%U'",
                        function_name, key);
                }
                #if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(key);
                #endif
                break;
            }
            #if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(key);
            #endif
        }
    }
    __Pyx_END_CRITICAL_SECTION();
    assert(PyErr_Occurred());
}
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t extracted = 0;
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
    name = first_kw_arg;
    while (*name && num_kwargs > extracted) {
        PyObject * key = **name;
        PyObject *value;
        int found = 0;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        found = PyDict_GetItemRef(kwds, key, &value);
        #else
        value = PyDict_GetItemWithError(kwds, key);
        if (value) {
            Py_INCREF(value);
            found = 1;
        } else {
            if (unlikely(PyErr_Occurred())) goto bad;
        }
        #endif
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            extracted++;
        }
        name++;
    }
    if (num_kwargs > extracted) {
        if (ignore_unknown_kwargs) {
            if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
                goto bad;
        } else {
            __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
            goto bad;
        }
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t len;
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
    if (PyDict_Update(kwds2, kwds) < 0) goto bad;
    name = first_kw_arg;
    while (*name) {
        PyObject *key = **name;
        PyObject *value;
#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
        int found = PyDict_Pop(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
        }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        int found = PyDict_GetItemRef(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
        }
#else
    #if CYTHON_COMPILING_IN_CPYTHON
        value = _PyDict_Pop(kwds2, key, kwds2);
    #else
        value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
    #endif
        if (value == kwds2) {
            Py_DECREF(value);
        } else {
            if (unlikely(!value)) goto bad;
            values[name-argnames] = value;
        }
#endif
        name++;
    }
    len = PyDict_Size(kwds2);
    if (len > 0) {
        return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
    } else if (unlikely(len == -1)) {
        goto bad;
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject *key = NULL;
    PyObject** const * name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
#if CYTHON_AVOID_BORROWED_REFS
        key = __Pyx_PySequence_ITEM(kwds, pos);
#else
        key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
#endif
#if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!key)) goto bad;
#endif
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            PyObject *value = kwvalues[pos];
            values[name-argnames] = __Pyx_NewRef(value);
        } else {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp == 1) {
                PyObject *value = kwvalues[pos];
                values[index_found] = __Pyx_NewRef(value);
            } else {
                if (unlikely(cmp == -1)) goto bad;
                if (kwds2) {
                    PyObject *value = kwvalues[pos];
                    if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                } else if (!ignore_unknown_kwargs) {
                    goto invalid_keyword;
                }
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        key = NULL;
        #endif
    }
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    goto bad;
bad:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(key);
    #endif
    return -1;
}
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* PyObjectCallOneArg */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* pybytes_as_double */
static double __Pyx_SlowPyString_AsDouble(PyObject *obj) {
    PyObject *float_value = PyFloat_FromString(obj);
    if (likely(float_value)) {
        double value = __Pyx_PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
    return (double)-1;
}
static const char* __Pyx__PyBytes_AsDouble_Copy(const char* start, char* buffer, Py_ssize_t length) {
    int last_was_punctuation = 1;
    int parse_error_found = 0;
    Py_ssize_t i;
    for (i=0; i < length; i++) {
        char chr = start[i];
        int is_punctuation = (chr == '_') | (chr == '.') | (chr == 'e') | (chr == 'E');
        *buffer = chr;
        buffer += (chr != '_');
        parse_error_found |= last_was_punctuation & is_punctuation;
        last_was_punctuation = is_punctuation;
    }
    parse_error_found |= last_was_punctuation;
    *buffer = '\0';
    return unlikely(parse_error_found) ? NULL : buffer;
}
static double __Pyx__PyBytes_AsDouble_inf_nan(const char* start, Py_ssize_t length) {
    int matches = 1;
    char sign = start[0];
    int is_signed = (sign == '+') | (sign == '-');
    start += is_signed;
    length -= is_signed;
    switch (start[0]) {
        #ifdef Py_NAN
        case 'n':
        case 'N':
            if (unlikely(length != 3)) goto parse_failure;
            matches &= (start[1] == 'a' || start[1] == 'A');
            matches &= (start[2] == 'n' || start[2] == 'N');
            if (unlikely(!matches)) goto parse_failure;
            return (sign == '-') ? -Py_NAN : Py_NAN;
        #endif
        case 'i':
        case 'I':
            if (unlikely(length < 3)) goto parse_failure;
            matches &= (start[1] == 'n' || start[1] == 'N');
            matches &= (start[2] == 'f' || start[2] == 'F');
            if (likely(length == 3 && matches))
                return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
            if (unlikely(length != 8)) goto parse_failure;
            matches &= (start[3] == 'i' || start[3] == 'I');
            matches &= (start[4] == 'n' || start[4] == 'N');
            matches &= (start[5] == 'i' || start[5] == 'I');
            matches &= (start[6] == 't' || start[6] == 'T');
            matches &= (start[7] == 'y' || start[7] == 'Y');
            if (unlikely(!matches)) goto parse_failure;
            return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
        case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
            break;
        default:
            goto parse_failure;
    }
    return 0.0;
parse_failure:
    return -1.0;
}
static CYTHON_INLINE int __Pyx__PyBytes_AsDouble_IsSpace(char ch) {
    return (ch == 0x20) | !((ch < 0x9) | (ch > 0xd));
}
CYTHON_UNUSED static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length) {
    double value;
    Py_ssize_t i, digits;
    const char *last = start + length;
    char *end;
    while (__Pyx__PyBytes_AsDouble_IsSpace(*start))
        start++;
    while (start < last - 1 && __Pyx__PyBytes_AsDouble_IsSpace(last[-1]))
        last--;
    length = last - start;
    if (unlikely(length <= 0)) goto fallback;
    value = __Pyx__PyBytes_AsDouble_inf_nan(start, length);
    if (unlikely(value == -1.0)) goto fallback;
    if (value != 0.0) return value;
    digits = 0;
    for (i=0; i < length; digits += start[i++] != '_');
    if (likely(digits == length)) {
        value = PyOS_string_to_double(start, &end, NULL);
    } else if (digits < 40) {
        char number[40];
        last = __Pyx__PyBytes_AsDouble_Copy(start, number, length);
        if (unlikely(!last)) goto fallback;
        value = PyOS_string_to_double(number, &end, NULL);
    } else {
        char *number = (char*) PyMem_Malloc((digits + 1) * sizeof(char));
        if (unlikely(!number)) goto fallback;
        last = __Pyx__PyBytes_AsDouble_Copy(start, number, length);
        if (unlikely(!last)) {
            PyMem_Free(number);
            goto fallback;
        }
        value = PyOS_string_to_double(number, &end, NULL);
        PyMem_Free(number);
    }
    if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) {
        return value;
    }
fallback:
    return __Pyx_SlowPyString_AsDouble(obj);
}

/* pyobject_as_double */
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    if (PyUnicode_CheckExact(obj)) {
        return __Pyx_PyUnicode_AsDouble(obj);
    } else if (PyBytes_CheckExact(obj)) {
        return __Pyx_PyBytes_AsDouble(obj);
    } else if (PyByteArray_CheckExact(obj)) {
        return __Pyx_PyByteArray_AsDouble(obj);
    } else {
        PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS
        float_value = PyNumber_Float(obj);  if ((0)) goto bad;
        (void)__Pyx_PyObject_CallOneArg;
#else
        PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
        if (likely(nb) && likely(nb->nb_float)) {
            float_value = nb->nb_float(obj);
            if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
                __Pyx_TypeName float_value_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(float_value));
                PyErr_Format(PyExc_TypeError,
                    "__float__ returned non-float (type " __Pyx_FMT_TYPENAME ")",
                    float_value_type_name);
                __Pyx_DECREF_TypeName(float_value_type_name);
                Py_DECREF(float_value);
                goto bad;
            }
        } else {
            float_value = __Pyx_PyObject_CallOneArg((PyObject*)&PyFloat_Type, obj);
        }
#endif
        if (likely(float_value)) {
            double value = __Pyx_PyFloat_AS_DOUBLE(float_value);
            Py_DECREF(float_value);
            return value;
        }
    }
bad:
    return (double)-1;
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError,
            "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
        __Pyx_DECREF_TypeName(index_type_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
    __Pyx_TypeName obj_type_name;
    if (likely(PyType_Check(obj))) {
        PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
    PyTypeObject *tp = Py_TYPE(obj);
    PyMappingMethods *mm = tp->tp_as_mapping;
    PySequenceMethods *sm = tp->tp_as_sequence;
    if (likely(mm && mm->mp_subscript)) {
        return mm->mp_subscript(obj, key);
    }
    if (likely(sm && sm->sq_item)) {
        return __Pyx_PyObject_GetIndex(obj, key);
    }
    return __Pyx_PyObject_GetItem_Slow(obj, key);
}
#endif

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    Py_INCREF(key);
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* RaiseUnboundLocalError */
static void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* RaiseClosureNameError */
static void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
      #endif
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc, *new_exc;
    __Pyx_PyThreadState_declare
    int is_async_stopiteration = 0;
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    __Pyx_PyThreadState_assign
    cur_exc = __Pyx_PyErr_CurrentExceptionType();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else {
            return;
        }
    }
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(tb);
    new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        "generator raised StopIteration");
    if (!new_exc) {
        Py_XDECREF(val);
        return;
    }
    PyException_SetCause(new_exc, val); // steals ref to val
    PyErr_SetObject(PyExc_RuntimeError, new_exc);
}

/* FixUpExtensionType */
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
#else
    const PyType_Slot *slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
        int changed = 0;
#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
        const
#endif
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
#if PY_VERSION_HEX < 0x030900b1
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
#if PY_VERSION_HEX >= 0x030800b4
                    type->tp_vectorcall_offset = memb->offset;
#else
                    type->tp_print = (printfunc) memb->offset;
#endif
                    changed = 1;
                }
#endif
#else
                if ((0));
#endif
#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
                        Py_DECREF(descr);
                        return -1;
                    }
                    Py_DECREF(descr);
                    changed = 1;
                }
#endif
            }
            memb++;
        }
        if (changed)
            PyType_Modified(type);
    }
#endif
    return 0;
}

/* FetchSharedCythonModule */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* dict_setdefault */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value,
                                                       int is_safe_type) {
    PyObject* value;
    CYTHON_MAYBE_UNUSED_VAR(is_safe_type);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethod(d, "setdefault", "OO", key, default_value);
#elif PY_VERSION_HEX >= 0x030d0000
    PyDict_SetDefaultRef(d, key, default_value, &value);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* FetchCommonType */
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t expected_basicsize) {
    Py_ssize_t basicsize;
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
    if (unlikely(!py_basicsize)) return -1;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = NULL;
    if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
#else
    basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
#endif
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
    int get_item_ref_result;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    py_object_name = PyUnicode_FromString(object_name);
    if (!py_object_name) return NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) goto done;
    abi_module_dict = PyModule_GetDict(abi_module);
    if (!abi_module_dict) goto done;
    get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
    if (get_item_ref_result == 1) {
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else if (unlikely(get_item_ref_result == -1)) {
        goto bad;
    }
    CYTHON_UNUSED_VAR(module);
    cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type, 1);
    if (unlikely(new_cached_type != cached_type)) {
        if (unlikely(!new_cached_type)) goto bad;
        Py_DECREF(cached_type);
        cached_type = new_cached_type;
        if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else {
        Py_DECREF(new_cached_type);
    }
done:
    Py_XDECREF(abi_module);
    Py_DECREF(py_object_name);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CallTypeTraverse */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
    if (__Pyx_get_runtime_version() < 0x03090000) return 0;
    #endif
    if (!always_call) {
        PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
        unsigned long flags = PyType_GetFlags(base);
        if (flags & Py_TPFLAGS_HEAPTYPE) {
            return 0;
        }
    }
    Py_VISIT((PyObject*)Py_TYPE(o));
    return 0;
}
#endif

/* PyMethodNew */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    PyObject *result;
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    {
        PyObject *args[] = {func, self};
        result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
    }
    #else
    result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
    #endif
    return result;
}
#else
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
    CYTHON_UNUSED_VAR(typ);
    if (!self)
        return __Pyx_NewRef(func);
    return PyMethod_New(func, self);
}
#endif

/* PyVectorcallFastCallDict */
#if CYTHON_METH_FASTCALL && (CYTHON_VECTORCALL || CYTHON_BACKPORT_VECTORCALL)
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    PyObject *res = NULL;
    PyObject *kwnames;
    PyObject **newargs;
    PyObject **kwvalues;
    Py_ssize_t i, pos;
    size_t j;
    PyObject *key, *value;
    unsigned long keys_are_strings;
    #if !CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t nkw = PyDict_Size(kw);
    if (unlikely(nkw == -1)) return NULL;
    #else
    Py_ssize_t nkw = PyDict_GET_SIZE(kw);
    #endif
    newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
    if (unlikely(newargs == NULL)) {
        PyErr_NoMemory();
        return NULL;
    }
    for (j = 0; j < nargs; j++) newargs[j] = args[j];
    kwnames = PyTuple_New(nkw);
    if (unlikely(kwnames == NULL)) {
        PyMem_Free(newargs);
        return NULL;
    }
    kwvalues = newargs + nargs;
    pos = i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (PyDict_Next(kw, &pos, &key, &value)) {
        keys_are_strings &=
        #if CYTHON_COMPILING_IN_LIMITED_API
            PyType_GetFlags(Py_TYPE(key));
        #else
            Py_TYPE(key)->tp_flags;
        #endif
        Py_INCREF(key);
        Py_INCREF(value);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
        #else
        PyTuple_SET_ITEM(kwnames, i, key);
        #endif
        kwvalues[i] = value;
        i++;
    }
    if (unlikely(!keys_are_strings)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        goto cleanup;
    }
    res = vc(func, newargs, nargs, kwnames);
cleanup:
    Py_DECREF(kwnames);
    for (i = 0; i < nkw; i++)
        Py_DECREF(kwvalues[i]);
    PyMem_Free(newargs);
    return res;
}
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
{
    Py_ssize_t kw_size =
        likely(kw == NULL) ?
        0 :
#if !CYTHON_ASSUME_SAFE_SIZE
        PyDict_Size(kw);
#else
        PyDict_GET_SIZE(kw);
#endif
    if (kw_size == 0) {
        return vc(func, args, nargs, NULL);
    }
#if !CYTHON_ASSUME_SAFE_SIZE
    else if (unlikely(kw_size == -1)) {
        return NULL;
    }
#endif
    return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
}
#endif

/* CythonFunctionShared */
#if CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
    if (__Pyx_CyFunction_Check(func)) {
        return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
    } else if (PyCFunction_Check(func)) {
        return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
        int result;
        PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
        if (unlikely(!newFunc)) {
            PyErr_Clear(); // It's only an optimization, so don't throw an error
            return 0;
        }
        result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
        Py_DECREF(newFunc);
        return result;
    }
    return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
}
#else
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
    if (PyMethod_Check(func)) {
        func = PyMethod_GET_FUNCTION(func);
    }
    return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
}
#endif
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    __Pyx_Py_XDECREF_SET(
        __Pyx_CyFunction_GetClassObj(f),
            ((classobj) ? __Pyx_NewRef(classobj) : NULL));
#else
    __Pyx_Py_XDECREF_SET(
        ((PyCMethodObject *) (f))->mm_class,
        (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
#endif
}
static PyObject *
__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_doc == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
        if (unlikely(!op->func_doc)) return NULL;
#else
        if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
            op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
#endif
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
    PyObject *result;
    CYTHON_UNUSED_VAR(closure);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_doc_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_doc, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if CYTHON_COMPILING_IN_LIMITED_API
        op->func_name = PyObject_GetAttrString(op->func, "__name__");
#else
        op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_name_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_name, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    Py_INCREF(op->func_qualname);
    result = op->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_qualname, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_dict_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_dict_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_dict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result = NULL;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_defaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
    PyObject* result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_kwdefaults_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value || value == Py_None) {
        value = NULL;
    } else if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_annotations, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_annotations_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
    int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
    if (is_coroutine) {
        PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
        fromlist = PyList_New(1);
        if (unlikely(!fromlist)) return NULL;
        Py_INCREF(marker);
#if CYTHON_ASSUME_SAFE_MACROS
        PyList_SET_ITEM(fromlist, 0, marker);
#else
        if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
            Py_DECREF(marker);
            Py_DECREF(fromlist);
            return NULL;
        }
#endif
        module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
        if (unlikely(!module)) goto ignore;
        is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
        Py_DECREF(module);
        if (likely(is_coroutine_value)) {
            return is_coroutine_value;
        }
ignore:
        PyErr_Clear();
    }
    return __Pyx_PyBool_FromLong(is_coroutine);
}
static PyObject *
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    if (op->func_is_coroutine) {
        return __Pyx_NewRef(op->func_is_coroutine);
    }
    result = __Pyx_CyFunction_get_is_coroutine_value(op);
    if (unlikely(!result))
        return NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    if (op->func_is_coroutine) {
        Py_DECREF(result);
        result = __Pyx_NewRef(op->func_is_coroutine);
    } else {
        op->func_is_coroutine = __Pyx_NewRef(result);
    }
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        py_name, message, size);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
        name, message, size);
#endif
}
static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
    if (!py_name) return;
    PyErr_Format(PyExc_TypeError,
        "%.200S() %s",
        py_name, message);
    Py_DECREF(py_name);
#else
    const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
    PyErr_Format(PyExc_TypeError,
        "%.200s() %s",
        name, message);
#endif
}
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_GetAttrString(op->func, "__module__");
}
static int
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    return PyObject_SetAttrString(op->func, "__module__", value);
}
#endif
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
#if !CYTHON_COMPILING_IN_LIMITED_API
    {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
#endif
    {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#if CYTHON_METH_FASTCALL
#if CYTHON_BACKPORT_VECTORCALL || CYTHON_COMPILING_IN_LIMITED_API
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
#else
    {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
#else
    {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
#endif
#endif
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
{
    PyObject *result = NULL;
    CYTHON_UNUSED_VAR(args);
    __Pyx_BEGIN_CRITICAL_SECTION(m);
    Py_INCREF(m->func_qualname);
    result = m->func_qualname;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyCFunctionObject *cf = (PyCFunctionObject*) op;
#endif
    if (unlikely(op == NULL))
        return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
    if (unlikely(!op->func)) return NULL;
#endif
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
#if !CYTHON_COMPILING_IN_LIMITED_API
    cf->m_ml = ml;
    cf->m_self = (PyObject *) op;
#endif
    Py_XINCREF(closure);
    op->func_closure = closure;
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_XINCREF(module);
    cf->m_module = module;
#endif
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
#if PY_VERSION_HEX < 0x030900B1
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    Py_CLEAR(m->defaults);
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    __Pyx_PyHeapTypeObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    {
        int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(m->func);
#else
    Py_VISIT(((PyCFunctionObject*)m)->m_module);
#endif
    Py_VISIT(m->func_dict);
    __Pyx_VISIT_CONST(m->func_name);
    __Pyx_VISIT_CONST(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    __Pyx_VISIT_CONST(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
#endif
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_is_coroutine);
    Py_VISIT(m->defaults);
    return 0;
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
    PyObject *repr;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
    __Pyx_END_CRITICAL_SECTION();
    return repr;
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
    PyCFunction meth;
    int flags;
    meth = PyCFunction_GetFunction(f);
    if (unlikely(!meth)) return NULL;
    flags = PyCFunction_GetFlags(f);
    if (unlikely(flags < 0)) return NULL;
#else
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    int flags = f->m_ml->ml_flags;
#endif
    Py_ssize_t size;
    switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 0))
                return (*meth)(self, NULL);
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes no arguments", size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
#if CYTHON_ASSUME_SAFE_SIZE
            size = PyTuple_GET_SIZE(arg);
#else
            size = PyTuple_Size(arg);
            if (unlikely(size < 0)) return NULL;
#endif
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            __Pyx_CyFunction_raise_argument_count_error(
                (__pyx_CyFunctionObject*)func,
                "takes exactly one argument", size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        return NULL;
    }
    __Pyx_CyFunction_raise_type_error(
        (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *self, *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
    if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
    self = ((PyCFunctionObject*)func)->m_self;
#endif
    result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
    return result;
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
#if CYTHON_METH_FASTCALL && (CYTHON_VECTORCALL || CYTHON_BACKPORT_VECTORCALL)
     __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
    if (vc) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
        return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
#else
        (void) &__Pyx_PyVectorcall_FastCallDict;
        return PyVectorcall_Call(func, args, kw);
#endif
    }
#endif
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
#if CYTHON_ASSUME_SAFE_SIZE
        argc = PyTuple_GET_SIZE(args);
#else
        argc = PyTuple_Size(args);
        if (unlikely(argc < 0)) return NULL;
#endif
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
#if CYTHON_METH_FASTCALL && (CYTHON_VECTORCALL || CYTHON_BACKPORT_VECTORCALL)
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
{
    int ret = 0;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        if (unlikely(nargs < 1)) {
            __Pyx_CyFunction_raise_type_error(
                cyfunc, "needs an argument");
            return -1;
        }
        ret = 1;
    }
    if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
        __Pyx_CyFunction_raise_type_error(
            cyfunc, "takes no keyword arguments");
        return -1;
    }
    return ret;
}
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 0)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes no arguments", nargs);
        return NULL;
    }
    return meth(self, NULL);
}
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    if (unlikely(nargs != 1)) {
        __Pyx_CyFunction_raise_argument_count_error(
            cyfunc, "takes exactly one argument", nargs);
        return NULL;
    }
    return meth(self, args[0]);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
{
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
    PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    PyObject *self;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
    if (unlikely(!meth)) return NULL;
#else
    PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
#endif
    switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
    case 1:
        self = args[0];
        args += 1;
        nargs -= 1;
        break;
    case 0:
#if CYTHON_COMPILING_IN_LIMITED_API
        self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
        if (unlikely(!self) && PyErr_Occurred()) return NULL;
#else
        self = ((PyCFunctionObject*)cyfunc)->m_self;
#endif
        break;
    default:
        return NULL;
    }
    return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, (size_t)nargs, kwnames);
}
#endif
static PyType_Slot __pyx_CyFunctionType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
    {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
    {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
    {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
    {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
    {Py_tp_methods, (void *)__pyx_CyFunction_methods},
    {Py_tp_members, (void *)__pyx_CyFunction_members},
    {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
    {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
    {0, 0},
};
static PyType_Spec __pyx_CyFunctionType_spec = {
    __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
    Py_TPFLAGS_METHOD_DESCRIPTOR |
#endif
#if CYTHON_METH_FASTCALL
#if defined(Py_TPFLAGS_HAVE_VECTORCALL)
    Py_TPFLAGS_HAVE_VECTORCALL |
#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
    _Py_TPFLAGS_HAVE_VECTORCALL |
#endif
#endif // CYTHON_METH_FASTCALL
#if PY_VERSION_HEX >= 0x030A0000
    Py_TPFLAGS_IMMUTABLETYPE |
#endif
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
    __pyx_CyFunctionType_slots
};
static int __pyx_CyFunction_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
    if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
    if (unlikely(!m->defaults))
        return NULL;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyObjectCallNoArg */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else {
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t);
 #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(size < 0)) return;
 #endif
      if (size < index) {
        __Pyx_RaiseNeedMoreValuesError(size);
      } else {
        __Pyx_RaiseTooManyValuesError(index);
      }
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
        PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) {
    if (likely(is_tuple || PyTuple_Check(tuple))) {
        Py_ssize_t size;
        if (has_known_size) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        size = __Pyx_PyTuple_GET_SIZE(tuple);
        if (likely(size == 2)) {
            return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
        }
        if (size >= 0) {
            __Pyx_UnpackTupleError(tuple, 2);
        }
        return -1;
    } else {
        return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple);
    }
}
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
    value1 = __Pyx_PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = __Pyx_PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = __Pyx_PyObject_GetIterNextFunc(iter);
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
#if CYTHON_COMPILING_IN_PYPY
#include <string.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#else
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem) {
    PyObject *key, *value;
    if (unlikely(orig_length != PyDict_Size(iter_obj))) {
        PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
        return -1;
    }
    if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
        return 0;
    }
    if (pitem) {
        PyObject* tuple = PyTuple_New(2);
        if (unlikely(!tuple)) {
            return -1;
        }
        Py_INCREF(key);
        Py_INCREF(value);
        #if CYTHON_ASSUME_SAFE_MACROS
        PyTuple_SET_ITEM(tuple, 0, key);
        PyTuple_SET_ITEM(tuple, 1, value);
        #else
        if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) {
            Py_DECREF(value);
            Py_DECREF(tuple);
            return -1;
        }
        if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) {
            Py_DECREF(tuple);
            return -1;
        }
        #endif
        *pitem = tuple;
    } else {
        if (pkey) {
            Py_INCREF(key);
            *pkey = key;
        }
        if (pvalue) {
            Py_INCREF(value);
            *pvalue = value;
        }
    }
    return 1;
}
#endif
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        int result;
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_BEGIN_CRITICAL_SECTION(iter_obj);
#endif
        result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem);
#if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_END_CRITICAL_SECTION();
#endif
        return result;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(tuple_size < 0)) return -1;
        #endif
        if (unlikely(pos >= tuple_size)) return 0;
        *ppos = pos + 1;
        #if CYTHON_ASSUME_SAFE_MACROS
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        #else
        next_item = PyTuple_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #endif
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(list_size < 0)) return -1;
        #endif
        if (unlikely(pos >= list_size)) return 0;
        *ppos = pos + 1;
        #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
        next_item = PyList_GetItemRef(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #elif CYTHON_ASSUME_SAFE_MACROS
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
        #else
        next_item = PyList_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        Py_INCREF(next_item);
        #endif
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 1;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) == 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 0;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 0;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal == 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a == (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyLong_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyLong_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return NULL;
}

/* PyObjectVectorCallMethodKwBuilder */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) {
    PyObject *result;
    PyObject *obj = PyObject_GetAttr(args[0], name);
    if (unlikely(!obj))
        return NULL;
    result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames);
    Py_DECREF(obj);
    return result;
}
#endif

/* CIntToDigits */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    if (likely(ulength <= 250)) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) (ulength - 1));
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= ulength;
        memset(cpos, padding_char, (size_t) (ulength - 1));
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, ulength - 1);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'c') {
        if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                     !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
            PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
            return NULL;
        }
        if (width <= 1) {
            return PyUnicode_FromOrdinal((int) value);
        }
        return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
    }
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a, x;
#ifdef HAVE_LONG_LONG
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla, llx;
#endif
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    if (likely(__Pyx_PyLong_IsCompact(op1))) {
        a = __Pyx_PyLong_CompactValue(op1);
    } else {
        const digit* digits = __Pyx_PyLong_Digits(op1);
        const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
        switch (size) {
            case -2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case -3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case -4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
        }
    }
            x = a + b;
        return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
    long_long:
            llx = lla + llb;
        return PyLong_FromLongLong(llx);
#endif
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
    
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!j)) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            Py_INCREF(v);
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
            PyList_SetItem(o, n, v);
#else
            PyObject* old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
#endif
            return 1;
        }
    } else {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o))
    {
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* PyLongCompare */
static CYTHON_INLINE PyObject* __Pyx_PyLong_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            if (__Pyx_PyLong_IsZero(op1) == 1) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                Py_RETURN_FALSE;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    const char* function_name,
    PyObject *kw)
{
#if CYTHON_COMPILING_IN_PYPY
    CYTHON_UNUSED_VAR(function_name);
    CYTHON_UNUSED_VAR(kw);
    return 0;
#else
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
#if PY_VERSION_HEX >= 0x03090000
        CYTHON_UNUSED_VAR(function_name);
#else
        Py_ssize_t kwsize;
        #if CYTHON_ASSUME_SAFE_SIZE
        kwsize = PyTuple_GET_SIZE(kw);
        #else
        kwsize = PyTuple_Size(kw);
        if (unlikely(kwsize < 0)) return -1;
        #endif
        for (Py_ssize_t pos = 0; pos < kwsize; pos++) {
            PyObject* key = NULL;
            #if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, pos);
            #else
            key = PyTuple_GetItem(kw, pos);
            if (unlikely(!key)) return -1;
            #endif
            if (unlikely(!PyUnicode_Check(key))) {
                PyErr_Format(PyExc_TypeError,
                    "%.200s() keywords must be strings", function_name);
                return -1;
            }
        }
#endif
    } else {
        if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1;
    }
    return 0;
#endif
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    __Pyx_TypeName obj_type_name;
    __Pyx_TypeName type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    PyErr_Format(PyExc_TypeError,
                 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
                 obj_type_name, type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
}

/* GetAttr3 */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    int res = PyObject_GetOptionalAttr(o, n, &r);
    return (res != 0) ? r : __Pyx_NewRef(d);
#else
  #if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n))) {
        r = __Pyx_PyObject_GetAttrStrNoError(o, n);
        if (unlikely(!r) && likely(!PyErr_Occurred())) {
            r = __Pyx_NewRef(d);
        }
        return r;
    }
  #endif
    r = PyObject_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
#endif
}

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* UnicodeConcatInPlace */
# if CYTHON_COMPILING_IN_CPYTHON
static int
__Pyx_unicode_modifiable(PyObject *unicode)
{
    if (Py_REFCNT(unicode) != 1)
        return 0;
    if (!PyUnicode_CheckExact(unicode))
        return 0;
    if (PyUnicode_CHECK_INTERNED(unicode))
        return 0;
    return 1;
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    ) {
    PyObject *left = *p_left;
    Py_ssize_t left_len, right_len, new_len;
    if (unlikely(__Pyx_PyUnicode_READY(left) == -1))
        return NULL;
    if (unlikely(__Pyx_PyUnicode_READY(right) == -1))
        return NULL;
    left_len = PyUnicode_GET_LENGTH(left);
    if (left_len == 0) {
        Py_INCREF(right);
        return right;
    }
    right_len = PyUnicode_GET_LENGTH(right);
    if (right_len == 0) {
        Py_INCREF(left);
        return left;
    }
    if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) {
        PyErr_SetString(PyExc_OverflowError,
                        "strings are too large to concat");
        return NULL;
    }
    new_len = left_len + right_len;
    if (__Pyx_unicode_modifiable(left)
            && PyUnicode_CheckExact(right)
            && PyUnicode_KIND(right) <= PyUnicode_KIND(left)
            && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) {
        int ret;
        __Pyx_GIVEREF(*p_left);
        ret = PyUnicode_Resize(p_left, new_len);
        __Pyx_GOTREF(*p_left);
        if (unlikely(ret != 0))
            return NULL;
        #if PY_VERSION_HEX >= 0x030d0000
        if (unlikely(PyUnicode_CopyCharacters(*p_left, left_len, right, 0, right_len) < 0)) return NULL;
        #else
        _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
        #endif
        __Pyx_INCREF(*p_left);
        __Pyx_GIVEREF(*p_left);
        return *p_left;
    } else {
        return __Pyx_PyUnicode_Concat(left, right);
    }
  }
#endif

/* pynumber_float */
static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj) {
    double val;
    if (PyLong_CheckExact(obj)) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (likely(__Pyx_PyLong_IsCompact(obj))) {
            val = (double) __Pyx_PyLong_CompactValue(obj);
            goto no_error;
        }
#endif
        val = PyLong_AsDouble(obj);
    } else if (PyUnicode_CheckExact(obj)) {
        val = __Pyx_PyUnicode_AsDouble(obj);
    } else if (PyBytes_CheckExact(obj)) {
        val = __Pyx_PyBytes_AsDouble(obj);
    } else if (PyByteArray_CheckExact(obj)) {
        val = __Pyx_PyByteArray_AsDouble(obj);
    } else {
        return PyNumber_Float(obj);
    }
    if (unlikely(val == -1 && PyErr_Occurred())) {
        return NULL;
    }
#if CYTHON_USE_PYLONG_INTERNALS
no_error:
#endif
    return PyFloat_FromDouble(val);
}

/* DictGetItem */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
        if (unlikely(PyTuple_Check(key))) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args)) {
                PyErr_SetObject(PyExc_KeyError, args);
                Py_DECREF(args);
            }
        } else {
            PyErr_SetObject(PyExc_KeyError, key);
        }
    }
    return value;
}
#endif

/* unicode_tailmatch */
static int __Pyx_PyUnicode_TailmatchTuple(PyObject* s, PyObject* substrings,
                                          Py_ssize_t start, Py_ssize_t end, int direction) {
    Py_ssize_t i, count = __Pyx_PyTuple_GET_SIZE(substrings);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(count < 0)) return -1;
    #endif
    for (i = 0; i < count; i++) {
        Py_ssize_t result;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substrings, i),
                                     start, end, direction);
#else
        PyObject* sub = __Pyx_PySequence_ITEM(substrings, i);
        if (unlikely(!sub)) return -1;
        result = PyUnicode_Tailmatch(s, sub, start, end, direction);
        Py_DECREF(sub);
#endif
        if (result) {
            return (int) result;
        }
    }
    return 0;
}
static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
                                     Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        return __Pyx_PyUnicode_TailmatchTuple(s, substr, start, end, direction);
    }
    return (int) PyUnicode_Tailmatch(s, substr, start, end, direction);
}

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
  #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
  #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(0);
    }
    ctx = PyUnicode_FromString(name);
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
    if (nogil)
        PyGILState_Release(state);
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static int __Pyx_PyFloat_BoolNeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a;
    CYTHON_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    if (op1 == op2) {
        return 0;
    }
    if (likely(PyFloat_CheckExact(op1))) {
        a = __Pyx_PyFloat_AS_DOUBLE(op1);
        
    } else
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsZero(op1)) {
            a = 0.0;
            
        } else if (__Pyx_PyLong_IsCompact(op1)) {
            a = (double) __Pyx_PyLong_CompactValue(op1);
        } else {
            const digit* digits = __Pyx_PyLong_Digits(op1);
            const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
            switch (size) {
                case -2:
                case 2:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                        a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -2)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                case 3:
                    if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                        a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -3)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                case 4:
                    if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                        a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -4)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                default:
        #endif
                    {
                        PyObject *res =
                    #if CYTHON_USE_TYPE_SLOTS || __PYX_LIMITED_VERSION_HEX >= 0x030A0000
                            __Pyx_PyType_GetSlot((&PyFloat_Type), tp_richcompare, richcmpfunc)
                    #else
                            PyObject_RichCompare
                    #endif
                        (op2, op1,
                         Py_NE);
                    return __Pyx_PyObject_IsTrueAndDecref(
                        res);
                    }
        #if CYTHON_USE_PYLONG_INTERNALS
            }
        }
        #endif
    } else {
        return __Pyx_PyObject_IsTrueAndDecref(
            PyObject_RichCompare(op1, op2, Py_NE));
    }
        if (a != b) {
            return 1;
        } else {
            return 0;
        }
}
#endif

/* Py3UpdateBases */
static PyObject*
__Pyx_PEP560_update_bases(PyObject *bases)
{
    Py_ssize_t i, j, size_bases;
    PyObject *base = NULL, *meth, *new_base, *result, *new_bases = NULL;
#if CYTHON_ASSUME_SAFE_SIZE
    size_bases = PyTuple_GET_SIZE(bases);
#else
    size_bases = PyTuple_Size(bases);
    if (size_bases < 0) return NULL;
#endif
    for (i = 0; i < size_bases; i++) {
#if CYTHON_AVOID_BORROWED_REFS
        Py_CLEAR(base);
#endif
#if CYTHON_ASSUME_SAFE_MACROS
        base = PyTuple_GET_ITEM(bases, i);
#else
        base = PyTuple_GetItem(bases, i);
        if (!base) goto error;
#endif
#if CYTHON_AVOID_BORROWED_REFS
        Py_INCREF(base);
#endif
        if (PyType_Check(base)) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_mstate_global->__pyx_n_u_mro_entries);
        if (!meth && PyErr_Occurred()) {
            goto error;
        }
        if (!meth) {
            if (new_bases) {
                if (PyList_Append(new_bases, base) < 0) {
                    goto error;
                }
            }
            continue;
        }
        new_base = __Pyx_PyObject_CallOneArg(meth, bases);
        Py_DECREF(meth);
        if (!new_base) {
            goto error;
        }
        if (!PyTuple_Check(new_base)) {
            PyErr_SetString(PyExc_TypeError,
                            "__mro_entries__ must return a tuple");
            Py_DECREF(new_base);
            goto error;
        }
        if (!new_bases) {
            if (!(new_bases = PyList_New(i))) {
                goto error;
            }
            for (j = 0; j < i; j++) {
                PyObject *base_from_list;
#if CYTHON_ASSUME_SAFE_MACROS
                base_from_list = PyTuple_GET_ITEM(bases, j);
                PyList_SET_ITEM(new_bases, j, base_from_list);
                Py_INCREF(base_from_list);
#else
                base_from_list = PyTuple_GetItem(bases, j);
                if (!base_from_list) goto error;
                Py_INCREF(base_from_list);
                if (PyList_SetItem(new_bases, j, base_from_list) < 0) goto error;
#endif
            }
        }
#if CYTHON_ASSUME_SAFE_SIZE
        j = PyList_GET_SIZE(new_bases);
#else
        j = PyList_Size(new_bases);
        if (j < 0) goto error;
#endif
        if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
            goto error;
        }
        Py_DECREF(new_base);
    }
    if (!new_bases) {
        Py_INCREF(bases);
        return bases;
    }
    result = PyList_AsTuple(new_bases);
    Py_DECREF(new_bases);
#if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(base);
#endif
    return result;
error:
    Py_XDECREF(new_bases);
#if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(base);
#endif
    return NULL;
}

/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases;
#if CYTHON_ASSUME_SAFE_SIZE
    nbases = PyTuple_GET_SIZE(bases);
#else
    nbases = PyTuple_Size(bases);
    if (nbases < 0) return NULL;
#endif
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
#if CYTHON_ASSUME_SAFE_MACROS
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *tmp = PyTuple_GetItem(bases, i);
        if (!tmp) return NULL;
#endif
        tmptype = Py_TYPE(tmp);
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
        metaclass = &PyType_Type;
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* PyObjectCall2Args */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectLookupSpecial */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else if (with_error) {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#endif

/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_mstate_global->__pyx_n_u_prepare);
        if (prep) {
            PyObject *pargs[3] = {NULL, name, bases};
            ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
            Py_DECREF(prep);
        } else {
            if (unlikely(PyErr_Occurred()))
                return NULL;
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result;
    PyObject *owned_metaclass = NULL;
    PyObject *margs[4] = {NULL, name, bases, dict};
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_mstate_global->__pyx_n_u_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
    Py_XDECREF(owned_metaclass);
    return result;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *empty_list = 0;
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    if (level == -1) {
        if (strchr(__Pyx_MODULE_NAME, '.') != (0)) {
            module = PyImport_ImportModuleLevelObject(
                name, __pyx_mstate_global->__pyx_d, empty_dict, from_list, 1);
            if (unlikely(!module)) {
                if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                    goto bad;
                PyErr_Clear();
            }
        }
        level = 0;
    }
    if (!module) {
        module = PyImport_ImportModuleLevelObject(
            name, __pyx_mstate_global->__pyx_d, empty_dict, from_list, level);
    }
bad:
    Py_XDECREF(empty_dict);
    Py_XDECREF(empty_list);
    return module;
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                CYTHON_COMPILING_IN_GRAAL
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
    }
    return value;
}

/* ImportDottedModule */
static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
    PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
    Py_ssize_t size;
    if (unlikely(PyErr_Occurred())) {
        PyErr_Clear();
    }
#if CYTHON_ASSUME_SAFE_SIZE
    size = PyTuple_GET_SIZE(parts_tuple);
#else
    size = PyTuple_Size(parts_tuple);
    if (size < 0) goto bad;
#endif
    if (likely(size == count)) {
        partial_name = name;
    } else {
        slice = PySequence_GetSlice(parts_tuple, 0, count);
        if (unlikely(!slice))
            goto bad;
        sep = PyUnicode_FromStringAndSize(".", 1);
        if (unlikely(!sep))
            goto bad;
        partial_name = PyUnicode_Join(sep, slice);
    }
    PyErr_Format(
        PyExc_ModuleNotFoundError,
        "No module named '%U'", partial_name);
bad:
    Py_XDECREF(sep);
    Py_XDECREF(slice);
    Py_XDECREF(partial_name);
    return NULL;
}
static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
    PyObject *imported_module;
#if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
        CYTHON_COMPILING_IN_GRAAL
    PyObject *modules = PyImport_GetModuleDict();
    if (unlikely(!modules))
        return NULL;
    imported_module = __Pyx_PyDict_GetItemStr(modules, name);
    Py_XINCREF(imported_module);
#else
    imported_module = PyImport_GetModule(name);
#endif
    return imported_module;
}
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
    Py_ssize_t i, nparts;
#if CYTHON_ASSUME_SAFE_SIZE
    nparts = PyTuple_GET_SIZE(parts_tuple);
#else
    nparts = PyTuple_Size(parts_tuple);
    if (nparts < 0) return NULL;
#endif
    for (i=1; i < nparts && module; i++) {
        PyObject *part, *submodule;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        part = PyTuple_GET_ITEM(parts_tuple, i);
#else
        part = __Pyx_PySequence_ITEM(parts_tuple, i);
        if (!part) return NULL;
#endif
        submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
        Py_DECREF(part);
#endif
        Py_DECREF(module);
        module = submodule;
    }
    if (unlikely(!module)) {
        return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
    }
    return module;
}
static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
    PyObject *imported_module;
    PyObject *module = __Pyx_Import(name, NULL, 0);
    if (!parts_tuple || unlikely(!module))
        return module;
    imported_module = __Pyx__ImportDottedModule_Lookup(name);
    if (likely(imported_module)) {
        Py_DECREF(module);
        return imported_module;
    }
    PyErr_Clear();
    return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
}
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
    if (likely(module)) {
        PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_mstate_global->__pyx_n_u_spec);
        if (likely(spec)) {
            PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_mstate_global->__pyx_n_u_initializing);
            if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
                Py_DECREF(spec);
                spec = NULL;
            }
            Py_XDECREF(unsafe);
        }
        if (likely(!spec)) {
            PyErr_Clear();
            return module;
        }
        Py_DECREF(spec);
        Py_DECREF(module);
    } else if (PyErr_Occurred()) {
        PyErr_Clear();
    }
#endif
    return __Pyx__ImportDottedModule(name, parts_tuple);
}

/* HasAttr */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!PyUnicode_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_PyObject_GetAttrStrNoError(o, n);
    if (!r) {
        return (unlikely(PyErr_Occurred())) ? -1 : 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}
#endif

/* ValidateBasesTuple */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_SIZE
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (unlikely(n < 0)) return -1;
#endif
    for (i = 1; i < n; i++)
    {
        PyTypeObject *b;
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *b0 = PySequence_GetItem(bases, i);
        if (!b0) return -1;
#elif CYTHON_ASSUME_SAFE_MACROS
        PyObject *b0 = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *b0 = PyTuple_GetItem(bases, i);
        if (!b0) return -1;
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
            PyErr_Format(PyExc_TypeError,
                "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
            __Pyx_DECREF_TypeName(b_name);
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
        if (dictoffset == 0)
        {
            Py_ssize_t b_dictoffset = 0;
#if CYTHON_USE_TYPE_SLOTS
            b_dictoffset = b->tp_dictoffset;
#else
            PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
            if (!py_b_dictoffset) goto dictoffset_return;
            b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
            Py_DECREF(py_b_dictoffset);
            if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
#endif
            if (b_dictoffset) {
                {
                    __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                    PyErr_Format(PyExc_TypeError,
                        "extension type '%.200s' has no __dict__ slot, "
                        "but base type '" __Pyx_FMT_TYPENAME "' has: "
                        "either add 'cdef dict __dict__' to the extension type "
                        "or add '__slots__ = [...]' to the base type",
                        type_name, b_name);
                    __Pyx_DECREF_TypeName(b_name);
                }
#if !CYTHON_USE_TYPE_SLOTS
              dictoffset_return:
#endif
#if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(b0);
#endif
                return -1;
            }
        }
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(b0);
#endif
    }
    return 0;
}
#endif

/* PyType_Ready */
CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
    while (t) {
        PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
        if (bases) {
            return 1;
        }
        t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
    }
    return 0;
}
static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
    (void)__Pyx_PyObject_CallMethod0;
#if CYTHON_USE_TYPE_SPECS
    (void)__Pyx_validate_bases_tuple;
#endif
    return PyType_Ready(t);
#else
    int r;
    if (!__Pyx_PyType_HasMultipleInheritance(t)) {
        return PyType_Ready(t);
    }
    PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
    if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
        return -1;
#if !defined(PYSTON_MAJOR_VERSION)
    {
        int gc_was_enabled;
    #if PY_VERSION_HEX >= 0x030A00b1
        gc_was_enabled = PyGC_Disable();
        (void)__Pyx_PyObject_CallMethod0;
    #else
        PyObject *ret, *py_status;
        PyObject *gc = NULL;
        #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                !CYTHON_COMPILING_IN_GRAAL
        gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
        if (unlikely(!py_status)) {
            Py_DECREF(gc);
            return -1;
        }
        gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
        Py_DECREF(py_status);
        if (gc_was_enabled > 0) {
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
            if (unlikely(!ret)) {
                Py_DECREF(gc);
                return -1;
            }
            Py_DECREF(ret);
        } else if (unlikely(gc_was_enabled == -1)) {
            Py_DECREF(gc);
            return -1;
        }
    #endif
        t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#if PY_VERSION_HEX >= 0x030A0000
        t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
#endif
#else
        (void)__Pyx_PyObject_CallMethod0;
#endif
    r = PyType_Ready(t);
#if !defined(PYSTON_MAJOR_VERSION)
        t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
    #if PY_VERSION_HEX >= 0x030A00b1
        if (gc_was_enabled)
            PyGC_Enable();
    #else
        if (gc_was_enabled) {
            PyObject *tp, *v, *tb;
            PyErr_Fetch(&tp, &v, &tb);
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
            if (likely(ret || r == -1)) {
                Py_XDECREF(ret);
                PyErr_Restore(tp, v, tb);
            } else {
                Py_XDECREF(tp);
                Py_XDECREF(v);
                Py_XDECREF(tb);
                r = -1;
            }
        }
        Py_DECREF(gc);
    #endif
    }
#endif
    return r;
#endif
}

/* SetVTable */
static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
    if (unlikely(!ob))
        goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#endif
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* GetVTable */
static void* __Pyx_GetVtable(PyTypeObject *type) {
    void* ptr;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#endif
    if (!ob)
        goto bad;
    ptr = PyCapsule_GetPointer(ob, 0);
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* MergeVTables */
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i=0;
    Py_ssize_t size;
    void** base_vtables;
    __Pyx_TypeName tp_base_name = NULL;
    __Pyx_TypeName base_name = NULL;
    void* unknown = (void*)-1;
    PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
    int base_depth = 0;
    {
        PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        while (base) {
            base_depth += 1;
            base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
        }
    }
    base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
#if CYTHON_COMPILING_IN_LIMITED_API
    size = PyTuple_Size(bases);
    if (size < 0) goto other_failure;
#else
    size = PyTuple_GET_SIZE(bases);
#endif
    for (i = 1; i < size; i++) {
        PyObject *basei;
        void* base_vtable;
#if CYTHON_AVOID_BORROWED_REFS
        basei = PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#else
        basei = PyTuple_GET_ITEM(bases, i);
#endif
        base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
            }
        }
    }
    PyErr_Clear();
    PyMem_Free(base_vtables);
    return 0;
bad:
    {
        PyTypeObject* basei = NULL;
        PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
#if CYTHON_AVOID_BORROWED_REFS
        basei = (PyTypeObject*)PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#else
        basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
#endif
        base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
    }
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
really_bad: // bad has failed!
#endif
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
other_failure:
#endif
    PyMem_Free(base_vtables);
    return -1;
}

/* LimitedApiGetTypeDict */
#if CYTHON_COMPILING_IN_LIMITED_API
static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
    PyObject *tp_dictoffset_o;
    Py_ssize_t tp_dictoffset;
    tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
    if (unlikely(!tp_dictoffset_o)) return -1;
    tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
    Py_DECREF(tp_dictoffset_o);
    if (unlikely(tp_dictoffset == 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' doesn't have a dictoffset");
        return -1;
    } else if (unlikely(tp_dictoffset < 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' has an unexpected negative dictoffset. "
            "Please report this as Cython bug");
        return -1;
    }
    return tp_dictoffset;
}
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
    static Py_ssize_t tp_dictoffset = 0;
    if (unlikely(tp_dictoffset == 0)) {
        tp_dictoffset = __Pyx_GetTypeDictOffset();
        if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
            tp_dictoffset = 0; // try again next time?
            return NULL;
        }
    }
    return *(PyObject**)((char*)tp + tp_dictoffset);
}
#endif

/* DelItemOnTypeDict */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_DelItem(tp_dict, k);
    if (likely(!result)) PyType_Modified(tp);
    return result;
}

/* SetItemOnTypeDict */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_SetItem(tp_dict, k, v);
    if (likely(!result)) {
        PyType_Modified(tp);
        if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name_2))) {
            PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name_2,  (PyObject *) tp, k, NULL);
            if (!setNameResult) return -1;
            Py_DECREF(setNameResult);
        }
    }
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_getstate = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
    PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
        if (!object_getstate && PyErr_Occurred()) {
            goto __PYX_BAD;
        }
#endif
        if (object_getstate != getstate) {
            goto __PYX_GOOD;
        }
    }
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython);
            if (likely(reduce_cython)) {
                ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred()) {
        __Pyx_TypeName type_obj_name =
            __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj);
        PyErr_Format(PyExc_RuntimeError,
            "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
        __Pyx_DECREF_TypeName(type_obj_name);
    }
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
    Py_XDECREF(object_getstate);
    Py_XDECREF(getstate);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* FormatTypeName */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
static __Pyx_TypeName
__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
{
    PyObject *module = NULL, *name = NULL, *result = NULL;
    #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
    name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_qualname);
    #else
    name = PyType_GetQualName(tp);
    #endif
    if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
    module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_module);
    if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
    if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
        result = name;
        name = NULL;
        goto done;
    }
    result = PyUnicode_FromFormat("%U.%U", module, name);
    if (unlikely(result == NULL)) goto bad;
  done:
    Py_XDECREF(name);
    Py_XDECREF(module);
    return result;
  bad:
    PyErr_Clear();
    if (name) {
        result = name;
        name = NULL;
    } else {
        result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__18);
    }
    goto done;
}
#endif

/* ValidateExternBase */
static int __Pyx_validate_extern_base(PyTypeObject *base) {
    Py_ssize_t itemsize;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_itemsize;
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
    itemsize = ((PyTypeObject *)base)->tp_itemsize;
#else
    py_itemsize = PyObject_GetAttrString((PyObject*)base, "__itemsize__");
    if (!py_itemsize)
        return -1;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        return -1;
#endif
    if (itemsize) {
        __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(base);
        PyErr_Format(PyExc_TypeError,
                "inheritance from PyVarObject types like '" __Pyx_FMT_TYPENAME "' not currently supported", b_name);
        __Pyx_DECREF_TypeName(b_name);
        return -1;
    }
    return 0;
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_1_0
#define __PYX_HAVE_RT_ImportType_3_1_0
static PyTypeObject *__Pyx_ImportType_3_1_0(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_1_0 check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#if !CYTHON_COMPILING_IN_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    if (size == 0) {
        return (PyTypeObject *)result;
    }
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize+itemsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error_3_1_0 &&
            ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd-%zd from PyObject",
            module_name, class_name, size, basicsize, basicsize+itemsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_1_0 && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* ListPack */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) {
    va_list va;
    PyObject *l = PyList_New(n);
    va_start(va, n);
    if (unlikely(!l)) goto end;
    for (Py_ssize_t i=0; i<n; ++i) {
        PyObject *arg = va_arg(va, PyObject*);
        Py_INCREF(arg);
        if (__Pyx_PyList_SET_ITEM(l, i, arg) != (0)) {
            Py_CLEAR(l);
            goto end;
        }
    }
    end:
    va_end(va);
    return l;
}

/* GetNameInClass */
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    PyObject *dict;
    assert(PyType_Check(nmspace));
#if CYTHON_USE_TYPE_SLOTS
    dict = ((PyTypeObject*)nmspace)->tp_dict;
    Py_XINCREF(dict);
#else
    dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict);
#endif
    if (likely(dict)) {
        result = PyObject_GetItem(dict, name);
        Py_DECREF(dict);
        if (result) {
            return result;
        }
    }
    PyErr_Clear();
    __Pyx_GetModuleGlobalNameUncached(result, name);
    return result;
}

/* ClassMethod */
static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
    if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
        return PyClassMethod_New(method);
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (PyMethodDescr_Check(method))
#else
    if (__Pyx_TypeCheck(method, &PyMethodDescr_Type))
#endif
    {
#if CYTHON_COMPILING_IN_LIMITED_API
        return PyErr_Format(
            PyExc_SystemError,
            "Cython cannot yet handle classmethod on a MethodDescriptorType (%S) in limited API mode. "
            "This is most likely a classmethod in a cdef class method with binding=False. "
            "Try setting 'binding' to True.",
            method);
#elif CYTHON_COMPILING_IN_GRAAL
        PyTypeObject *d_type = PyDescrObject_GetType(method);
        return PyDescr_NewClassMethod(d_type, PyMethodDescrObject_GetMethod(method));
#else
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        PyTypeObject *d_type = descr->d_common.d_type;
        return PyDescr_NewClassMethod(d_type, descr->d_method);
#endif
    }
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
    else if (PyMethod_Check(method)) {
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else {
        return PyClassMethod_New(method);
    }
#else
    {
        PyObject *func=NULL;
        PyObject *builtins, *classmethod, *classmethod_str, *result=NULL;
        if (__Pyx_TypeCheck(method, __pyx_mstate_global->__Pyx_CachedMethodType)) {
            func = PyObject_GetAttrString(method, "__func__");
            if (!func) goto bad;
        } else {
            func = method;
            Py_INCREF(func);
        }
        builtins = PyEval_GetBuiltins(); // borrowed
        if (unlikely(!builtins)) goto bad;
        classmethod_str = PyUnicode_FromString("classmethod");
        if (unlikely(!classmethod_str)) goto bad;
        classmethod = PyObject_GetItem(builtins, classmethod_str);
        Py_DECREF(classmethod_str);
        if (unlikely(!classmethod)) goto bad;
        result = PyObject_CallFunctionObjArgs(classmethod, func, NULL);
        Py_DECREF(classmethod);
        bad:
        Py_XDECREF(func);
        return result;
    }
#endif
}

/* CLineInTraceback */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_mstate_global->__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __Pyx_BEGIN_CRITICAL_SECTION(*cython_runtime_dict);
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback))
        Py_XINCREF(use_cline);
        __Pyx_END_CRITICAL_SECTION();
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_cython_runtime, __pyx_mstate_global->__pyx_n_u_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_INCREF(use_cline);
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_mstate_global->__pyx_cython_runtime, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    Py_XDECREF(use_cline);
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
    __Pyx_CachedCodeObjectType* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = code_cache->entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__find_code_object;
    return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
    if (old_count < 0) {
        __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
        return NULL;
    }
#endif
    __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
#endif
    return result;
#endif
}
static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
{
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            code_cache->entries = entries;
            code_cache->max_count = 64;
            code_cache->count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
        __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_INCREF(code_object);
        Py_DECREF(tmp);
        return;
    }
    if (code_cache->count == code_cache->max_count) {
        int new_max = code_cache->max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        code_cache->entries = entries;
        code_cache->max_count = new_max;
    }
    for (i=code_cache->count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    code_cache->count++;
    Py_INCREF(code_object);
}
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__insert_code_object;
    return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type expected = 0;
    if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
        return;
    }
#endif
    __pyx__insert_code_object(code_cache, code_line, code_object);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
#endif
#endif
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                       PyObject *firstlineno, PyObject *name) {
    PyObject *replace = NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
    replace = PyObject_GetAttrString(code, "replace");
    if (likely(replace)) {
        PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
    PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
    PyObject *exc_type, *exc_value, *exc_traceback;
    int success = 0;
    if (c_line) {
        (void) __pyx_cfilenm;
        (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
    }
    PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
    code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!code_object) {
        code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
        if (unlikely(!code_object)) goto bad;
        py_py_line = PyLong_FromLong(py_line);
        if (unlikely(!py_py_line)) goto bad;
        py_funcname = PyUnicode_FromString(funcname);
        if (unlikely(!py_funcname)) goto bad;
        dict = PyDict_New();
        if (unlikely(!dict)) goto bad;
        {
            PyObject *old_code_object = code_object;
            code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
            Py_DECREF(old_code_object);
        }
        if (unlikely(!code_object)) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
    } else {
        dict = PyDict_New();
    }
    getframe = PySys_GetObject("_getframe");
    if (unlikely(!getframe)) goto bad;
    if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
    frame = PyEval_EvalCode(code_object, dict, dict);
    if (unlikely(!frame) || frame == Py_None) goto bad;
    success = 1;
  bad:
    PyErr_Restore(exc_type, exc_value, exc_traceback);
    Py_XDECREF(code_object);
    Py_XDECREF(py_py_line);
    Py_XDECREF(py_funcname);
    Py_XDECREF(dict);
    Py_XDECREF(replace);
    if (success) {
        PyTraceBack_Here(
            (struct _frame*)frame);
    }
    Py_XDECREF(frame);
}
#else
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    if (c_line) {
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
    }
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_mstate_global->__pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
#endif

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_AMPL_OUTPUTKIND(AMPL_OUTPUTKIND value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const AMPL_OUTPUTKIND neg_one = (AMPL_OUTPUTKIND) -1, const_zero = (AMPL_OUTPUTKIND) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(AMPL_OUTPUTKIND) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(AMPL_OUTPUTKIND) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(AMPL_OUTPUTKIND) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(AMPL_OUTPUTKIND) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(AMPL_OUTPUTKIND) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(AMPL_OUTPUTKIND),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(AMPL_OUTPUTKIND));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyLong_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (long) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(long) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(long) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        long val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (long) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (long) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (long) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (long) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((long) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((long) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (long) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyLong_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (size_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(size_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(size_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        size_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (size_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (size_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (size_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (size_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((size_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((size_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (size_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int64_t __Pyx_PyLong_As_int64_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyLong_As_int64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) >= 2 * PyLong_SHIFT)) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) >= 3 * PyLong_SHIFT)) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) >= 4 * PyLong_SHIFT)) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (int64_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int64_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int64_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int64_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        int64_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (int64_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int64_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (int64_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int64_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(int64_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((int64_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(int64_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int64_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int64_t) 1) << (sizeof(int64_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (int64_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_AMPL_ENTITYTYPE(AMPL_ENTITYTYPE value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const AMPL_ENTITYTYPE neg_one = (AMPL_ENTITYTYPE) -1, const_zero = (AMPL_ENTITYTYPE) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(AMPL_ENTITYTYPE) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(AMPL_ENTITYTYPE) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(AMPL_ENTITYTYPE) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(AMPL_ENTITYTYPE) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(AMPL_ENTITYTYPE) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(AMPL_ENTITYTYPE),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(AMPL_ENTITYTYPE));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyLong_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (int) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (int) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* IterNextPlain */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
    if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
        __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
    return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    PyObject *result;
    PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
    if (unlikely(!next)) return NULL;
    result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
    return result;
#else
    (void)__Pyx_GetBuiltinName; // only for early limited API
    iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
    assert(iternext);
    return iternext(iterator);
#endif
}

/* PyObjectCallMethod1 */
#if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_GetMethod;
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* ReturnWithStopIteration */
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
    if (value == Py_None) {
        if (async || !iternext)
            PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
        return;
    }
    __Pyx__ReturnWithStopIteration(value, async);
}
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
#if CYTHON_COMPILING_IN_CPYTHON
    __Pyx_PyThreadState_declare
#endif
    PyObject *exc;
    PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
#if CYTHON_COMPILING_IN_CPYTHON
    if ((PY_VERSION_HEX >= 0x030C00A6) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        if ((PY_VERSION_HEX >= 0x030e00A1)) {
            exc = __Pyx_PyObject_CallOneArg(exc_type, value);
        } else {
            PyObject *args_tuple = PyTuple_New(1);
            if (unlikely(!args_tuple)) return;
            Py_INCREF(value);
            PyTuple_SET_ITEM(args_tuple, 0, value);
            exc = PyObject_Call(exc_type, args_tuple, NULL);
            Py_DECREF(args_tuple);
        }
        if (unlikely(!exc)) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_value)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(exc_type);
        __Pyx_ErrRestore(exc_type, exc, NULL);
        return;
    }
    #endif
#else
    exc = __Pyx_PyObject_CallOneArg(exc_type, value);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(exc_type, exc);
    Py_DECREF(exc);
}

/* CoroutineBase */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#endif // CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE void
__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
#if CYTHON_USE_AM_SEND
    gen->yieldfrom_am_send = NULL;
#endif
    Py_CLEAR(gen->yieldfrom);
}
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    CYTHON_UNUSED_VAR(__pyx_tstate);
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
            value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
            if (unlikely(!value)) goto limited_api_failure;
            #else
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            #endif
            Py_DECREF(ev);
        }
        else if (unlikely(PyTuple_Check(ev))) {
            Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(tuple_size < 0)) {
                Py_XDECREF(tb);
                Py_DECREF(ev);
                Py_DECREF(et);
                return -1;
            }
            #endif
            if (tuple_size >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#elif CYTHON_ASSUME_SAFE_MACROS
                value = PySequence_ITEM(ev, 0);
#else
                value = PySequence_GetItem(ev, 0);
                if (!value) goto limited_api_failure;
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
#else
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
#endif
    Py_DECREF(ev);
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!value)) return -1;
#endif
    *pvalue = value;
    return 0;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  limited_api_failure:
    Py_XDECREF(et);
    Py_XDECREF(tb);
    Py_XDECREF(ev);
    return -1;
#endif
}
static CYTHON_INLINE
__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
    if (*retval) {
        return PYGEN_NEXT;
    } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
        return PYGEN_RETURN;
    } else {
        return PYGEN_ERROR;
    }
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_CLEAR(exc_state->exc_value);
#else
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
#endif
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    CYTHON_MAYBE_UNUSED_VAR(closing);
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(__Pyx_Coroutine_get_is_running(self));  // Callers should ensure is_running
    if (unlikely(self->resume_label == -1)) {
        __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
        return PYGEN_ERROR;
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_value) {
        #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        #else
        PyObject *exc_tb;
        #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
        exc_tb = PyException_GetTraceback(exc_state->exc_value);
        #elif PY_VERSION_HEX >= 0x030B00a4
        exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
        #else
        exc_tb = exc_state->exc_traceback;
        #endif
        if (exc_tb) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
            #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
            Py_DECREF(exc_tb);
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    retval = self->body(self, tstate, value);
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    *result = retval;
    if (self->resume_label == -1) {
        return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
    }
    return PYGEN_NEXT;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(exc_state);
#else
    PyObject *exc_tb;
    #if PY_VERSION_HEX >= 0x030B00a4
    if (!exc_state->exc_value) return;
    exc_tb = PyException_GetTraceback(exc_state->exc_value);
    #else
    exc_tb = exc_state->exc_traceback;
    #endif
    if (likely(exc_tb)) {
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
        #if PY_VERSION_HEX >= 0x030B00a4
        Py_DECREF(exc_tb);
        #endif
    }
#endif
}
#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
    ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
static PyObject *
__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (likely(result == PYGEN_RETURN)) {
        int is_async = 0;
        #ifdef __Pyx_AsyncGen_USED
        is_async = __Pyx_AsyncGen_CheckExact(gen);
        #endif
        __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
        Py_XDECREF(retval);
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
#if PY_VERSION_HEX < 0x030d00A1
            _PyGen_SetStopIterationValue(result);
#else
            if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                PyErr_SetObject(PyExc_StopIteration, result);
            } else {
                PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                if (likely(exc != NULL)) {
                    PyErr_SetObject(PyExc_StopIteration, exc);
                    Py_DECREF(exc);
                }
            }
#endif
        }
        Py_DECREF(result);
        result = NULL;
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE __Pyx_PySendResult
__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
    __Pyx_PySendResult result;
    PyObject *val = NULL;
    assert(__Pyx_Coroutine_get_is_running(gen));
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
    Py_XDECREF(val);
    return result;
}
#if CYTHON_USE_AM_SEND
static __Pyx_PySendResult
__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
    PyObject *ret = NULL;
    __Pyx_PySendResult result;
    assert(__Pyx_Coroutine_get_is_running(gen));
    result = gen_am_send(gen->yieldfrom, value, &ret);
    if (result == PYGEN_NEXT) {
        assert (ret != NULL);
        *retval = ret;
        return PYGEN_NEXT;
    }
    assert (result != PYGEN_ERROR || ret == NULL);
    __Pyx_Coroutine_Undelegate(gen);
    return __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
}
#endif
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
}
static __Pyx_PySendResult
__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
    __Pyx_PySendResult result;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
      #if !CYTHON_USE_AM_SEND
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
      #endif
        {
            #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
            if (value == Py_None && PyIter_Check(yf))
                ret = __Pyx_PyIter_Next_Plain(yf);
            else
            #endif
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
        }
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            *retval = ret;
            return PYGEN_NEXT;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return result;
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    CYTHON_UNUSED_VAR(gen);
    assert(__Pyx_Coroutine_get_is_running(gen));
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    #endif
    {
        PyObject *meth;
        result = PYGEN_RETURN;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval)) {
                result = PYGEN_ERROR;
            }
        }
    }
    Py_XDECREF(retval);
    return result == PYGEN_ERROR ? -1 : 0;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
            ret = __Pyx_PyIter_Next_Plain(yf);
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result;
    CYTHON_UNUSED_VAR(arg);
    result = __Pyx_Coroutine_Close(self, &retval);
    if (unlikely(result == PYGEN_ERROR))
        return NULL;
    Py_XDECREF(retval);
    Py_RETURN_NONE;
}
static __Pyx_PySendResult
__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PySendResult result;
    PyObject *yf;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    yf = gen->yieldfrom;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
    if (result == PYGEN_ERROR) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_Coroutine_unset_is_running(gen);
        if (!__Pyx_PyErr_Occurred()) {
            return PYGEN_RETURN;
        } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
            __Pyx_PyErr_Clear();
            return PYGEN_RETURN;
        }
        return PYGEN_ERROR;
    } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_RETURN;
    } else {
        const char *msg;
        Py_DECREF(*retval);
        *retval = NULL;
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
            msg = "async generator ignored GeneratorExit";
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_ERROR;
    }
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    yf = gen->yieldfrom;
    if (yf) {
        __Pyx_PySendResult result;
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                goto propagate_exception;
            goto throw_here;
        }
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    __Pyx_Coroutine_unset_is_running(gen);
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                goto throw_here;
            }
            if (likely(args)) {
                ret = __Pyx_PyObject_Call(meth, args, NULL);
            } else {
                PyObject *cargs[4] = {NULL, typ, val, tb};
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
            }
            Py_DECREF(meth);
        }
        Py_DECREF(yf);
        if (ret) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
propagate_exception:
    {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
    }
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_VISIT(exc_state->exc_value);
#else
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
#endif
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    {
        int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        {
            destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
            if (del) del(self);
        }
        if (unlikely(Py_REFCNT(self) > 0))
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    __Pyx_PyHeapTypeObject_GC_Del(gen);
}
#if CYTHON_USE_TP_FINALIZE
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
        if (result == PYGEN_ERROR) {
            PyErr_WriteUnraisable(self);
        } else {
            Py_XDECREF(retval);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
}
#endif
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_name;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_name, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_qualname;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
static PyObject *
__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
{
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyObject *frame;
    #if PY_VERSION_HEX >= 0x030d0000
    Py_BEGIN_CRITICAL_SECTION(self);
    #endif
    frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        PyObject *globals = PyDict_New();
        if (unlikely(!globals)) return NULL;
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            globals,                        /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        Py_DECREF(globals);
        if (unlikely(!frame))
            return NULL;
        if (unlikely(self->gi_frame)) {
            Py_DECREF(frame);
            frame = self->gi_frame;
        } else {
            self->gi_frame = frame;
        }
    }
    Py_INCREF(frame);
    #if PY_VERSION_HEX >= 0x030d0000
    Py_END_CRITICAL_SECTION();
    #endif
    return frame;
#else
    CYTHON_UNUSED_VAR(self);
    Py_RETURN_NONE;
#endif
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
    CYTHON_UNUSED_VAR(context);
    PyObject *frame = self->gi_frame;
    if (frame)
        return __Pyx_NewRef(frame);
    return __Pyx__Coroutine_get_frame(self);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->yieldfrom_am_send = NULL;
    #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_exc_state.exc_value = NULL;
    #else
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
    #endif
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    gen->is_running = 1;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    assert(gen->is_running);
    gen->is_running = 0;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
}
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
    CYTHON_UNUSED_VAR(closure);
    char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
    if (result) Py_RETURN_TRUE;
    else Py_RETURN_FALSE;
}
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
    Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
    if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
        return;
    }
    memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
    static_amsend_methods->am_send = am_send;
    type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
}
#endif

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     PyDoc_STR("object being iterated by 'yield from', or None")},
    {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     PyDoc_STR("name of the generator"), 0},
    {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     PyDoc_STR("qualified name of the generator"), 0},
    {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     PyDoc_STR("Frame of the generator"), 0},
    {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_GeneratorType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_iter, (void *)PyObject_SelfIter},
    {Py_tp_iternext, (void *)__Pyx_Generator_Next},
    {Py_tp_methods, (void *)__pyx_Generator_methods},
    {Py_tp_members, (void *)__pyx_Generator_memberlist},
    {Py_tp_getset, (void *)__pyx_Generator_getsets},
    {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
#if PY_VERSION_HEX >= 0x030A0000
    Py_TPFLAGS_IMMUTABLETYPE |
#endif
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_GeneratorType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2
static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
#endif
static int __pyx_Generator_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_GeneratorType_spec, NULL);
    if (unlikely(!mstate->__pyx_GeneratorType)) {
        return -1;
    }
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
#endif
    return 0;
}
static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *retval = NULL;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    __Pyx_Coroutine_unset_is_running(gen);
    (void) result;
    assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
    assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
    return retval;
}

/* GetRuntimeVersion */
static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    return Py_Version & ~0xFFUL;
#else
    static unsigned long __Pyx_cached_runtime_version = 0;
    if (__Pyx_cached_runtime_version == 0) {
        const char* rt_version = Py_GetVersion();
        unsigned long version = 0;
        unsigned long factor = 0x01000000UL;
        unsigned int digit = 0;
        int i = 0;
        while (factor) {
            while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                ++i;
            }
            version += factor * digit;
            if (rt_version[i] != '.')
                break;
            digit = 0;
            factor >>= 8;
            ++i;
        }
        __Pyx_cached_runtime_version = version;
    }
    return __Pyx_cached_runtime_version;
#endif
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
    const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
    if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
        return 0;
    if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
        return 1;
    {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compile time Python version %d.%d "
                      "of module '%.100s' "
                      "%s "
                      "runtime version %d.%d",
                       (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                       __Pyx_MODULE_NAME,
                       (allow_newer) ? "was newer than" : "does not match",
                       (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
       );
        return PyErr_WarnEx(NULL, message, 1);
    }
}

/* NewCodeObj */
#if CYTHON_COMPILING_IN_LIMITED_API
    static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                       PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                       PyObject *fv, PyObject *cell, PyObject* fn,
                                       PyObject *name, int fline, PyObject *lnos) {
        PyObject *exception_table = NULL;
        PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
        #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
        PyObject *version_info;
        PyObject *py_minor_version = NULL;
        #endif
        long minor_version = 0;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
        minor_version = 11;
        #else
        if (!(version_info = PySys_GetObject("version_info"))) goto end;
        if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
        minor_version = PyLong_AsLong(py_minor_version);
        Py_DECREF(py_minor_version);
        if (minor_version == -1 && PyErr_Occurred()) goto end;
        #endif
        if (!(types_module = PyImport_ImportModule("types"))) goto end;
        if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
        if (minor_version <= 7) {
            (void)p;
            result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else if (minor_version <= 10) {
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else {
            if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
        }
    end:
        Py_XDECREF(code_type);
        Py_XDECREF(exception_table);
        Py_XDECREF(types_module);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return result;
    }
#elif PY_VERSION_HEX >= 0x030B0000
  static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                         PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                         PyObject *fv, PyObject *cell, PyObject* fn,
                                         PyObject *name, int fline, PyObject *lnos) {
    PyCodeObject *result;
    result =
      #if PY_VERSION_HEX >= 0x030C0000
        PyUnstable_Code_NewWithPosOnlyArgs
      #else
        PyCode_NewWithPosOnlyArgs
      #endif
        (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
    return result;
  }
#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
static PyObject* __Pyx_PyCode_New(
        __Pyx_PyCode_New_function_description descr,
        PyObject **varnames,
        PyObject* filename,
        PyObject *funcname,
        const char *line_table,
        PyObject *tuple_dedup_map
) {
    PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL, *line_table_bytes = NULL;
    Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
    PyObject *varnames_tuple = PyTuple_New(var_count);
    if (unlikely(!varnames_tuple)) return NULL;
    for (Py_ssize_t i=0; i < var_count; i++) {
        Py_INCREF(varnames[i]);
        if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
    }
    #if CYTHON_COMPILING_IN_LIMITED_API
    varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
    if (!varnames_tuple_dedup) {
        if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
        varnames_tuple_dedup = varnames_tuple;
    }
    #else
    varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
    if (unlikely(!varnames_tuple_dedup)) goto done;
    #endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(varnames_tuple_dedup);
    #endif
    if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL
        && !CYTHON_COMPILING_IN_GRAAL) {
        line_table_bytes = PyBytes_FromStringAndSize(line_table, descr.line_table_length);
        if (unlikely(!line_table_bytes)) goto done;
        Py_ssize_t code_len = (descr.line_table_length * 2 + 4) & ~3;
        code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
        if (unlikely(!code_bytes)) goto done;
        char* c_code_bytes = PyBytes_AsString(code_bytes);
        if (unlikely(!c_code_bytes)) goto done;
        memset(c_code_bytes, 0, (size_t) code_len);
    }
    code_obj = (PyObject*) __Pyx__PyCode_New(
        (int) descr.argcount,
        (int) descr.num_posonly_args,
        (int) descr.num_kwonly_args,
        (int) descr.nlocals,
        0,
        (int) descr.flags,
        code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        varnames_tuple_dedup,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        filename,
        funcname,
        (int) descr.first_line,
        (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table_bytes) ? line_table_bytes : __pyx_mstate_global->__pyx_empty_bytes
    );
done:
    Py_XDECREF(code_bytes);
    Py_XDECREF(line_table_bytes);
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(varnames_tuple_dedup);
    #endif
    Py_DECREF(varnames_tuple);
    return code_obj;
}

/* InitStrings */
static int __Pyx_InitStrings(__Pyx_StringTabEntry const *t, PyObject **target, const char* const* encoding_names) {
    while (t->s) {
        PyObject *str;
        if (t->is_unicode) {
            if (t->intern) {
                str = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                str = PyUnicode_Decode(t->s, t->n - 1, encoding_names[t->encoding], NULL);
            } else {
                str = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            str = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        if (!str)
            return -1;
        *target = str;
        if (PyObject_Hash(str) == -1)
            return -1;
        ++t;
        ++target;
    }
    return 0;
}

#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
}
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  else if (!PyErr_Occurred()) {
      PyErr_SetString(PyExc_TypeError,
                      "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


/* MultiPhaseInitModuleState */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
#else
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
#endif
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
#error "Module state with PEP489 requires atomics. Currently that's one of\
 C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
#endif
#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#define __Pyx_ModuleStateLookup_Lock()
#define __Pyx_ModuleStateLookup_Unlock()
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(__cplusplus) && __cplusplus >= 201103L
#include <mutex>
static std::mutex __Pyx_ModuleStateLookup_mutex;
#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
#include <threads.h>
static mtx_t __Pyx_ModuleStateLookup_mutex;
static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
    mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
}
#define __Pyx_ModuleStateLookup_Lock()\
  call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  mtx_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(HAVE_PTHREAD_H)
#include <pthread.h>
static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(_WIN32)
#include <Windows.h>  // synchapi.h on its own doesn't work
static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#else
#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
 Requires C standard >= C11, or C++ standard >= C++11,\
 or pthreads, or the Windows 32 API, or Python >= 3.13."
#endif
typedef struct {
    int64_t id;
    PyObject *module;
} __Pyx_InterpreterIdAndModule;
typedef struct {
    char interpreter_id_as_index;
    Py_ssize_t count;
    Py_ssize_t allocated;
    __Pyx_InterpreterIdAndModule table[1];
} __Pyx_ModuleStateLookupData;
#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
#else
static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
#endif
static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
        __Pyx_InterpreterIdAndModule* table,
        Py_ssize_t count,
        int64_t interpreterId) {
    __Pyx_InterpreterIdAndModule* begin = table;
    __Pyx_InterpreterIdAndModule* end = begin + count;
    if (begin->id == interpreterId) {
        return begin;
    }
    while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
        __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
        if (halfway->id == interpreterId) {
            return halfway;
        }
        if (halfway->id < interpreterId) {
            begin = halfway;
        } else {
            end = halfway;
        }
    }
    for (; begin < end; ++begin) {
        if (begin->id >= interpreterId) return begin;
    }
    return begin;
}
static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return NULL;
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
    {
        __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        if (likely(data)) {
            __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
            if (likely(data == new_data)) {
                goto read_finished;
            }
        }
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        __Pyx_ModuleStateLookup_Lock();
        __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
        data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
        __Pyx_ModuleStateLookup_Unlock();
    }
  read_finished:;
#else
    __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_InterpreterIdAndModule* found = NULL;
    if (unlikely(!data)) goto end;
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            found = data->table+interpreter_id;
        }
    } else {
        found = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
    }
  end:
    {
        PyObject *result=NULL;
        if (found && found->id == interpreter_id) {
            result = found->module;
        }
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
#endif
        return result;
    }
}
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
    while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
}
#else
#define __Pyx_ModuleStateLookup_wait_until_no_readers()
#endif
static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
    Py_ssize_t to_allocate = (*old_data)->allocated;
    while (to_allocate <= interpreter_id) {
        if (to_allocate == 0) to_allocate = 1;
        else to_allocate *= 2;
    }
    __Pyx_ModuleStateLookupData *new_data = *old_data;
    if (to_allocate != (*old_data)->allocated) {
         new_data = (__Pyx_ModuleStateLookupData *)realloc(
            *old_data,
            sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
        if (!new_data) {
            PyErr_NoMemory();
            return -1;
        }
        for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
            new_data->table[i].id = i;
            new_data->table[i].module = NULL;
        }
        new_data->allocated = to_allocate;
    }
    new_data->table[interpreter_id].module = module;
    if (new_data->count < interpreter_id+1) {
        new_data->count = interpreter_id+1;
    }
    *old_data = new_data;
    return 0;
}
static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
    __Pyx_InterpreterIdAndModule *read = data->table;
    __Pyx_InterpreterIdAndModule *write = data->table;
    __Pyx_InterpreterIdAndModule *end = read + data->count;
    for (; read<end; ++read) {
        if (read->module) {
            write->id = read->id;
            write->module = read->module;
            ++write;
        }
    }
    data->count = write - data->table;
    for (; write<end; ++write) {
        write->id = 0;
        write->module = NULL;
    }
    data->interpreter_id_as_index = 0;
}
static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    int result = 0;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_ModuleStateLookupData *new_data = old_data;
    if (!new_data) {
        new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
        if (!new_data) {
            result = -1;
            PyErr_NoMemory();
            goto end;
        }
        new_data->allocated = 1;
        new_data->interpreter_id_as_index = 1;
    }
    __Pyx_ModuleStateLookup_wait_until_no_readers();
    if (new_data->interpreter_id_as_index) {
        if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
            result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
            goto end;
        }
        __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
    }
    {
        Py_ssize_t insert_at = 0;
        {
            __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                new_data->table, new_data->count, interpreter_id);
            assert(lower_bound);
            insert_at = lower_bound - new_data->table;
            if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                lower_bound->module = module;
                goto end;  // already in table, nothing more to do
            }
        }
        if (new_data->count+1 >= new_data->allocated) {
            Py_ssize_t to_allocate = (new_data->count+1)*2;
            new_data =
                (__Pyx_ModuleStateLookupData*)realloc(
                    new_data,
                    sizeof(__Pyx_ModuleStateLookupData) +
                    (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
            if (!new_data) {
                result = -1;
                new_data = old_data;
                PyErr_NoMemory();
                goto end;
            }
            new_data->allocated = to_allocate;
        }
        ++new_data->count;
        int64_t last_id = interpreter_id;
        PyObject *last_module = module;
        for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
            int64_t current_id = new_data->table[i].id;
            new_data->table[i].id = last_id;
            last_id = current_id;
            PyObject *current_module = new_data->table[i].module;
            new_data->table[i].module = last_module;
            last_module = current_module;
        }
    }
  end:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
#else
    __Pyx_ModuleStateLookup_data = new_data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return result;
}
static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
#endif
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            data->table[interpreter_id].module = NULL;
        }
        goto done;
    }
    {
        __Pyx_ModuleStateLookup_wait_until_no_readers();
        __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
        if (!lower_bound) goto done;
        if (lower_bound->id != interpreter_id) goto done;
        __Pyx_InterpreterIdAndModule *end = data->table+data->count;
        for (;lower_bound<end-1; ++lower_bound) {
            lower_bound->id = (lower_bound+1)->id;
            lower_bound->module = (lower_bound+1)->module;
        }
    }
    --data->count;
    if (data->count == 0) {
        free(data);
        data = NULL;
    }
  done:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
#else
    __Pyx_ModuleStateLookup_data = data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return 0;
}
#endif

/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
