/* Generated by Cython 0.15.1 on Fri Jan 20 15:56:29 2012 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !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

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__casuarius
#define __PYX_HAVE_API__casuarius
#include "math.h"
#include <string>
#include <vector>
#include "cysw_support.h"
#include "cassowary/SymbolicWeight.h"
#include "cassowary/Strength.h"
#include "cassowary/Variable.h"
#include "cassowary/LinearExpression.h"
#include "cassowary/Constraint.h"
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include "cassowary/LinearEquation.h"
#include "cassowary/LinearInequality.h"
#include "cassowary/SimplexSolver.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if 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

/* unused attribute */
#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)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "casuarius.pyx",
};

static PyObject *__Pyx_Generator_Next(PyObject *self);
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Generator_Close(PyObject *self);
static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args, CYTHON_UNUSED PyObject *kwds);

typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);

/*--- Type declarations ---*/
struct __pyx_obj_9casuarius_Solver;
struct __pyx_obj_9casuarius_SolverEditContext;
struct __pyx_obj_9casuarius_LinearConstraint;
struct __pyx_obj_9casuarius_EQConstraint;
struct __pyx_Generator_object;
struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr;
struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr;
struct __pyx_obj_9casuarius_LinearSymbolic;
struct __pyx_obj_9casuarius_LEConstraint;
struct __pyx_obj_9casuarius_SymbolicWeight;
struct __pyx_obj_9casuarius_LinearExpression;
struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms;
struct __pyx_obj_9casuarius_ConstraintVariable;
struct __pyx_obj_9casuarius_Term;
struct __pyx_obj_9casuarius___pyx_scope_struct____mul__;
struct __pyx_obj_9casuarius_Strength;
struct __pyx_obj_9casuarius_GEConstraint;
struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr;
struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__;
struct __pyx_opt_args_9casuarius_almost_equal;
struct __pyx_opt_args_9casuarius_6Solver__begin_edit_suggest_values;

/* "casuarius.pyx":197
 * 
 * 
 * cdef bint almost_equal(double a, double b, double eps=1e-8):             # <<<<<<<<<<<<<<
 *     return fabs(a - b) < eps
 * 
 */
struct __pyx_opt_args_9casuarius_almost_equal {
  int __pyx_n;
  double eps;
};

/* "casuarius.pyx":715
 *         return SolverEditContext(self, var_vals, default_strength, default_weight)
 * 
 *     cdef object _begin_edit_suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):             # <<<<<<<<<<<<<<
 *         cdef ConstraintVariable variable
 *         cdef double value
 */
struct __pyx_opt_args_9casuarius_6Solver__begin_edit_suggest_values {
  int __pyx_n;
  struct __pyx_obj_9casuarius_Strength *default_strength;
  double default_weight;
};

/* "casuarius.pyx":674
 *             return abs(self.rhs.value - self.lhs.value)
 * 
 * cdef class Solver:             # <<<<<<<<<<<<<<
 *     cdef ClSimplexSolver *solver
 *     cdef bint _autosolve
 */
struct __pyx_obj_9casuarius_Solver {
  PyObject_HEAD
  struct __pyx_vtabstruct_9casuarius_Solver *__pyx_vtab;
  SimplexSolver *solver;
  int _autosolve;
  int _explaining;
};


/* "casuarius.pyx":750
 * 
 * 
 * cdef class SolverEditContext:             # <<<<<<<<<<<<<<
 *     """ Context manager for suggesting variables in a solver.
 *     """
 */
struct __pyx_obj_9casuarius_SolverEditContext {
  PyObject_HEAD
  struct __pyx_obj_9casuarius_Solver *solver;
  PyObject *suggest_var_vals;
  struct __pyx_obj_9casuarius_Strength *default_strength;
  double default_weight;
};


/* "casuarius.pyx":550
 * 
 * 
 * cdef class LinearConstraint:             # <<<<<<<<<<<<<<
 *     cdef readonly LinearExpression lhs
 *     cdef readonly LinearExpression rhs
 */
struct __pyx_obj_9casuarius_LinearConstraint {
  PyObject_HEAD
  struct __pyx_vtabstruct_9casuarius_LinearConstraint *__pyx_vtab;
  struct __pyx_obj_9casuarius_LinearExpression *lhs;
  struct __pyx_obj_9casuarius_LinearExpression *rhs;
  struct __pyx_obj_9casuarius_Strength *_strength;
  double _weight;
  PyObject *op;
  P_Constraint *cl_linear_constraint;
};


/* "casuarius.pyx":656
 *             return self.rhs.value - self.lhs.value
 * 
 * cdef class EQConstraint(LinearConstraint):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 */
struct __pyx_obj_9casuarius_EQConstraint {
  struct __pyx_obj_9casuarius_LinearConstraint __pyx_base;
};


/* "casuarius.pyx":142
 * 
 *     def __mul__(self, double other):
 *         new_weights = tuple(x*other for x in self.weights)             # <<<<<<<<<<<<<<
 *         return SymbolicWeight(new_weights)
 * 
 */
struct __pyx_Generator_object {
  PyObject_HEAD
  __pyx_generator_body_t body;
  int is_running;
  int resume_label;
  PyObject *exc_type;
  PyObject *exc_value;
  PyObject *exc_traceback;
};

struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr {
  struct __pyx_Generator_object __pyx_base;
  struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *__pyx_outer_scope;
  PyObject *__pyx_v_x;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "casuarius.pyx":471
 *         if len(self.terms) > 0:
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))
 *             terms = ' + '.join(str(term) for term in s)             # <<<<<<<<<<<<<<
 *             if self.constant > 0.0:
 *                 terms += ' + %s' % self.constant
 */
struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr {
  struct __pyx_Generator_object __pyx_base;
  struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *__pyx_outer_scope;
  PyObject *__pyx_v_term;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "casuarius.pyx":201
 * 
 * 
 * cdef class LinearSymbolic:             # <<<<<<<<<<<<<<
 * 
 *     def nonlinear(self, msg):
 */
struct __pyx_obj_9casuarius_LinearSymbolic {
  PyObject_HEAD
  struct __pyx_vtabstruct_9casuarius_LinearSymbolic *__pyx_vtab;
};


/* "casuarius.pyx":620
 *         return NULL
 * 
 * cdef class LEConstraint(LinearConstraint):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 */
struct __pyx_obj_9casuarius_LEConstraint {
  struct __pyx_obj_9casuarius_LinearConstraint __pyx_base;
};


/* "casuarius.pyx":121
 *     void delete_P_Constraint(P_Constraint *pcn)
 * 
 * cdef class SymbolicWeight:             # <<<<<<<<<<<<<<
 *     cdef ClSymbolicWeight *symbolic_weight
 *     cdef readonly tuple weights
 */
struct __pyx_obj_9casuarius_SymbolicWeight {
  PyObject_HEAD
  SymbolicWeight *symbolic_weight;
  PyObject *weights;
};


/* "casuarius.pyx":445
 * 
 * 
 * cdef class LinearExpression(LinearSymbolic):             # <<<<<<<<<<<<<<
 *     cdef public tuple terms
 *     cdef public double constant
 */
struct __pyx_obj_9casuarius_LinearExpression {
  struct __pyx_obj_9casuarius_LinearSymbolic __pyx_base;
  PyObject *terms;
  double constant;
};


/* "casuarius.pyx":449
 *     cdef public double constant
 * 
 *     def reduce_terms(self, terms):             # <<<<<<<<<<<<<<
 *         mapping = defaultdict(float)
 *         for term in terms:
 */
struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms {
  PyObject_HEAD
  PyObject *__pyx_v_mapping;
};


/* "casuarius.pyx":320
 * 
 * 
 * cdef class ConstraintVariable(LinearSymbolic):             # <<<<<<<<<<<<<<
 *     cdef ClVariable *variable
 *     cdef readonly bytes name
 */
struct __pyx_obj_9casuarius_ConstraintVariable {
  struct __pyx_obj_9casuarius_LinearSymbolic __pyx_base;
  Variable *variable;
  PyObject *name;
};


/* "casuarius.pyx":383
 * 
 * 
 * cdef class Term(LinearSymbolic):             # <<<<<<<<<<<<<<
 *     cdef public ConstraintVariable var
 *     cdef public double coeff
 */
struct __pyx_obj_9casuarius_Term {
  struct __pyx_obj_9casuarius_LinearSymbolic __pyx_base;
  struct __pyx_obj_9casuarius_ConstraintVariable *var;
  double coeff;
};


/* "casuarius.pyx":141
 *         return self.symbolic_weight.AsDouble()
 * 
 *     def __mul__(self, double other):             # <<<<<<<<<<<<<<
 *         new_weights = tuple(x*other for x in self.weights)
 *         return SymbolicWeight(new_weights)
 */
struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ {
  PyObject_HEAD
  double __pyx_v_other;
  PyObject *__pyx_v_self;
};


/* "casuarius.pyx":155
 * 
 * 
 * cdef class Strength:             # <<<<<<<<<<<<<<
 *     cdef ClStrength *strength
 *     cdef readonly bytes name
 */
struct __pyx_obj_9casuarius_Strength {
  PyObject_HEAD
  Strength *strength;
  PyObject *name;
  struct __pyx_obj_9casuarius_SymbolicWeight *symbolic_weight;
  int is_required;
};


/* "casuarius.pyx":638
 *             return self.lhs.value - self.rhs.value
 * 
 * cdef class GEConstraint(LinearConstraint):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 */
struct __pyx_obj_9casuarius_GEConstraint {
  struct __pyx_obj_9casuarius_LinearConstraint __pyx_base;
};


/* "casuarius.pyx":453
 *         for term in terms:
 *             mapping[term.var] += term.coeff
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()             # <<<<<<<<<<<<<<
 *                       if not almost_equal(coeff, 0.0))
 *         return terms
 */
struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr {
  struct __pyx_Generator_object __pyx_base;
  struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *__pyx_outer_scope;
  PyObject *__pyx_v_coeff;
  PyObject *__pyx_v_var;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "casuarius.pyx":468
 *             return value
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         if len(self.terms) > 0:
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))
 */
struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ {
  PyObject_HEAD
  PyObject *__pyx_v_s;
};



/* "casuarius.pyx":550
 * 
 * 
 * cdef class LinearConstraint:             # <<<<<<<<<<<<<<
 *     cdef readonly LinearExpression lhs
 *     cdef readonly LinearExpression rhs
 */

struct __pyx_vtabstruct_9casuarius_LinearConstraint {
  P_Constraint *(*as_cl_linear_constraint)(struct __pyx_obj_9casuarius_LinearConstraint *);
};
static struct __pyx_vtabstruct_9casuarius_LinearConstraint *__pyx_vtabptr_9casuarius_LinearConstraint;


/* "casuarius.pyx":638
 *             return self.lhs.value - self.rhs.value
 * 
 * cdef class GEConstraint(LinearConstraint):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 */

struct __pyx_vtabstruct_9casuarius_GEConstraint {
  struct __pyx_vtabstruct_9casuarius_LinearConstraint __pyx_base;
};
static struct __pyx_vtabstruct_9casuarius_GEConstraint *__pyx_vtabptr_9casuarius_GEConstraint;


/* "casuarius.pyx":201
 * 
 * 
 * cdef class LinearSymbolic:             # <<<<<<<<<<<<<<
 * 
 *     def nonlinear(self, msg):
 */

struct __pyx_vtabstruct_9casuarius_LinearSymbolic {
  struct __pyx_obj_9casuarius_LinearConstraint *(*_richcmp_le)(struct __pyx_obj_9casuarius_LinearSymbolic *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_9casuarius_LinearConstraint *(*_richcmp_ge)(struct __pyx_obj_9casuarius_LinearSymbolic *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_9casuarius_LinearConstraint *(*_richcmp_eq)(struct __pyx_obj_9casuarius_LinearSymbolic *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_9casuarius_LinearSymbolic *__pyx_vtabptr_9casuarius_LinearSymbolic;


/* "casuarius.pyx":383
 * 
 * 
 * cdef class Term(LinearSymbolic):             # <<<<<<<<<<<<<<
 *     cdef public ConstraintVariable var
 *     cdef public double coeff
 */

struct __pyx_vtabstruct_9casuarius_Term {
  struct __pyx_vtabstruct_9casuarius_LinearSymbolic __pyx_base;
};
static struct __pyx_vtabstruct_9casuarius_Term *__pyx_vtabptr_9casuarius_Term;


/* "casuarius.pyx":445
 * 
 * 
 * cdef class LinearExpression(LinearSymbolic):             # <<<<<<<<<<<<<<
 *     cdef public tuple terms
 *     cdef public double constant
 */

struct __pyx_vtabstruct_9casuarius_LinearExpression {
  struct __pyx_vtabstruct_9casuarius_LinearSymbolic __pyx_base;
  P_LinearExpression (*as_cl_linear_expression)(struct __pyx_obj_9casuarius_LinearExpression *);
};
static struct __pyx_vtabstruct_9casuarius_LinearExpression *__pyx_vtabptr_9casuarius_LinearExpression;


/* "casuarius.pyx":656
 *             return self.rhs.value - self.lhs.value
 * 
 * cdef class EQConstraint(LinearConstraint):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 */

struct __pyx_vtabstruct_9casuarius_EQConstraint {
  struct __pyx_vtabstruct_9casuarius_LinearConstraint __pyx_base;
};
static struct __pyx_vtabstruct_9casuarius_EQConstraint *__pyx_vtabptr_9casuarius_EQConstraint;


/* "casuarius.pyx":620
 *         return NULL
 * 
 * cdef class LEConstraint(LinearConstraint):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 */

struct __pyx_vtabstruct_9casuarius_LEConstraint {
  struct __pyx_vtabstruct_9casuarius_LinearConstraint __pyx_base;
};
static struct __pyx_vtabstruct_9casuarius_LEConstraint *__pyx_vtabptr_9casuarius_LEConstraint;


/* "casuarius.pyx":674
 *             return abs(self.rhs.value - self.lhs.value)
 * 
 * cdef class Solver:             # <<<<<<<<<<<<<<
 *     cdef ClSimplexSolver *solver
 *     cdef bint _autosolve
 */

struct __pyx_vtabstruct_9casuarius_Solver {
  PyObject *(*_begin_edit_suggest_values)(struct __pyx_obj_9casuarius_Solver *, PyObject *, struct __pyx_opt_args_9casuarius_6Solver__begin_edit_suggest_values *__pyx_optional_args);
  PyObject *(*_end_edit)(struct __pyx_obj_9casuarius_Solver *);
};
static struct __pyx_vtabstruct_9casuarius_Solver *__pyx_vtabptr_9casuarius_Solver;


/* "casuarius.pyx":320
 * 
 * 
 * cdef class ConstraintVariable(LinearSymbolic):             # <<<<<<<<<<<<<<
 *     cdef ClVariable *variable
 *     cdef readonly bytes name
 */

struct __pyx_vtabstruct_9casuarius_ConstraintVariable {
  struct __pyx_vtabstruct_9casuarius_LinearSymbolic __pyx_base;
};
static struct __pyx_vtabstruct_9casuarius_ConstraintVariable *__pyx_vtabptr_9casuarius_ConstraintVariable;

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #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) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name)
  #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 /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

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

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*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); /*proto*/

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
    }
    return r;
}

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

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

static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */

#define __Pyx_PyObject_AsDouble(obj) \
    ((likely(PyFloat_CheckExact(obj))) ? \
     PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

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

static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
    return unlikely(b < 0) ? b : !b; 
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname); /*proto*/

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

static int __Pyx_check_binary_version(void);

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

/* Module declarations from 'libc.math' */

/* Module declarations from 'libcpp.string' */

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'casuarius' */
static PyTypeObject *__pyx_ptype_9casuarius_SymbolicWeight = 0;
static PyTypeObject *__pyx_ptype_9casuarius_Strength = 0;
static PyTypeObject *__pyx_ptype_9casuarius_LinearSymbolic = 0;
static PyTypeObject *__pyx_ptype_9casuarius_ConstraintVariable = 0;
static PyTypeObject *__pyx_ptype_9casuarius_Term = 0;
static PyTypeObject *__pyx_ptype_9casuarius_LinearExpression = 0;
static PyTypeObject *__pyx_ptype_9casuarius_LinearConstraint = 0;
static PyTypeObject *__pyx_ptype_9casuarius_LEConstraint = 0;
static PyTypeObject *__pyx_ptype_9casuarius_GEConstraint = 0;
static PyTypeObject *__pyx_ptype_9casuarius_EQConstraint = 0;
static PyTypeObject *__pyx_ptype_9casuarius_Solver = 0;
static PyTypeObject *__pyx_ptype_9casuarius_SolverEditContext = 0;
static PyTypeObject *__pyx_ptype_9casuarius___pyx_scope_struct____mul__ = 0;
static PyTypeObject *__pyx_ptype_9casuarius___pyx_Generator = 0;
static PyTypeObject *__pyx_ptype_9casuarius___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_9casuarius___pyx_scope_struct_2_reduce_terms = 0;
static PyTypeObject *__pyx_ptype_9casuarius___pyx_scope_struct_3_genexpr = 0;
static PyTypeObject *__pyx_ptype_9casuarius___pyx_scope_struct_4___repr__ = 0;
static PyTypeObject *__pyx_ptype_9casuarius___pyx_scope_struct_5_genexpr = 0;
static int __pyx_f_9casuarius_raise_cassowary_error(void); /*proto*/
static int __pyx_f_9casuarius_almost_equal(double, double, struct __pyx_opt_args_9casuarius_almost_equal *__pyx_optional_args); /*proto*/
static struct __pyx_obj_9casuarius_LinearExpression *__pyx_f_9casuarius_as_linear_expression(PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "casuarius"
int __pyx_module_is_main_casuarius = 0;

/* Implementation of 'casuarius' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_basestring;
static char __pyx_k_1[] = "SymbolicWeight({0!r})";
static char __pyx_k_2[] = "Strength({name!r}, {symbolic_weight!r}, is_required={is_required})";
static char __pyx_k_3[] = "Strength({name!r}, {symbolic_weight!r})";
static char __pyx_k_4[] = "Non-linear expression: %s";
static char __pyx_k_5[] = "Non-linear operator: `%s`";
static char __pyx_k_6[] = "//";
static char __pyx_k_8[] = "%";
static char __pyx_k_11[] = "**";
static char __pyx_k_13[] = "<<";
static char __pyx_k_15[] = ">>";
static char __pyx_k_17[] = "&";
static char __pyx_k_19[] = "|";
static char __pyx_k_21[] = "^";
static char __pyx_k_23[] = "Invalid constraint operation.";
static char __pyx_k_25[] = "Invalid type for constraint operation %s";
static char __pyx_k_26[] = "ConstraintVariable({0!r}, {1!r})";
static char __pyx_k_27[] = "{0}:{1}";
static char __pyx_k_28[] = "[ %s ] * [ %s ]";
static char __pyx_k_29[] = "[ %s ] / [ %s ]";
static char __pyx_k_30[] = "Term({0!r}, {1!r})";
static char __pyx_k_31[] = "{name}:{value}";
static char __pyx_k_32[] = "-{name}:{value}";
static char __pyx_k_33[] = "{coeff} * {name}:{value}";
static char __pyx_k_35[] = "var.name";
static char __pyx_k_37[] = " + ";
static char __pyx_k_38[] = " + %s";
static char __pyx_k_39[] = " - %s";
static char __pyx_k_40[] = "Cannot cast {0!r}, a {1!r}, to LinearExpression.";
static char __pyx_k_42[] = "<%s: (%s %s %s) | %s | %s>";
static char __pyx_k_43[] = "%s %s %s";
static char __pyx_k_44[] = "Expected a known strength string or a Strength. Got {!r} instead.";
static char __pyx_k_45[] = "Expected a known strength string, a Strength or a float weight. Got {!r} instead.";
static char __pyx_k_47[] = "<=";
static char __pyx_k_49[] = ">=";
static char __pyx_k_51[] = "==";
static char __pyx_k_55[] = " Cython wrapper for Cassowary.\n";
static char __pyx_k__id[] = "id";
static char __pyx_k__key[] = "key";
static char __pyx_k__lhs[] = "lhs";
static char __pyx_k__rhs[] = "rhs";
static char __pyx_k__var[] = "var";
static char __pyx_k__join[] = "join";
static char __pyx_k__name[] = "name";
static char __pyx_k__weak[] = "weak";
static char __pyx_k__coeff[] = "coeff";
static char __pyx_k__terms[] = "terms";
static char __pyx_k__value[] = "value";
static char __pyx_k____or__[] = "__or__";
static char __pyx_k__divmod[] = "divmod";
static char __pyx_k__exc_tb[] = "exc_tb";
static char __pyx_k__format[] = "format";
static char __pyx_k__medium[] = "medium";
static char __pyx_k__solver[] = "solver";
static char __pyx_k__sorted[] = "sorted";
static char __pyx_k__strong[] = "strong";
static char __pyx_k__weight[] = "weight";
static char __pyx_k____mul__[] = "__mul__";
static char __pyx_k__exc_val[] = "exc_val";
static char __pyx_k__weights[] = "weights";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____repr__[] = "__repr__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__constant[] = "constant";
static char __pyx_k__exc_type[] = "exc_type";
static char __pyx_k__operator[] = "operator";
static char __pyx_k__required[] = "required";
static char __pyx_k__strength[] = "strength";
static char __pyx_k__var_vals[] = "var_vals";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k__autosolve[] = "autosolve";
static char __pyx_k__casuarius[] = "casuarius";
static char __pyx_k__iteritems[] = "iteritems";
static char __pyx_k__nonlinear[] = "nonlinear";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__attrgetter[] = "attrgetter";
static char __pyx_k__basestring[] = "basestring";
static char __pyx_k__explaining[] = "explaining";
static char __pyx_k___richcmp_eq[] = "_richcmp_eq";
static char __pyx_k___richcmp_ge[] = "_richcmp_ge";
static char __pyx_k___richcmp_le[] = "_richcmp_le";
static char __pyx_k__collections[] = "collections";
static char __pyx_k__defaultdict[] = "defaultdict";
static char __pyx_k__is_required[] = "is_required";
static char __pyx_k__STRENGTH_MAP[] = "STRENGTH_MAP";
static char __pyx_k__nonlinear_op[] = "nonlinear_op";
static char __pyx_k__reduce_terms[] = "reduce_terms";
static char __pyx_k__CassowaryError[] = "CassowaryError";
static char __pyx_k__NotImplemented[] = "NotImplemented";
static char __pyx_k__default_weight[] = "default_weight";
static char __pyx_k__symbolic_weight[] = "symbolic_weight";
static char __pyx_k__default_strength[] = "default_strength";
static char __pyx_k__suggest_var_vals[] = "suggest_var_vals";
static char __pyx_k__NotImplementedError[] = "NotImplementedError";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_27;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_32;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_kp_s_42;
static PyObject *__pyx_kp_s_43;
static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_kp_s_45;
static PyObject *__pyx_kp_b_47;
static PyObject *__pyx_kp_b_49;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_b_51;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_n_s__CassowaryError;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__NotImplemented;
static PyObject *__pyx_n_s__NotImplementedError;
static PyObject *__pyx_n_s__STRENGTH_MAP;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____mul__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____or__;
static PyObject *__pyx_n_s____repr__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___richcmp_eq;
static PyObject *__pyx_n_s___richcmp_ge;
static PyObject *__pyx_n_s___richcmp_le;
static PyObject *__pyx_n_s__attrgetter;
static PyObject *__pyx_n_s__autosolve;
static PyObject *__pyx_n_s__basestring;
static PyObject *__pyx_n_s__casuarius;
static PyObject *__pyx_n_s__coeff;
static PyObject *__pyx_n_s__collections;
static PyObject *__pyx_n_s__constant;
static PyObject *__pyx_n_s__default_strength;
static PyObject *__pyx_n_s__default_weight;
static PyObject *__pyx_n_s__defaultdict;
static PyObject *__pyx_n_s__divmod;
static PyObject *__pyx_n_s__exc_tb;
static PyObject *__pyx_n_s__exc_type;
static PyObject *__pyx_n_s__exc_val;
static PyObject *__pyx_n_s__explaining;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__id;
static PyObject *__pyx_n_s__is_required;
static PyObject *__pyx_n_s__iteritems;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__key;
static PyObject *__pyx_n_s__lhs;
static PyObject *__pyx_n_s__medium;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__nonlinear;
static PyObject *__pyx_n_s__nonlinear_op;
static PyObject *__pyx_n_s__operator;
static PyObject *__pyx_n_s__reduce_terms;
static PyObject *__pyx_n_s__required;
static PyObject *__pyx_n_s__rhs;
static PyObject *__pyx_n_s__solver;
static PyObject *__pyx_n_s__sorted;
static PyObject *__pyx_n_s__strength;
static PyObject *__pyx_n_s__strong;
static PyObject *__pyx_n_s__suggest_var_vals;
static PyObject *__pyx_n_s__symbolic_weight;
static PyObject *__pyx_n_s__terms;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__var;
static PyObject *__pyx_n_s__var_vals;
static PyObject *__pyx_n_s__weak;
static PyObject *__pyx_n_s__weight;
static PyObject *__pyx_n_s__weights;
static PyObject *__pyx_k_34;
static struct __pyx_obj_9casuarius_Strength *__pyx_k_41;
static struct __pyx_obj_9casuarius_Strength *__pyx_k_46;
static struct __pyx_obj_9casuarius_Strength *__pyx_k_48;
static struct __pyx_obj_9casuarius_Strength *__pyx_k_50;
static struct __pyx_obj_9casuarius_Strength *__pyx_k_52;
static struct __pyx_obj_9casuarius_Strength *__pyx_k_53;
static struct __pyx_obj_9casuarius_Strength *__pyx_k_54;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_14;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_24;
static PyObject *__pyx_k_tuple_36;

/* "casuarius.pyx":21
 * 
 * 
 * cdef int raise_cassowary_error() except *:             # <<<<<<<<<<<<<<
 *     raise CassowaryError(get_cpp_exception_message().c_str())
 * 
 */

static int __pyx_f_9casuarius_raise_cassowary_error(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("raise_cassowary_error");

  /* "casuarius.pyx":22
 * 
 * cdef int raise_cassowary_error() except *:
 *     raise CassowaryError(get_cpp_exception_message().c_str())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CassowaryError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyBytes_FromString(get_cpp_exception_message().c_str()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __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_AddTraceback("casuarius.raise_cassowary_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":125
 *     cdef readonly tuple weights
 * 
 *     def __cinit__(self, tuple weights):             # <<<<<<<<<<<<<<
 *         cdef vector[double] c_weights
 *         cdef double c_weight
 */

static int __pyx_pf_9casuarius_14SymbolicWeight___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_14SymbolicWeight___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_weights = 0;
  std::vector<double> __pyx_v_c_weights;
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_weights = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.SymbolicWeight.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), (&PyTuple_Type), 1, "weights", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":130
 *         cdef int i
 * 
 *         for i from 0 <= i < len(weights):             # <<<<<<<<<<<<<<
 *             c_weights.push_back(<double>weights[i])
 *         self.symbolic_weight = new ClSymbolicWeight(c_weights)
 */
  if (unlikely(((PyObject *)__pyx_v_weights) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_weights)); 
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "casuarius.pyx":131
 * 
 *         for i from 0 <= i < len(weights):
 *             c_weights.push_back(<double>weights[i])             # <<<<<<<<<<<<<<
 *         self.symbolic_weight = new ClSymbolicWeight(c_weights)
 *         self.weights = weights
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_weights), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_c_weights.push_back(((double)__pyx_t_3));
  }

  /* "casuarius.pyx":132
 *         for i from 0 <= i < len(weights):
 *             c_weights.push_back(<double>weights[i])
 *         self.symbolic_weight = new ClSymbolicWeight(c_weights)             # <<<<<<<<<<<<<<
 *         self.weights = weights
 * 
 */
  ((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->symbolic_weight = new SymbolicWeight(__pyx_v_c_weights);

  /* "casuarius.pyx":133
 *             c_weights.push_back(<double>weights[i])
 *         self.symbolic_weight = new ClSymbolicWeight(c_weights)
 *         self.weights = weights             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_weights));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights));
  ((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights = __pyx_v_weights;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("casuarius.SymbolicWeight.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":135
 *         self.weights = weights
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self.symbolic_weight
 * 
 */

static void __pyx_pf_9casuarius_14SymbolicWeight_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_9casuarius_14SymbolicWeight_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "casuarius.pyx":136
 * 
 *     def __dealloc__(self):
 *         del self.symbolic_weight             # <<<<<<<<<<<<<<
 * 
 *     def __float__(self):
 */
  delete ((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->symbolic_weight;

  __Pyx_RefNannyFinishContext();
}

/* "casuarius.pyx":138
 *         del self.symbolic_weight
 * 
 *     def __float__(self):             # <<<<<<<<<<<<<<
 *         return self.symbolic_weight.AsDouble()
 * 
 */

static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_2__float__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_2__float__(PyObject *__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("__float__");

  /* "casuarius.pyx":139
 * 
 *     def __float__(self):
 *         return self.symbolic_weight.AsDouble()             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, double other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->symbolic_weight->AsDouble()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.SymbolicWeight.__float__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9casuarius_7__mul___1generator(struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */

/* "casuarius.pyx":142
 * 
 *     def __mul__(self, double other):
 *         new_weights = tuple(x*other for x in self.weights)             # <<<<<<<<<<<<<<
 *         return SymbolicWeight(new_weights)
 * 
 */

static PyObject *__pyx_pf_9casuarius_7__mul___genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_9casuarius_7__mul___genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr");
  __pyx_cur_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *)__pyx_ptype_9casuarius___pyx_scope_struct_1_genexpr->tp_new(__pyx_ptype_9casuarius___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *)__pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __pyx_self = __pyx_self;
  __pyx_cur_scope->__pyx_base.resume_label = 0;
  __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_9casuarius_7__mul___1generator;
  __Pyx_GIVEREF(__pyx_cur_scope);
  __Pyx_RefNannyFinishContext();
  return (PyObject *) __pyx_cur_scope;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9casuarius_7__mul___1generator(struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */
{
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None");
  switch (__pyx_cur_scope->__pyx_base.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)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s__weights); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_v_x = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Multiply(__pyx_cur_scope->__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_cur_scope->__pyx_base.resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_cur_scope->__pyx_base.resume_label = -1;
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "casuarius.pyx":141
 *         return self.symbolic_weight.AsDouble()
 * 
 *     def __mul__(self, double other):             # <<<<<<<<<<<<<<
 *         new_weights = tuple(x*other for x in self.weights)
 *         return SymbolicWeight(new_weights)
 */

static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_3__mul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_3__mul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_other) {
  struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *__pyx_cur_scope;
  PyObject *__pyx_v_new_weights = NULL;
  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("__mul__");
  __pyx_cur_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *)__pyx_ptype_9casuarius___pyx_scope_struct____mul__->tp_new(__pyx_ptype_9casuarius___pyx_scope_struct____mul__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  assert(__pyx_arg_other); {
    __pyx_cur_scope->__pyx_v_other = __pyx_PyFloat_AsDouble(__pyx_arg_other); if (unlikely((__pyx_cur_scope->__pyx_v_other == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.SymbolicWeight.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_self); __pyx_cur_scope->__pyx_v_self = 0;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "casuarius.pyx":142
 * 
 *     def __mul__(self, double other):
 *         new_weights = tuple(x*other for x in self.weights)             # <<<<<<<<<<<<<<
 *         return SymbolicWeight(new_weights)
 * 
 */
  __pyx_t_1 = __pyx_pf_9casuarius_7__mul___genexpr(((PyObject*)__pyx_cur_scope), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_new_weights = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "casuarius.pyx":143
 *     def __mul__(self, double other):
 *         new_weights = tuple(x*other for x in self.weights)
 *         return SymbolicWeight(new_weights)             # <<<<<<<<<<<<<<
 * 
 *     def __rmul__(self, double other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_new_weights));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_new_weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_new_weights));
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_SymbolicWeight)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("casuarius.SymbolicWeight.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_weights);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":145
 *         return SymbolicWeight(new_weights)
 * 
 *     def __rmul__(self, double other):             # <<<<<<<<<<<<<<
 *         return self.__mul__(other)
 * 
 */

static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_4__rmul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_4__rmul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_other) {
  double __pyx_v_other;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__rmul__");
  assert(__pyx_arg_other); {
    __pyx_v_other = __pyx_PyFloat_AsDouble(__pyx_arg_other); if (unlikely((__pyx_v_other == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.SymbolicWeight.__rmul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":146
 * 
 *     def __rmul__(self, double other):
 *         return self.__mul__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____mul__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("casuarius.SymbolicWeight.__rmul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":148
 *         return self.__mul__(other)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'SymbolicWeight({0!r})'.format(self.weights)
 * 
 */

static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_5__repr__(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "casuarius.pyx":149
 * 
 *     def __repr__(self):
 *         return 'SymbolicWeight({0!r})'.format(self.weights)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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("casuarius.SymbolicWeight.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":151
 *         return 'SymbolicWeight({0!r})'.format(self.weights)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return id(self)
 * 
 */

static Py_hash_t __pyx_pf_9casuarius_14SymbolicWeight_6__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pf_9casuarius_14SymbolicWeight_6__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_hash_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__");

  /* "casuarius.pyx":152
 * 
 *     def __hash__(self):
 *         return id(self)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsHash_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_hash_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("casuarius.SymbolicWeight.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":123
 * cdef class SymbolicWeight:
 *     cdef ClSymbolicWeight *symbolic_weight
 *     cdef readonly tuple weights             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, tuple weights):
 */

static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_7weights___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_14SymbolicWeight_7weights___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_SymbolicWeight *)__pyx_v_self)->weights);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":161
 *     cdef readonly bint is_required
 * 
 *     def __cinit__(self, bytes name, SymbolicWeight symbolic_weight, bint is_required=False):             # <<<<<<<<<<<<<<
 *         self.strength = new ClStrength(string(<char*>name), deref(symbolic_weight.symbolic_weight), is_required)
 *         self.name = name
 */

static int __pyx_pf_9casuarius_8Strength___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_8Strength___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  struct __pyx_obj_9casuarius_SymbolicWeight *__pyx_v_symbolic_weight = 0;
  int __pyx_v_is_required;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__symbolic_weight,&__pyx_n_s__is_required,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__symbolic_weight);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__is_required);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = ((PyObject*)values[0]);
    __pyx_v_symbolic_weight = ((struct __pyx_obj_9casuarius_SymbolicWeight *)values[1]);
    if (values[2]) {
      __pyx_v_is_required = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_is_required == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_is_required = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.Strength.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyBytes_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_symbolic_weight), __pyx_ptype_9casuarius_SymbolicWeight, 1, "symbolic_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":162
 * 
 *     def __cinit__(self, bytes name, SymbolicWeight symbolic_weight, bint is_required=False):
 *         self.strength = new ClStrength(string(<char*>name), deref(symbolic_weight.symbolic_weight), is_required)             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.symbolic_weight = symbolic_weight
 */
  __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_name)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->strength = new Strength(std::string(((char *)__pyx_t_1)), (*__pyx_v_symbolic_weight->symbolic_weight), __pyx_v_is_required);

  /* "casuarius.pyx":163
 *     def __cinit__(self, bytes name, SymbolicWeight symbolic_weight, bint is_required=False):
 *         self.strength = new ClStrength(string(<char*>name), deref(symbolic_weight.symbolic_weight), is_required)
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.symbolic_weight = symbolic_weight
 *         self.is_required = is_required
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_name));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->name);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->name));
  ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->name = __pyx_v_name;

  /* "casuarius.pyx":164
 *         self.strength = new ClStrength(string(<char*>name), deref(symbolic_weight.symbolic_weight), is_required)
 *         self.name = name
 *         self.symbolic_weight = symbolic_weight             # <<<<<<<<<<<<<<
 *         self.is_required = is_required
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_symbolic_weight));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_symbolic_weight));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->symbolic_weight);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->symbolic_weight));
  ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->symbolic_weight = __pyx_v_symbolic_weight;

  /* "casuarius.pyx":165
 *         self.name = name
 *         self.symbolic_weight = symbolic_weight
 *         self.is_required = is_required             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->is_required = __pyx_v_is_required;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Strength.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":167
 *         self.is_required = is_required
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self.strength
 * 
 */

static void __pyx_pf_9casuarius_8Strength_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_9casuarius_8Strength_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "casuarius.pyx":168
 * 
 *     def __dealloc__(self):
 *         del self.strength             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  delete ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->strength;

  __Pyx_RefNannyFinishContext();
}

/* "casuarius.pyx":170
 *         del self.strength
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         if self.is_required:
 *             template = 'Strength({name!r}, {symbolic_weight!r}, is_required={is_required})'
 */

static PyObject *__pyx_pf_9casuarius_8Strength_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_8Strength_2__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_template = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "casuarius.pyx":171
 * 
 *     def __repr__(self):
 *         if self.is_required:             # <<<<<<<<<<<<<<
 *             template = 'Strength({name!r}, {symbolic_weight!r}, is_required={is_required})'
 *         else:
 */
  if (((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->is_required) {

    /* "casuarius.pyx":172
 *     def __repr__(self):
 *         if self.is_required:
 *             template = 'Strength({name!r}, {symbolic_weight!r}, is_required={is_required})'             # <<<<<<<<<<<<<<
 *         else:
 *             template = 'Strength({name!r}, {symbolic_weight!r})'
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
    __pyx_v_template = ((PyObject *)__pyx_kp_s_2);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "casuarius.pyx":174
 *             template = 'Strength({name!r}, {symbolic_weight!r}, is_required={is_required})'
 *         else:
 *             template = 'Strength({name!r}, {symbolic_weight!r})'             # <<<<<<<<<<<<<<
 *         return template.format(name=self.name, symbolic_weight=self.symbolic_weight, is_required=self.is_required)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
    __pyx_v_template = ((PyObject *)__pyx_kp_s_3);
  }
  __pyx_L5:;

  /* "casuarius.pyx":175
 *         else:
 *             template = 'Strength({name!r}, {symbolic_weight!r})'
 *         return template.format(name=self.name, symbolic_weight=self.symbolic_weight, is_required=self.is_required)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_template, __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__name), ((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->name)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__symbolic_weight), ((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->symbolic_weight)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyBool_FromLong(((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->is_required); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__is_required), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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("casuarius.Strength.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_template);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":177
 *         return template.format(name=self.name, symbolic_weight=self.symbolic_weight, is_required=self.is_required)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return repr(self.name)
 * 
 */

static PyObject *__pyx_pf_9casuarius_8Strength_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_8Strength_3__str__(PyObject *__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("__str__");

  /* "casuarius.pyx":178
 * 
 *     def __str__(self):
 *         return repr(self.name)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->name);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __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;

  __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("casuarius.Strength.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":180
 *         return repr(self.name)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return id(self)
 * 
 */

static Py_hash_t __pyx_pf_9casuarius_8Strength_4__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pf_9casuarius_8Strength_4__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_hash_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__");

  /* "casuarius.pyx":181
 * 
 *     def __hash__(self):
 *         return id(self)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsHash_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_hash_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("casuarius.Strength.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":157
 * cdef class Strength:
 *     cdef ClStrength *strength
 *     cdef readonly bytes name             # <<<<<<<<<<<<<<
 *     cdef readonly SymbolicWeight symbolic_weight
 *     cdef readonly bint is_required
 */

static PyObject *__pyx_pf_9casuarius_8Strength_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_8Strength_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->name));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->name);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":158
 *     cdef ClStrength *strength
 *     cdef readonly bytes name
 *     cdef readonly SymbolicWeight symbolic_weight             # <<<<<<<<<<<<<<
 *     cdef readonly bint is_required
 * 
 */

static PyObject *__pyx_pf_9casuarius_8Strength_15symbolic_weight___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_8Strength_15symbolic_weight___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->symbolic_weight));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->symbolic_weight);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":159
 *     cdef readonly bytes name
 *     cdef readonly SymbolicWeight symbolic_weight
 *     cdef readonly bint is_required             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, bytes name, SymbolicWeight symbolic_weight, bint is_required=False):
 */

static PyObject *__pyx_pf_9casuarius_8Strength_11is_required___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_8Strength_11is_required___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_9casuarius_Strength *)__pyx_v_self)->is_required); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.Strength.is_required.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":197
 * 
 * 
 * cdef bint almost_equal(double a, double b, double eps=1e-8):             # <<<<<<<<<<<<<<
 *     return fabs(a - b) < eps
 * 
 */

static int __pyx_f_9casuarius_almost_equal(double __pyx_v_a, double __pyx_v_b, struct __pyx_opt_args_9casuarius_almost_equal *__pyx_optional_args) {
  double __pyx_v_eps = ((double)1e-8);
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("almost_equal");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_eps = __pyx_optional_args->eps;
    }
  }

  /* "casuarius.pyx":198
 * 
 * cdef bint almost_equal(double a, double b, double eps=1e-8):
 *     return fabs(a - b) < eps             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = (fabs((__pyx_v_a - __pyx_v_b)) < __pyx_v_eps);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":203
 * cdef class LinearSymbolic:
 * 
 *     def nonlinear(self, msg):             # <<<<<<<<<<<<<<
 *         raise TypeError('Non-linear expression: %s' % msg)
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_nonlinear(PyObject *__pyx_v_self, PyObject *__pyx_v_msg); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_nonlinear(PyObject *__pyx_v_self, PyObject *__pyx_v_msg) {
  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("nonlinear");

  /* "casuarius.pyx":204
 * 
 *     def nonlinear(self, msg):
 *         raise TypeError('Non-linear expression: %s' % msg)             # <<<<<<<<<<<<<<
 * 
 *     def nonlinear_op(self, op):
 */
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __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("casuarius.LinearSymbolic.nonlinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":206
 *         raise TypeError('Non-linear expression: %s' % msg)
 * 
 *     def nonlinear_op(self, op):             # <<<<<<<<<<<<<<
 *         raise TypeError('Non-linear operator: `%s`' % op)
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_1nonlinear_op(PyObject *__pyx_v_self, PyObject *__pyx_v_op); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_1nonlinear_op(PyObject *__pyx_v_self, PyObject *__pyx_v_op) {
  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("nonlinear_op");

  /* "casuarius.pyx":207
 * 
 *     def nonlinear_op(self, op):
 *         raise TypeError('Non-linear operator: `%s`' % op)             # <<<<<<<<<<<<<<
 * 
 *     def convert_to_csw(self):
 */
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __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("casuarius.LinearSymbolic.nonlinear_op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":209
 *         raise TypeError('Non-linear operator: `%s`' % op)
 * 
 *     def convert_to_csw(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_2convert_to_csw(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_2convert_to_csw(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_to_csw");

  /* "casuarius.pyx":210
 * 
 *     def convert_to_csw(self):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearSymbolic.convert_to_csw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":212
 *         raise NotImplementedError
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "casuarius.pyx":213
 * 
 *     def __repr__(self):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def __add__(self, other):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearSymbolic.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":215
 *         raise NotImplementedError
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_4__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_4__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__");

  /* "casuarius.pyx":216
 * 
 *     def __add__(self, other):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, other):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearSymbolic.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":218
 *         raise NotImplementedError
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_5__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_5__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__");

  /* "casuarius.pyx":219
 * 
 *     def __mul__(self, other):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def __div__(self, other):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearSymbolic.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":221
 *         raise NotImplementedError
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_6__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_6__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__");

  /* "casuarius.pyx":222
 * 
 *     def __div__(self, other):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearSymbolic.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "casuarius.pyx":224
 *         raise NotImplementedError
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.__repr__()
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_7__str__(PyObject *__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("__str__");

  /* "casuarius.pyx":225
 * 
 *     def __str__(self):
 *         return self.__repr__()             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____repr__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __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;

  __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("casuarius.LinearSymbolic.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":227
 *         return self.__repr__()
 * 
 *     def __sub__(self, other):             # <<<<<<<<<<<<<<
 *         return self + (-1.0 * other)
 * 
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_8__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_8__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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("__sub__");

  /* "casuarius.pyx":228
 * 
 *     def __sub__(self, other):
 *         return self + (-1.0 * other)             # <<<<<<<<<<<<<<
 * 
 *     def __floordiv__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(-1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_v_self, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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("casuarius.LinearSymbolic.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":230
 *         return self + (-1.0 * other)
 * 
 *     def __floordiv__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_9__floordiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_9__floordiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__floordiv__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":231
 * 
 *     def __floordiv__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('//')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":232
 *     def __floordiv__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('//')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":233
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('//')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__floordiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":236
 * 
 * 
 *     def __mod__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_10__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_10__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mod__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":237
 * 
 *     def __mod__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('%')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":238
 *     def __mod__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('%')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":239
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('%')             # <<<<<<<<<<<<<<
 * 
 *     def __divmod__(self, other):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__mod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":241
 *         self.nonlinear_op('%')
 * 
 *     def __divmod__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_11__divmod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_11__divmod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__divmod__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":242
 * 
 *     def __divmod__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('divmod')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":243
 *     def __divmod__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('divmod')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":244
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('divmod')             # <<<<<<<<<<<<<<
 * 
 *     def __pow__(self, other, mod):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__divmod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":246
 *         self.nonlinear_op('divmod')
 * 
 *     def __pow__(self, other, mod):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_12__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_mod); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_12__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_mod) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pow__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":247
 * 
 *     def __pow__(self, other, mod):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('**')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":248
 *     def __pow__(self, other, mod):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('**')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":249
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('**')             # <<<<<<<<<<<<<<
 * 
 *     def __lshift__(self, other):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":251
 *         self.nonlinear_op('**')
 * 
 *     def __lshift__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_13__lshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_13__lshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__lshift__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":252
 * 
 *     def __lshift__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('<<')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":253
 *     def __lshift__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('<<')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":254
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('<<')             # <<<<<<<<<<<<<<
 * 
 *     def __rshift__(self, other):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__lshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":256
 *         self.nonlinear_op('<<')
 * 
 *     def __rshift__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_14__rshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_14__rshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__rshift__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":257
 * 
 *     def __rshift__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('>>')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":258
 *     def __rshift__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('>>')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":259
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('>>')             # <<<<<<<<<<<<<<
 * 
 *     def __and__(self, other):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__rshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":261
 *         self.nonlinear_op('>>')
 * 
 *     def __and__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_15__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_15__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__and__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":262
 * 
 *     def __and__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('&')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":263
 *     def __and__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('&')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":264
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('&')             # <<<<<<<<<<<<<<
 * 
 *     def __or__(self, other):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__and__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":266
 *         self.nonlinear_op('&')
 * 
 *     def __or__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_16__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_16__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__or__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":267
 * 
 *     def __or__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('|')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":268
 *     def __or__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('|')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":269
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('|')             # <<<<<<<<<<<<<<
 * 
 *     def __xor__(self, other):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__or__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":271
 *         self.nonlinear_op('|')
 * 
 *     def __xor__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_17__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_17__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__xor__");
  __Pyx_INCREF(__pyx_v_self);

  /* "casuarius.pyx":272
 * 
 *     def __xor__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self = other
 *         self.nonlinear_op('^')
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":273
 *     def __xor__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self = other             # <<<<<<<<<<<<<<
 *         self.nonlinear_op('^')
 * 
 */
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(__pyx_v_self);
    __pyx_v_self = __pyx_v_other;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":274
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('^')             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear_op); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __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_AddTraceback("casuarius.LinearSymbolic.__xor__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":276
 *         self.nonlinear_op('^')
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         if op == 0 or op == 4 or op == 3:
 *             raise ValueError('Invalid constraint operation.')
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_18__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_18__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__");

  /* "casuarius.pyx":283
 *         elif op == 1:
 *             return self._richcmp_le(other)
 *         elif op == 5:             # <<<<<<<<<<<<<<
 *             return self._richcmp_ge(other)
 * 
 */
  switch (__pyx_v_op) {

    /* "casuarius.pyx":277
 * 
 *     def __richcmp__(self, other, int op):
 *         if op == 0 or op == 4 or op == 3:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid constraint operation.')
 *         elif op == 2:
 */
    case 0:
    case 4:
    case 3:

    /* "casuarius.pyx":278
 *     def __richcmp__(self, other, int op):
 *         if op == 0 or op == 4 or op == 3:
 *             raise ValueError('Invalid constraint operation.')             # <<<<<<<<<<<<<<
 *         elif op == 2:
 *             return self._richcmp_eq(other)
 */
    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;

    /* "casuarius.pyx":279
 *         if op == 0 or op == 4 or op == 3:
 *             raise ValueError('Invalid constraint operation.')
 *         elif op == 2:             # <<<<<<<<<<<<<<
 *             return self._richcmp_eq(other)
 *         elif op == 1:
 */
    case 2:

    /* "casuarius.pyx":280
 *             raise ValueError('Invalid constraint operation.')
 *         elif op == 2:
 *             return self._richcmp_eq(other)             # <<<<<<<<<<<<<<
 *         elif op == 1:
 *             return self._richcmp_le(other)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___richcmp_eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "casuarius.pyx":281
 *         elif op == 2:
 *             return self._richcmp_eq(other)
 *         elif op == 1:             # <<<<<<<<<<<<<<
 *             return self._richcmp_le(other)
 *         elif op == 5:
 */
    case 1:

    /* "casuarius.pyx":282
 *             return self._richcmp_eq(other)
 *         elif op == 1:
 *             return self._richcmp_le(other)             # <<<<<<<<<<<<<<
 *         elif op == 5:
 *             return self._richcmp_ge(other)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___richcmp_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "casuarius.pyx":283
 *         elif op == 1:
 *             return self._richcmp_le(other)
 *         elif op == 5:             # <<<<<<<<<<<<<<
 *             return self._richcmp_ge(other)
 * 
 */
    case 5:

    /* "casuarius.pyx":284
 *             return self._richcmp_le(other)
 *         elif op == 5:
 *             return self._richcmp_ge(other)             # <<<<<<<<<<<<<<
 * 
 *     cpdef LinearConstraint _richcmp_le(self, other):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___richcmp_ge); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;
  }

  __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("casuarius.LinearSymbolic.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":286
 *             return self._richcmp_ge(other)
 * 
 *     cpdef LinearConstraint _richcmp_le(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_19_richcmp_le(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static struct __pyx_obj_9casuarius_LinearConstraint *__pyx_f_9casuarius_14LinearSymbolic__richcmp_le(struct __pyx_obj_9casuarius_LinearSymbolic *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_rhs = NULL;
  PyObject *__pyx_v_msg = NULL;
  struct __pyx_obj_9casuarius_LinearConstraint *__pyx_r = NULL;
  __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;
  int __pyx_t_6;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_richcmp_le");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___richcmp_le); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9casuarius_14LinearSymbolic_19_richcmp_le)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9casuarius_LinearConstraint))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "casuarius.pyx":287
 * 
 *     cpdef LinearConstraint _richcmp_le(self, other):
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_4 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_4) {
    __pyx_t_5 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = PyLong_Check(__pyx_t_1); 
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "casuarius.pyx":288
 *     cpdef LinearConstraint _richcmp_le(self, other):
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))             # <<<<<<<<<<<<<<
 *         elif isinstance(other, LinearSymbolic):
 *             rhs = other
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_rhs = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "casuarius.pyx":289
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             rhs = other
 *         else:
 */
  __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "casuarius.pyx":290
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):
 *             rhs = other             # <<<<<<<<<<<<<<
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 */
    __Pyx_INCREF(__pyx_v_other);
    __pyx_v_rhs = __pyx_v_other;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "casuarius.pyx":292
 *             rhs = other
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)             # <<<<<<<<<<<<<<
 *             raise TypeError(msg)
 *         return LEConstraint(self, rhs)
 */
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_v_msg = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "casuarius.pyx":293
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 *             raise TypeError(msg)             # <<<<<<<<<<<<<<
 *         return LEConstraint(self, rhs)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "casuarius.pyx":294
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 *             raise TypeError(msg)
 *         return LEConstraint(self, rhs)             # <<<<<<<<<<<<<<
 * 
 *     cpdef LinearConstraint _richcmp_ge(self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_rhs);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_rhs);
  __Pyx_GIVEREF(__pyx_v_rhs);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LEConstraint)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)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("casuarius.LinearSymbolic._richcmp_le", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rhs);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":286
 *             return self._richcmp_ge(other)
 * 
 *     cpdef LinearConstraint _richcmp_le(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_19_richcmp_le(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_19_richcmp_le(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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("_richcmp_le");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_9casuarius_LinearSymbolic *)((struct __pyx_obj_9casuarius_LinearSymbolic *)__pyx_v_self)->__pyx_vtab)->_richcmp_le(((struct __pyx_obj_9casuarius_LinearSymbolic *)__pyx_v_self), __pyx_v_other, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.LinearSymbolic._richcmp_le", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":296
 *         return LEConstraint(self, rhs)
 * 
 *     cpdef LinearConstraint _richcmp_ge(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_20_richcmp_ge(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static struct __pyx_obj_9casuarius_LinearConstraint *__pyx_f_9casuarius_14LinearSymbolic__richcmp_ge(struct __pyx_obj_9casuarius_LinearSymbolic *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_rhs = NULL;
  PyObject *__pyx_v_msg = NULL;
  struct __pyx_obj_9casuarius_LinearConstraint *__pyx_r = NULL;
  __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;
  int __pyx_t_6;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_richcmp_ge");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___richcmp_ge); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9casuarius_14LinearSymbolic_20_richcmp_ge)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9casuarius_LinearConstraint))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "casuarius.pyx":297
 * 
 *     cpdef LinearConstraint _richcmp_ge(self, other):
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_4 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_4) {
    __pyx_t_5 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = PyLong_Check(__pyx_t_1); 
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "casuarius.pyx":298
 *     cpdef LinearConstraint _richcmp_ge(self, other):
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))             # <<<<<<<<<<<<<<
 *         elif isinstance(other, LinearSymbolic):
 *             rhs = other
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_rhs = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "casuarius.pyx":299
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             rhs = other
 *         else:
 */
  __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "casuarius.pyx":300
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):
 *             rhs = other             # <<<<<<<<<<<<<<
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 */
    __Pyx_INCREF(__pyx_v_other);
    __pyx_v_rhs = __pyx_v_other;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "casuarius.pyx":302
 *             rhs = other
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)             # <<<<<<<<<<<<<<
 *             raise TypeError(msg)
 *         return GEConstraint(self, rhs)
 */
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_v_msg = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "casuarius.pyx":303
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 *             raise TypeError(msg)             # <<<<<<<<<<<<<<
 *         return GEConstraint(self, rhs)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "casuarius.pyx":304
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 *             raise TypeError(msg)
 *         return GEConstraint(self, rhs)             # <<<<<<<<<<<<<<
 * 
 *     cpdef LinearConstraint _richcmp_eq(self, other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_rhs);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_rhs);
  __Pyx_GIVEREF(__pyx_v_rhs);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_GEConstraint)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)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("casuarius.LinearSymbolic._richcmp_ge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rhs);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":296
 *         return LEConstraint(self, rhs)
 * 
 *     cpdef LinearConstraint _richcmp_ge(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_20_richcmp_ge(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_20_richcmp_ge(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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("_richcmp_ge");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_9casuarius_LinearSymbolic *)((struct __pyx_obj_9casuarius_LinearSymbolic *)__pyx_v_self)->__pyx_vtab)->_richcmp_ge(((struct __pyx_obj_9casuarius_LinearSymbolic *)__pyx_v_self), __pyx_v_other, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.LinearSymbolic._richcmp_ge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":306
 *         return GEConstraint(self, rhs)
 * 
 *     cpdef LinearConstraint _richcmp_eq(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_21_richcmp_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static struct __pyx_obj_9casuarius_LinearConstraint *__pyx_f_9casuarius_14LinearSymbolic__richcmp_eq(struct __pyx_obj_9casuarius_LinearSymbolic *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_rhs = NULL;
  PyObject *__pyx_v_msg = NULL;
  struct __pyx_obj_9casuarius_LinearConstraint *__pyx_r = NULL;
  __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;
  int __pyx_t_6;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_richcmp_eq");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___richcmp_eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9casuarius_14LinearSymbolic_21_richcmp_eq)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9casuarius_LinearConstraint))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "casuarius.pyx":307
 * 
 *     cpdef LinearConstraint _richcmp_eq(self, other):
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_4 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_4) {
    __pyx_t_5 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = PyLong_Check(__pyx_t_1); 
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "casuarius.pyx":308
 *     cpdef LinearConstraint _richcmp_eq(self, other):
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))             # <<<<<<<<<<<<<<
 *         elif isinstance(other, LinearSymbolic):
 *             rhs = other
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_rhs = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "casuarius.pyx":309
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             rhs = other
 *         else:
 */
  __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "casuarius.pyx":310
 *             rhs = LinearExpression([], float(other))
 *         elif isinstance(other, LinearSymbolic):
 *             rhs = other             # <<<<<<<<<<<<<<
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 */
    __Pyx_INCREF(__pyx_v_other);
    __pyx_v_rhs = __pyx_v_other;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "casuarius.pyx":312
 *             rhs = other
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)             # <<<<<<<<<<<<<<
 *             raise TypeError(msg)
 *         return EQConstraint(self, rhs)
 */
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_v_msg = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "casuarius.pyx":313
 *         else:
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 *             raise TypeError(msg)             # <<<<<<<<<<<<<<
 *         return EQConstraint(self, rhs)
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "casuarius.pyx":314
 *             msg = 'Invalid type for constraint operation %s' % type(other)
 *             raise TypeError(msg)
 *         return EQConstraint(self, rhs)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_rhs);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_rhs);
  __Pyx_GIVEREF(__pyx_v_rhs);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_EQConstraint)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_9casuarius_LinearConstraint *)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("casuarius.LinearSymbolic._richcmp_eq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rhs);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":306
 *         return GEConstraint(self, rhs)
 * 
 *     cpdef LinearConstraint _richcmp_eq(self, other):             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             rhs = LinearExpression([], float(other))
 */

static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_21_richcmp_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_14LinearSymbolic_21_richcmp_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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("_richcmp_eq");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_9casuarius_LinearSymbolic *)((struct __pyx_obj_9casuarius_LinearSymbolic *)__pyx_v_self)->__pyx_vtab)->_richcmp_eq(((struct __pyx_obj_9casuarius_LinearSymbolic *)__pyx_v_self), __pyx_v_other, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.LinearSymbolic._richcmp_eq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":316
 *         return EQConstraint(self, rhs)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return id(self)
 * 
 */

static Py_hash_t __pyx_pf_9casuarius_14LinearSymbolic_22__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pf_9casuarius_14LinearSymbolic_22__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_hash_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__");

  /* "casuarius.pyx":317
 * 
 *     def __hash__(self):
 *         return id(self)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsHash_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_hash_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("casuarius.LinearSymbolic.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":324
 *     cdef readonly bytes name
 * 
 *     def __cinit__(self, bytes name, double value=0.0):             # <<<<<<<<<<<<<<
 *         self.variable = new ClVariable(string(<char*>name), value)
 *         self.name = name
 */

static int __pyx_pf_9casuarius_18ConstraintVariable___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_18ConstraintVariable___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  double __pyx_v_value;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__value,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_value = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_value = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.ConstraintVariable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyBytes_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":325
 * 
 *     def __cinit__(self, bytes name, double value=0.0):
 *         self.variable = new ClVariable(string(<char*>name), value)             # <<<<<<<<<<<<<<
 *         self.name = name
 * 
 */
  __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_name)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->variable = new Variable(std::string(((char *)__pyx_t_1)), __pyx_v_value);

  /* "casuarius.pyx":326
 *     def __cinit__(self, bytes name, double value=0.0):
 *         self.variable = new ClVariable(string(<char*>name), value)
 *         self.name = name             # <<<<<<<<<<<<<<
 * 
 *     property value:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_name));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name = __pyx_v_name;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.ConstraintVariable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":329
 * 
 *     property value:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.variable.Value()
 * 
 */

static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_5value___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_5value___get__(PyObject *__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__");

  /* "casuarius.pyx":330
 *     property value:
 *         def __get__(self):
 *             return self.variable.Value()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->variable->Value()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.ConstraintVariable.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":332
 *             return self.variable.Value()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self.variable
 * 
 */

static void __pyx_pf_9casuarius_18ConstraintVariable_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_9casuarius_18ConstraintVariable_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "casuarius.pyx":333
 * 
 *     def __dealloc__(self):
 *         del self.variable             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  delete ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->variable;

  __Pyx_RefNannyFinishContext();
}

/* "casuarius.pyx":335
 *         del self.variable
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'ConstraintVariable({0!r}, {1!r})'.format(self.name, self.variable.Value())
 * 
 */

static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_2__repr__(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "casuarius.pyx":336
 * 
 *     def __repr__(self):
 *         return 'ConstraintVariable({0!r}, {1!r})'.format(self.name, self.variable.Value())             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_26), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->variable->Value()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("casuarius.ConstraintVariable.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":338
 *         return 'ConstraintVariable({0!r}, {1!r})'.format(self.name, self.variable.Value())
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return '{0}:{1}'.format(self.name, self.value)
 * 
 */

static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_3__str__(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__");

  /* "casuarius.pyx":339
 * 
 *     def __str__(self):
 *         return '{0}:{1}'.format(self.name, self.value)             # <<<<<<<<<<<<<<
 * 
 *     def __add__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_27), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("casuarius.ConstraintVariable.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":341
 *         return '{0}:{1}'.format(self.name, self.value)
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 */

static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_4__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_4__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_terms = NULL;
  double __pyx_v_const;
  PyObject *__pyx_v_expr = NULL;
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  double __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__");
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_other);

  /* "casuarius.pyx":342
 * 
 *     def __add__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":343
 *     def __add__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             terms = [Term(self)]
 */
    __pyx_t_4 = __pyx_v_other;
    __pyx_t_5 = __pyx_v_self;
    __pyx_v_self = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_other = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":344
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             terms = [Term(self)]
 *             const = float(other)
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":345
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 *             terms = [Term(self)]             # <<<<<<<<<<<<<<
 *             const = float(other)
 *             expr = LinearExpression(terms, const)
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_v_terms = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "casuarius.pyx":346
 *         if isinstance(other, (float, int, long)):
 *             terms = [Term(self)]
 *             const = float(other)             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms, const)
 *         elif isinstance(other, Term):
 */
    __pyx_t_8 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_8 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_const = __pyx_t_8;

    /* "casuarius.pyx":347
 *             terms = [Term(self)]
 *             const = float(other)
 *             expr = LinearExpression(terms, const)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, Term):
 *             terms = [Term(self), other]
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_const); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_expr = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":348
 *             const = float(other)
 *             expr = LinearExpression(terms, const)
 *         elif isinstance(other, Term):             # <<<<<<<<<<<<<<
 *             terms = [Term(self), other]
 *             expr = LinearExpression(terms)
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":349
 *             expr = LinearExpression(terms, const)
 *         elif isinstance(other, Term):
 *             terms = [Term(self), other]             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, ConstraintVariable):
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_other);
    PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_7 = 0;
    __pyx_v_terms = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "casuarius.pyx":350
 *         elif isinstance(other, Term):
 *             terms = [Term(self), other]
 *             expr = LinearExpression(terms)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, ConstraintVariable):
 *             terms = [Term(self), Term(other)]
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_expr = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":351
 *             terms = [Term(self), other]
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, ConstraintVariable):             # <<<<<<<<<<<<<<
 *             terms = [Term(self), Term(other)]
 *             expr = LinearExpression(terms)
 */
  __pyx_t_7 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable));
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_7); 
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":352
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, ConstraintVariable):
 *             terms = [Term(self), Term(other)]             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, LinearExpression):
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __pyx_t_1 = 0;
    __pyx_t_9 = 0;
    __pyx_v_terms = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "casuarius.pyx":353
 *         elif isinstance(other, ConstraintVariable):
 *             terms = [Term(self), Term(other)]
 *             expr = LinearExpression(terms)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, LinearExpression):
 *             expr = other + self
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_expr = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":354
 *             terms = [Term(self), Term(other)]
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, LinearExpression):             # <<<<<<<<<<<<<<
 *             expr = other + self
 *         else:
 */
  __pyx_t_9 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression));
  __Pyx_INCREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_9); 
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":355
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, LinearExpression):
 *             expr = other + self             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_9 = PyNumber_Add(__pyx_v_other, __pyx_v_self); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_expr = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":357
 *             expr = other + self
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":358
 *         else:
 *             return NotImplemented
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("casuarius.ConstraintVariable.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_terms);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":360
 *         return expr
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 */

static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_5__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_5__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_9casuarius_Term *__pyx_v_res = NULL;
  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;
  int __pyx_t_6;
  double __pyx_t_7;
  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("__mul__");
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_other);

  /* "casuarius.pyx":361
 * 
 *     def __mul__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":362
 *     def __mul__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             res = Term(self, float(other))
 */
    __pyx_t_4 = __pyx_v_other;
    __pyx_t_5 = __pyx_v_self;
    __pyx_v_self = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_other = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":363
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             res = Term(self, float(other))
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":364
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 *             res = Term(self, float(other))             # <<<<<<<<<<<<<<
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 */
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyFloat_FromDouble(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_res = ((struct __pyx_obj_9casuarius_Term *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":365
 *         if isinstance(other, (float, int, long)):
 *             res = Term(self, float(other))
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):             # <<<<<<<<<<<<<<
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 *         else:
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_9casuarius_Term)); 
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable)); 
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_9casuarius_LinearExpression)); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "casuarius.pyx":366
 *             res = Term(self, float(other))
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":368
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":369
 *         else:
 *             return NotImplemented
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __div__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("casuarius.ConstraintVariable.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":371
 *         return res
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 */

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_6__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_6__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_res = NULL;
  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;
  int __pyx_t_6;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__");

  /* "casuarius.pyx":372
 * 
 *     def __div__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         if isinstance(other, (float, int)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":373
 *     def __div__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int)):
 *             res = (1.0 / float(other)) * self
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":374
 *         if not isinstance(self, LinearSymbolic):
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         if isinstance(other, (float, int)):             # <<<<<<<<<<<<<<
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_5 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_5); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_5); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {

    /* "casuarius.pyx":375
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         if isinstance(other, (float, int)):
 *             res = (1.0 / float(other)) * self             # <<<<<<<<<<<<<<
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 */
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (unlikely(__pyx_t_7 == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = PyFloat_FromDouble((1.0 / __pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_res = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":376
 *         if isinstance(other, (float, int)):
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):             # <<<<<<<<<<<<<<
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         else:
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_4 = __pyx_v_other;
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_4, ((PyObject*)__pyx_ptype_9casuarius_Term)); 
  if (!__pyx_t_6) {
    __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_4, ((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable)); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_4, ((PyObject*)__pyx_ptype_9casuarius_LinearExpression)); 
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "casuarius.pyx":377
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":379
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":380
 *         else:
 *             return NotImplemented
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  __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_AddTraceback("casuarius.ConstraintVariable.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "casuarius.pyx":322
 * cdef class ConstraintVariable(LinearSymbolic):
 *     cdef ClVariable *variable
 *     cdef readonly bytes name             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, bytes name, double value=0.0):
 */

static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_18ConstraintVariable_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_self)->name);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":387
 *     cdef public double coeff
 * 
 *     def __cinit__(self, ConstraintVariable var, double coeff=1.0):             # <<<<<<<<<<<<<<
 *         self.var = var
 *         self.coeff = coeff
 */

static int __pyx_pf_9casuarius_4Term___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_4Term___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_9casuarius_ConstraintVariable *__pyx_v_var = 0;
  double __pyx_v_coeff;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__var,&__pyx_n_s__coeff,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__var);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coeff);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_var = ((struct __pyx_obj_9casuarius_ConstraintVariable *)values[0]);
    if (values[1]) {
      __pyx_v_coeff = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_coeff == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_coeff = ((double)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.Term.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_var), __pyx_ptype_9casuarius_ConstraintVariable, 1, "var", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":388
 * 
 *     def __cinit__(self, ConstraintVariable var, double coeff=1.0):
 *         self.var = var             # <<<<<<<<<<<<<<
 *         self.coeff = coeff
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_var));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_var));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var));
  ((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var = __pyx_v_var;

  /* "casuarius.pyx":389
 *     def __cinit__(self, ConstraintVariable var, double coeff=1.0):
 *         self.var = var
 *         self.coeff = coeff             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  ((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->coeff = __pyx_v_coeff;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Term.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":391
 *         self.coeff = coeff
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'Term({0!r}, {1!r})'.format(self.var, self.coeff)
 * 
 */

static PyObject *__pyx_pf_9casuarius_4Term_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_4Term_1__repr__(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "casuarius.pyx":392
 * 
 *     def __repr__(self):
 *         return 'Term({0!r}, {1!r})'.format(self.var, self.coeff)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_30), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->coeff); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("casuarius.Term.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":394
 *         return 'Term({0!r}, {1!r})'.format(self.var, self.coeff)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         if self.coeff == 1.0:
 *             template = '{name}:{value}'
 */

static PyObject *__pyx_pf_9casuarius_4Term_2__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_4Term_2__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_template = 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__");

  /* "casuarius.pyx":395
 * 
 *     def __str__(self):
 *         if self.coeff == 1.0:             # <<<<<<<<<<<<<<
 *             template = '{name}:{value}'
 *         elif self.coeff == -1.0:
 */
  __pyx_t_1 = (((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->coeff == 1.0);
  if (__pyx_t_1) {

    /* "casuarius.pyx":396
 *     def __str__(self):
 *         if self.coeff == 1.0:
 *             template = '{name}:{value}'             # <<<<<<<<<<<<<<
 *         elif self.coeff == -1.0:
 *             template = '-{name}:{value}'
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
    __pyx_v_template = ((PyObject *)__pyx_kp_s_31);
    goto __pyx_L5;
  }

  /* "casuarius.pyx":397
 *         if self.coeff == 1.0:
 *             template = '{name}:{value}'
 *         elif self.coeff == -1.0:             # <<<<<<<<<<<<<<
 *             template = '-{name}:{value}'
 *         else:
 */
  __pyx_t_1 = (((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->coeff == -1.0);
  if (__pyx_t_1) {

    /* "casuarius.pyx":398
 *             template = '{name}:{value}'
 *         elif self.coeff == -1.0:
 *             template = '-{name}:{value}'             # <<<<<<<<<<<<<<
 *         else:
 *             template = '{coeff} * {name}:{value}'
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
    __pyx_v_template = ((PyObject *)__pyx_kp_s_32);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "casuarius.pyx":400
 *             template = '-{name}:{value}'
 *         else:
 *             template = '{coeff} * {name}:{value}'             # <<<<<<<<<<<<<<
 *         return template.format(coeff=self.coeff, name=self.var.name, value=self.var.value)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
    __pyx_v_template = ((PyObject *)__pyx_kp_s_33);
  }
  __pyx_L5:;

  /* "casuarius.pyx":401
 *         else:
 *             template = '{coeff} * {name}:{value}'
 *         return template.format(coeff=self.coeff, name=self.var.name, value=self.var.value)             # <<<<<<<<<<<<<<
 * 
 *     def __add__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_template, __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->coeff); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__coeff), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__name), ((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var->name)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var), __pyx_n_s__value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__value), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __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_AddTraceback("casuarius.Term.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_template);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":403
 *         return template.format(coeff=self.coeff, name=self.var.name, value=self.var.value)
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 */

static PyObject *__pyx_pf_9casuarius_4Term_3__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_4Term_3__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_terms = NULL;
  double __pyx_v_const;
  PyObject *__pyx_v_expr = NULL;
  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;
  int __pyx_t_6;
  double __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__");
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_other);

  /* "casuarius.pyx":404
 * 
 *     def __add__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":405
 *     def __add__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             terms = [self]
 */
    __pyx_t_4 = __pyx_v_other;
    __pyx_t_5 = __pyx_v_self;
    __pyx_v_self = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_other = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":406
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             terms = [self]
 *             const = float(other)
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":407
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 *             terms = [self]             # <<<<<<<<<<<<<<
 *             const = float(other)
 *             expr = LinearExpression(terms, const)
 */
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_self);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_v_terms = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "casuarius.pyx":408
 *         if isinstance(other, (float, int, long)):
 *             terms = [self]
 *             const = float(other)             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms, const)
 *         elif isinstance(other, Term):
 */
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_const = __pyx_t_7;

    /* "casuarius.pyx":409
 *             terms = [self]
 *             const = float(other)
 *             expr = LinearExpression(terms, const)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, Term):
 *             terms = [self, other]
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_const); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_expr = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":410
 *             const = float(other)
 *             expr = LinearExpression(terms, const)
 *         elif isinstance(other, Term):             # <<<<<<<<<<<<<<
 *             terms = [self, other]
 *             expr = LinearExpression(terms)
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":411
 *             expr = LinearExpression(terms, const)
 *         elif isinstance(other, Term):
 *             terms = [self, other]             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, ConstraintVariable):
 */
    __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_self);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_v_terms = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "casuarius.pyx":412
 *         elif isinstance(other, Term):
 *             terms = [self, other]
 *             expr = LinearExpression(terms)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, ConstraintVariable):
 *             terms = [self, Term(other)]
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_expr = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":413
 *             terms = [self, other]
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, ConstraintVariable):             # <<<<<<<<<<<<<<
 *             terms = [self, Term(other)]
 *             expr = LinearExpression(terms)
 */
  __pyx_t_8 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable));
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_8); 
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":414
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, ConstraintVariable):
 *             terms = [self, Term(other)]             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, LinearExpression):
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_self);
    PyList_SET_ITEM(__pyx_t_8, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_v_terms = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "casuarius.pyx":415
 *         elif isinstance(other, ConstraintVariable):
 *             terms = [self, Term(other)]
 *             expr = LinearExpression(terms)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, LinearExpression):
 *             expr = other + self
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_expr = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":416
 *             terms = [self, Term(other)]
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, LinearExpression):             # <<<<<<<<<<<<<<
 *             expr = other + self
 *         else:
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":417
 *             expr = LinearExpression(terms)
 *         elif isinstance(other, LinearExpression):
 *             expr = other + self             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_1 = PyNumber_Add(__pyx_v_other, __pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_expr = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":419
 *             expr = other + self
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":420
 *         else:
 *             return NotImplemented
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("casuarius.Term.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_terms);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":422
 *         return expr
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 */

static PyObject *__pyx_pf_9casuarius_4Term_4__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_4Term_4__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_9casuarius_Term *__pyx_v_res = NULL;
  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;
  int __pyx_t_6;
  double __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  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("__mul__");
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_other);

  /* "casuarius.pyx":423
 * 
 *     def __mul__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":424
 *     def __mul__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             res = Term(self.var, float(other) * self.coeff)
 */
    __pyx_t_4 = __pyx_v_other;
    __pyx_t_5 = __pyx_v_self;
    __pyx_v_self = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_other = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":425
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             res = Term(self.var, float(other) * self.coeff)
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":426
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 *             res = Term(self.var, float(other) * self.coeff)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__var); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = PyFloat_FromDouble(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__coeff); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyNumber_Multiply(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_1 = 0;
    __pyx_t_10 = 0;
    __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_v_res = ((struct __pyx_obj_9casuarius_Term *)__pyx_t_10);
    __pyx_t_10 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":427
 *         if isinstance(other, (float, int, long)):
 *             res = Term(self.var, float(other) * self.coeff)
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):             # <<<<<<<<<<<<<<
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 *         else:
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_10 = __pyx_v_other;
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_10, ((PyObject*)__pyx_ptype_9casuarius_Term)); 
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_10, ((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable)); 
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_10, ((PyObject*)__pyx_ptype_9casuarius_LinearExpression)); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_6) {

    /* "casuarius.pyx":428
 *             res = Term(self.var, float(other) * self.coeff)
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":430
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":431
 *         else:
 *             return NotImplemented
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __div__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("casuarius.Term.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":433
 *         return res
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 */

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_9casuarius_4Term_5__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_4Term_5__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_res = NULL;
  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;
  int __pyx_t_6;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__");

  /* "casuarius.pyx":434
 * 
 *     def __div__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":435
 *     def __div__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             res = (1.0 / float(other)) * self
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":436
 *         if not isinstance(self, LinearSymbolic):
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_5 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_5); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_5); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_5); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":437
 *             other.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         if isinstance(other, (float, int, long)):
 *             res = (1.0 / float(other)) * self             # <<<<<<<<<<<<<<
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 */
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (unlikely(__pyx_t_7 == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = PyFloat_FromDouble((1.0 / __pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_res = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":438
 *         if isinstance(other, (float, int, long)):
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):             # <<<<<<<<<<<<<<
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         else:
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_4 = __pyx_v_other;
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_4, ((PyObject*)__pyx_ptype_9casuarius_Term)); 
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_4, ((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable)); 
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_4, ((PyObject*)__pyx_ptype_9casuarius_LinearExpression)); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {

    /* "casuarius.pyx":439
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":441
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":442
 *         else:
 *             return NotImplemented
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  __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_AddTraceback("casuarius.Term.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "casuarius.pyx":384
 * 
 * cdef class Term(LinearSymbolic):
 *     cdef public ConstraintVariable var             # <<<<<<<<<<<<<<
 *     cdef public double coeff
 * 
 */

static PyObject *__pyx_pf_9casuarius_4Term_3var___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_4Term_3var___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_4Term_3var_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_4Term_3var_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_9casuarius_ConstraintVariable))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var));
  ((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var = ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Term.var.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_4Term_3var_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_9casuarius_4Term_3var_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var));
  ((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->var = ((struct __pyx_obj_9casuarius_ConstraintVariable *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":385
 * cdef class Term(LinearSymbolic):
 *     cdef public ConstraintVariable var
 *     cdef public double coeff             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, ConstraintVariable var, double coeff=1.0):
 */

static PyObject *__pyx_pf_9casuarius_4Term_5coeff___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_4Term_5coeff___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->coeff); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.Term.coeff.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_4Term_5coeff_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_4Term_5coeff_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_9casuarius_Term *)__pyx_v_self)->coeff = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Term.coeff.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9casuarius_12reduce_terms_1generator1(struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */

/* "casuarius.pyx":453
 *         for term in terms:
 *             mapping[term.var] += term.coeff
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()             # <<<<<<<<<<<<<<
 *                       if not almost_equal(coeff, 0.0))
 *         return terms
 */

static PyObject *__pyx_pf_9casuarius_12reduce_terms_genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_9casuarius_12reduce_terms_genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr");
  __pyx_cur_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *)__pyx_ptype_9casuarius___pyx_scope_struct_3_genexpr->tp_new(__pyx_ptype_9casuarius___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *)__pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __pyx_self = __pyx_self;
  __pyx_cur_scope->__pyx_base.resume_label = 0;
  __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_9casuarius_12reduce_terms_1generator1;
  __Pyx_GIVEREF(__pyx_cur_scope);
  __Pyx_RefNannyFinishContext();
  return (PyObject *) __pyx_cur_scope;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9casuarius_12reduce_terms_1generator1(struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */
{
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  double __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None");
  switch (__pyx_cur_scope->__pyx_base.resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L9_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_mapping)) { __Pyx_RaiseClosureNameError("mapping"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_mapping, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __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_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_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_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_var);
    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_var);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_cur_scope->__pyx_v_var = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_coeff);
    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_coeff);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_cur_scope->__pyx_v_coeff = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "casuarius.pyx":454
 *             mapping[term.var] += term.coeff
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()
 *                       if not almost_equal(coeff, 0.0))             # <<<<<<<<<<<<<<
 *         return terms
 * 
 */
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_cur_scope->__pyx_v_coeff); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = (!__pyx_f_9casuarius_almost_equal(__pyx_t_9, 0.0, NULL));
    if (__pyx_t_10) {

      /* "casuarius.pyx":453
 *         for term in terms:
 *             mapping[term.var] += term.coeff
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()             # <<<<<<<<<<<<<<
 *                       if not almost_equal(coeff, 0.0))
 *         return terms
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_var);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_var);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_var);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_coeff);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_cur_scope->__pyx_v_coeff);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_coeff);
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      /* return from generator, yielding value */
      __pyx_cur_scope->__pyx_base.resume_label = 1;
      return __pyx_r;
      __pyx_L9_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_3 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  goto __pyx_L0;
  __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_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_cur_scope->__pyx_base.resume_label = -1;
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "casuarius.pyx":449
 *     cdef public double constant
 * 
 *     def reduce_terms(self, terms):             # <<<<<<<<<<<<<<
 *         mapping = defaultdict(float)
 *         for term in terms:
 */

static PyObject *__pyx_pf_9casuarius_16LinearExpression_reduce_terms(PyObject *__pyx_v_self, PyObject *__pyx_v_terms); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_reduce_terms(PyObject *__pyx_v_self, PyObject *__pyx_v_terms) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *__pyx_cur_scope;
  PyObject *__pyx_v_term = NULL;
  PyObject *__pyx_r = 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)(PyObject *);
  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("reduce_terms");
  __pyx_cur_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *)__pyx_ptype_9casuarius___pyx_scope_struct_2_reduce_terms->tp_new(__pyx_ptype_9casuarius___pyx_scope_struct_2_reduce_terms, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_INCREF(__pyx_v_terms);

  /* "casuarius.pyx":450
 * 
 *     def reduce_terms(self, terms):
 *         mapping = defaultdict(float)             # <<<<<<<<<<<<<<
 *         for term in terms:
 *             mapping[term.var] += term.coeff
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyFloat_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_mapping = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "casuarius.pyx":451
 *     def reduce_terms(self, terms):
 *         mapping = defaultdict(float)
 *         for term in terms:             # <<<<<<<<<<<<<<
 *             mapping[term.var] += term.coeff
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()
 */
  if (PyList_CheckExact(__pyx_v_terms) || PyTuple_CheckExact(__pyx_v_terms)) {
    __pyx_t_3 = __pyx_v_terms; __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_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_3)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else if (PyTuple_CheckExact(__pyx_t_3)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF(__pyx_v_term);
    __pyx_v_term = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "casuarius.pyx":452
 *         mapping = defaultdict(float)
 *         for term in terms:
 *             mapping[term.var] += term.coeff             # <<<<<<<<<<<<<<
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()
 *                       if not almost_equal(coeff, 0.0))
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_term, __pyx_n_s__var); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_mapping, __pyx_t_2); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_term, __pyx_n_s__coeff); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_mapping, __pyx_t_2, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "casuarius.pyx":453
 *         for term in terms:
 *             mapping[term.var] += term.coeff
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()             # <<<<<<<<<<<<<<
 *                       if not almost_equal(coeff, 0.0))
 *         return terms
 */
  __pyx_t_3 = __pyx_pf_9casuarius_12reduce_terms_genexpr(((PyObject*)__pyx_cur_scope), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_terms);
  __pyx_v_terms = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "casuarius.pyx":455
 *         terms = tuple(Term(var, coeff) for (var, coeff) in mapping.iteritems()
 *                       if not almost_equal(coeff, 0.0))
 *         return terms             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, terms, constant=0.0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_terms);
  __pyx_r = __pyx_v_terms;
  goto __pyx_L0;

  __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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("casuarius.LinearExpression.reduce_terms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_term);
  __Pyx_XDECREF(__pyx_v_terms);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":457
 *         return terms
 * 
 *     def __cinit__(self, terms, constant=0.0):             # <<<<<<<<<<<<<<
 *         self.terms = self.reduce_terms(terms)
 *         self.constant = constant
 */

static int __pyx_pf_9casuarius_16LinearExpression_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_16LinearExpression_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_terms = 0;
  PyObject *__pyx_v_constant = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__terms,&__pyx_n_s__constant,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_34;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__terms);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__constant);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_terms = values[0];
    __pyx_v_constant = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.LinearExpression.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":458
 * 
 *     def __cinit__(self, terms, constant=0.0):
 *         self.terms = self.reduce_terms(terms)             # <<<<<<<<<<<<<<
 *         self.constant = constant
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reduce_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_terms);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_terms);
  __Pyx_GIVEREF(__pyx_v_terms);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms));
  ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "casuarius.pyx":459
 *     def __cinit__(self, terms, constant=0.0):
 *         self.terms = self.reduce_terms(terms)
 *         self.constant = constant             # <<<<<<<<<<<<<<
 * 
 *     property value:
 */
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_constant); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant = __pyx_t_4;

  __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_AddTraceback("casuarius.LinearExpression.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":462
 * 
 *     property value:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef double value=self.constant
 *             for term in self.terms:
 */

static PyObject *__pyx_pf_9casuarius_16LinearExpression_5value___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_5value___get__(PyObject *__pyx_v_self) {
  double __pyx_v_value;
  PyObject *__pyx_v_term = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "casuarius.pyx":463
 *     property value:
 *         def __get__(self):
 *             cdef double value=self.constant             # <<<<<<<<<<<<<<
 *             for term in self.terms:
 *                 value += term.coeff * term.var.value
 */
  __pyx_v_value = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant;

  /* "casuarius.pyx":464
 *         def __get__(self):
 *             cdef double value=self.constant
 *             for term in self.terms:             # <<<<<<<<<<<<<<
 *                 value += term.coeff * term.var.value
 *             return value
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    __Pyx_XDECREF(__pyx_v_term);
    __pyx_v_term = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "casuarius.pyx":465
 *             cdef double value=self.constant
 *             for term in self.terms:
 *                 value += term.coeff * term.var.value             # <<<<<<<<<<<<<<
 *             return value
 * 
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_term, __pyx_n_s__coeff); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_term, __pyx_n_s__var); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_value = __pyx_t_7;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":466
 *             for term in self.terms:
 *                 value += term.coeff * term.var.value
 *             return value             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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("casuarius.LinearExpression.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_term);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_9casuarius_8__repr___1generator2(struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */

/* "casuarius.pyx":471
 *         if len(self.terms) > 0:
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))
 *             terms = ' + '.join(str(term) for term in s)             # <<<<<<<<<<<<<<
 *             if self.constant > 0.0:
 *                 terms += ' + %s' % self.constant
 */

static PyObject *__pyx_pf_9casuarius_8__repr___genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_9casuarius_8__repr___genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr");
  __pyx_cur_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *)__pyx_ptype_9casuarius___pyx_scope_struct_5_genexpr->tp_new(__pyx_ptype_9casuarius___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *)__pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __pyx_self = __pyx_self;
  __pyx_cur_scope->__pyx_base.resume_label = 0;
  __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_9casuarius_8__repr___1generator2;
  __Pyx_GIVEREF(__pyx_cur_scope);
  __Pyx_RefNannyFinishContext();
  return (PyObject *) __pyx_cur_scope;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_9casuarius_8__repr___1generator2(struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */
{
  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;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None");
  switch (__pyx_cur_scope->__pyx_base.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)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_s)) { __Pyx_RaiseClosureNameError("s"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_s) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_s)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_s; __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_outer_scope->__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_term);
    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_term);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_cur_scope->__pyx_v_term = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_term);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_term);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_term);
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 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();
    /* return from generator, yielding value */
    __pyx_cur_scope->__pyx_base.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_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_cur_scope->__pyx_base.resume_label = -1;
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "casuarius.pyx":468
 *             return value
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         if len(self.terms) > 0:
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))
 */

static PyObject *__pyx_pf_9casuarius_16LinearExpression_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_2__repr__(PyObject *__pyx_v_self) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *__pyx_cur_scope;
  PyObject *__pyx_v_terms = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");
  __pyx_cur_scope = (struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *)__pyx_ptype_9casuarius___pyx_scope_struct_4___repr__->tp_new(__pyx_ptype_9casuarius___pyx_scope_struct_4___repr__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);

  /* "casuarius.pyx":469
 * 
 *     def __repr__(self):
 *         if len(self.terms) > 0:             # <<<<<<<<<<<<<<
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))
 *             terms = ' + '.join(str(term) for term in s)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 > 0);
  if (__pyx_t_3) {

    /* "casuarius.pyx":470
 *     def __repr__(self):
 *         if len(self.terms) > 0:
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))             # <<<<<<<<<<<<<<
 *             terms = ' + '.join(str(term) for term in s)
 *             if self.constant > 0.0:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms));
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__operator); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__attrgetter); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__key), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_cur_scope->__pyx_v_s = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "casuarius.pyx":471
 *         if len(self.terms) > 0:
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))
 *             terms = ' + '.join(str(term) for term in s)             # <<<<<<<<<<<<<<
 *             if self.constant > 0.0:
 *                 terms += ' + %s' % self.constant
 */
    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_37), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __pyx_pf_9casuarius_8__repr___genexpr(((PyObject*)__pyx_cur_scope), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_terms = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "casuarius.pyx":472
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))
 *             terms = ' + '.join(str(term) for term in s)
 *             if self.constant > 0.0:             # <<<<<<<<<<<<<<
 *                 terms += ' + %s' % self.constant
 *             elif self.constant < 0.0:
 */
    __pyx_t_3 = (((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant > 0.0);
    if (__pyx_t_3) {

      /* "casuarius.pyx":473
 *             terms = ' + '.join(str(term) for term in s)
 *             if self.constant > 0.0:
 *                 terms += ' + %s' % self.constant             # <<<<<<<<<<<<<<
 *             elif self.constant < 0.0:
 *                 terms += ' - %s' % -self.constant
 */
      __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_terms, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_terms);
      __pyx_v_terms = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L6;
    }

    /* "casuarius.pyx":474
 *             if self.constant > 0.0:
 *                 terms += ' + %s' % self.constant
 *             elif self.constant < 0.0:             # <<<<<<<<<<<<<<
 *                 terms += ' - %s' % -self.constant
 *         else:
 */
    __pyx_t_3 = (((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant < 0.0);
    if (__pyx_t_3) {

      /* "casuarius.pyx":475
 *                 terms += ' + %s' % self.constant
 *             elif self.constant < 0.0:
 *                 terms += ' - %s' % -self.constant             # <<<<<<<<<<<<<<
 *         else:
 *             terms = str(self.constant)
 */
      __pyx_t_4 = PyFloat_FromDouble((-((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_terms, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_terms);
      __pyx_v_terms = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "casuarius.pyx":477
 *                 terms += ' - %s' % -self.constant
 *         else:
 *             terms = str(self.constant)             # <<<<<<<<<<<<<<
 *         return terms
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_terms = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L5:;

  /* "casuarius.pyx":478
 *         else:
 *             terms = str(self.constant)
 *         return terms             # <<<<<<<<<<<<<<
 * 
 *     def __add__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_terms);
  __pyx_r = __pyx_v_terms;
  goto __pyx_L0;

  __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_AddTraceback("casuarius.LinearExpression.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_terms);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":480
 *         return terms
 * 
 *     def __add__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 */

static PyObject *__pyx_pf_9casuarius_16LinearExpression_3__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_3__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_9casuarius_LinearExpression *__pyx_v_expr = NULL;
  PyObject *__pyx_v_terms = NULL;
  PyObject *__pyx_v_const = NULL;
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  double __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("__add__");
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_other);

  /* "casuarius.pyx":481
 * 
 *     def __add__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":482
 *     def __add__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             expr = LinearExpression(self.terms, self.constant + float(other))
 */
    __pyx_t_4 = __pyx_v_other;
    __pyx_t_5 = __pyx_v_self;
    __pyx_v_self = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_other = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":483
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(self.terms, self.constant + float(other))
 *         elif isinstance(other, Term):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":484
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 *             expr = LinearExpression(self.terms, self.constant + float(other))             # <<<<<<<<<<<<<<
 *         elif isinstance(other, Term):
 *             terms = list(self.terms) + [other]
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__constant); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_8 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyNumber_Add(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_1 = 0;
    __pyx_t_10 = 0;
    __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_v_expr = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_10);
    __pyx_t_10 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":485
 *         if isinstance(other, (float, int, long)):
 *             expr = LinearExpression(self.terms, self.constant + float(other))
 *         elif isinstance(other, Term):             # <<<<<<<<<<<<<<
 *             terms = list(self.terms) + [other]
 *             expr = LinearExpression(terms, self.constant)
 */
  __pyx_t_10 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term));
  __Pyx_INCREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_10); 
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":486
 *             expr = LinearExpression(self.terms, self.constant + float(other))
 *         elif isinstance(other, Term):
 *             terms = list(self.terms) + [other]             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms, self.constant)
 *         elif isinstance(other, ConstraintVariable):
 */
    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__terms); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_INCREF(__pyx_v_other);
    PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_1 = PyNumber_Add(__pyx_t_10, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_v_terms = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "casuarius.pyx":487
 *         elif isinstance(other, Term):
 *             terms = list(self.terms) + [other]
 *             expr = LinearExpression(terms, self.constant)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, ConstraintVariable):
 *             terms = list(self.terms) + [Term(other)]
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__constant); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_v_expr = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":488
 *             terms = list(self.terms) + [other]
 *             expr = LinearExpression(terms, self.constant)
 *         elif isinstance(other, ConstraintVariable):             # <<<<<<<<<<<<<<
 *             terms = list(self.terms) + [Term(other)]
 *             expr = LinearExpression(terms, self.constant)
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":489
 *             expr = LinearExpression(terms, self.constant)
 *         elif isinstance(other, ConstraintVariable):
 *             terms = list(self.terms) + [Term(other)]             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms, self.constant)
 *         elif isinstance(other, LinearExpression):
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_v_terms = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "casuarius.pyx":490
 *         elif isinstance(other, ConstraintVariable):
 *             terms = list(self.terms) + [Term(other)]
 *             expr = LinearExpression(terms, self.constant)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, LinearExpression):
 *             terms = list(self.terms) + list(other.terms)
 */
    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__constant); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_v_expr = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_10);
    __pyx_t_10 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":491
 *             terms = list(self.terms) + [Term(other)]
 *             expr = LinearExpression(terms, self.constant)
 *         elif isinstance(other, LinearExpression):             # <<<<<<<<<<<<<<
 *             terms = list(self.terms) + list(other.terms)
 *             const = self.constant + other.constant
 */
  __pyx_t_10 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression));
  __Pyx_INCREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_10); 
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":492
 *             expr = LinearExpression(terms, self.constant)
 *         elif isinstance(other, LinearExpression):
 *             terms = list(self.terms) + list(other.terms)             # <<<<<<<<<<<<<<
 *             const = self.constant + other.constant
 *             expr = LinearExpression(terms, const)
 */
    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__terms); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__terms); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_terms = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "casuarius.pyx":493
 *         elif isinstance(other, LinearExpression):
 *             terms = list(self.terms) + list(other.terms)
 *             const = self.constant + other.constant             # <<<<<<<<<<<<<<
 *             expr = LinearExpression(terms, const)
 *         else:
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__constant); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__constant); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_const = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "casuarius.pyx":494
 *             terms = list(self.terms) + list(other.terms)
 *             const = self.constant + other.constant
 *             expr = LinearExpression(terms, const)             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    __Pyx_INCREF(__pyx_v_const);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_const);
    __Pyx_GIVEREF(__pyx_v_const);
    __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __pyx_v_expr = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_9);
    __pyx_t_9 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":496
 *             expr = LinearExpression(terms, const)
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":497
 *         else:
 *             return NotImplemented
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_expr));
  __pyx_r = ((PyObject *)__pyx_v_expr);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("casuarius.LinearExpression.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_terms);
  __Pyx_XDECREF(__pyx_v_const);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":499
 *         return expr
 * 
 *     def __mul__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 */

static PyObject *__pyx_pf_9casuarius_16LinearExpression_4__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_4__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_terms = NULL;
  PyObject *__pyx_v_const = NULL;
  struct __pyx_obj_9casuarius_LinearExpression *__pyx_v_res = NULL;
  PyObject *__pyx_v_term = NULL;
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__");
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_other);

  /* "casuarius.pyx":500
 * 
 *     def __mul__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":501
 *     def __mul__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             terms = [other * term for term in self.terms]
 */
    __pyx_t_4 = __pyx_v_other;
    __pyx_t_5 = __pyx_v_self;
    __pyx_v_self = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_other = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":502
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             terms = [other * term for term in self.terms]
 *             const = self.constant * other
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":503
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 *             terms = [other * term for term in self.terms]             # <<<<<<<<<<<<<<
 *             const = self.constant * other
 *             res = LinearExpression(terms, const)
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__terms); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
      __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (PyList_CheckExact(__pyx_t_8)) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break;
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
      } else if (PyTuple_CheckExact(__pyx_t_8)) {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
      } else {
        __pyx_t_7 = __pyx_t_10(__pyx_t_8);
        if (unlikely(!__pyx_t_7)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF(__pyx_v_term);
      __pyx_v_term = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_Multiply(__pyx_v_other, __pyx_v_term); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_t_1));
    __pyx_v_terms = __pyx_t_1;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

    /* "casuarius.pyx":504
 *         if isinstance(other, (float, int, long)):
 *             terms = [other * term for term in self.terms]
 *             const = self.constant * other             # <<<<<<<<<<<<<<
 *             res = LinearExpression(terms, const)
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__constant); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_const = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "casuarius.pyx":505
 *             terms = [other * term for term in self.terms]
 *             const = self.constant * other
 *             res = LinearExpression(terms, const)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 */
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(((PyObject *)__pyx_v_terms));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_terms));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
    __Pyx_INCREF(__pyx_v_const);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_const);
    __Pyx_GIVEREF(__pyx_v_const);
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_res = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":506
 *             const = self.constant * other
 *             res = LinearExpression(terms, const)
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):             # <<<<<<<<<<<<<<
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 *         else:
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_9casuarius_Term)); 
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable)); 
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_9casuarius_LinearExpression)); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "casuarius.pyx":507
 *             res = LinearExpression(terms, const)
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":509
 *             self.nonlinear('[ %s ] * [ %s ]' % (self, other))
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":510
 *         else:
 *             return NotImplemented
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __div__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("casuarius.LinearExpression.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_terms);
  __Pyx_XDECREF(__pyx_v_const);
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_term);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":512
 *         return res
 * 
 *     def __div__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 */

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_9casuarius_16LinearExpression_5__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_5__div__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_res = NULL;
  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;
  int __pyx_t_6;
  double __pyx_t_7;
  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("__div__");
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_other);

  /* "casuarius.pyx":513
 * 
 *     def __div__(self, other):
 *         if not isinstance(self, LinearSymbolic):             # <<<<<<<<<<<<<<
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearSymbolic));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "casuarius.pyx":514
 *     def __div__(self, other):
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self             # <<<<<<<<<<<<<<
 *         if isinstance(other, (float, int, long)):
 *             res = (1.0 / float(other)) * self
 */
    __pyx_t_4 = __pyx_v_other;
    __pyx_t_5 = __pyx_v_self;
    __pyx_v_self = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_other = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "casuarius.pyx":515
 *         if not isinstance(self, LinearSymbolic):
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_2 = PyInt_Check(__pyx_t_1); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":516
 *             self, other = other, self
 *         if isinstance(other, (float, int, long)):
 *             res = (1.0 / float(other)) * self             # <<<<<<<<<<<<<<
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 */
    __pyx_t_7 = __Pyx_PyObject_AsDouble(__pyx_v_other); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (unlikely(__pyx_t_7 == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = PyFloat_FromDouble((1.0 / __pyx_t_7)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_1, __pyx_v_self); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_res = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L6;
  }

  /* "casuarius.pyx":517
 *         if isinstance(other, (float, int, long)):
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):             # <<<<<<<<<<<<<<
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         else:
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_8 = __pyx_v_other;
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_8, ((PyObject*)__pyx_ptype_9casuarius_Term)); 
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_8, ((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable)); 
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_8, ((PyObject*)__pyx_ptype_9casuarius_LinearExpression)); 
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_6) {

    /* "casuarius.pyx":518
 *             res = (1.0 / float(other)) * self
 *         elif isinstance(other, (Term, ConstraintVariable, LinearExpression)):
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nonlinear); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "casuarius.pyx":520
 *             self.nonlinear('[ %s ] / [ %s ]' % (self, other))
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "casuarius.pyx":521
 *         else:
 *             return NotImplemented
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     cdef P_LinearExpression as_cl_linear_expression(self):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("casuarius.LinearExpression.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "casuarius.pyx":523
 *         return res
 * 
 *     cdef P_LinearExpression as_cl_linear_expression(self):             # <<<<<<<<<<<<<<
 *         """ Convert to a ClLinearExpression.
 *         """
 */

static P_LinearExpression __pyx_f_9casuarius_16LinearExpression_as_cl_linear_expression(struct __pyx_obj_9casuarius_LinearExpression *__pyx_v_self) {
  struct __pyx_obj_9casuarius_Term *__pyx_v_term = 0;
  P_LinearExpression __pyx_v_expr;
  P_LinearExpression __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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("as_cl_linear_expression");

  /* "casuarius.pyx":529
 *         cdef P_LinearExpression expr
 * 
 *         expr = newLinearExpression(self.constant)             # <<<<<<<<<<<<<<
 *         for term in self.terms:
 *             expr.AddVariable(deref(term.var.variable), term.coeff)
 */
  __pyx_v_expr = newLinearExpression(__pyx_v_self->constant);

  /* "casuarius.pyx":530
 * 
 *         expr = newLinearExpression(self.constant)
 *         for term in self.terms:             # <<<<<<<<<<<<<<
 *             expr.AddVariable(deref(term.var.variable), term.coeff)
 *         return expr
 */
  if (unlikely(((PyObject *)__pyx_v_self->terms) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_self->terms); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9casuarius_Term))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_term));
    __pyx_v_term = ((struct __pyx_obj_9casuarius_Term *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "casuarius.pyx":531
 *         expr = newLinearExpression(self.constant)
 *         for term in self.terms:
 *             expr.AddVariable(deref(term.var.variable), term.coeff)             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
    __pyx_v_expr->AddVariable((*__pyx_v_term->var->variable), __pyx_v_term->coeff);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":532
 *         for term in self.terms:
 *             expr.AddVariable(deref(term.var.variable), term.coeff)
 *         return expr             # <<<<<<<<<<<<<<
 * 
 * cdef LinearExpression as_linear_expression(obj):
 */
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("casuarius.LinearExpression.as_cl_linear_expression", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_term);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":446
 * 
 * cdef class LinearExpression(LinearSymbolic):
 *     cdef public tuple terms             # <<<<<<<<<<<<<<
 *     cdef public double constant
 * 
 */

static PyObject *__pyx_pf_9casuarius_16LinearExpression_5terms___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_5terms___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_16LinearExpression_5terms_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_16LinearExpression_5terms_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms));
  ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearExpression.terms.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_16LinearExpression_5terms_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_9casuarius_16LinearExpression_5terms_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms));
  ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->terms = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":447
 * cdef class LinearExpression(LinearSymbolic):
 *     cdef public tuple terms
 *     cdef public double constant             # <<<<<<<<<<<<<<
 * 
 *     def reduce_terms(self, terms):
 */

static PyObject *__pyx_pf_9casuarius_16LinearExpression_8constant___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearExpression_8constant___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.LinearExpression.constant.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_16LinearExpression_8constant_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_16LinearExpression_8constant_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_self)->constant = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearExpression.constant.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":534
 *         return expr
 * 
 * cdef LinearExpression as_linear_expression(obj):             # <<<<<<<<<<<<<<
 *     """ Cast any appropriate object to a LinearExpression.
 *     """
 */

static struct __pyx_obj_9casuarius_LinearExpression *__pyx_f_9casuarius_as_linear_expression(PyObject *__pyx_v_obj) {
  struct __pyx_obj_9casuarius_LinearExpression *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  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("as_linear_expression");
  __Pyx_INCREF(__pyx_v_obj);

  /* "casuarius.pyx":537
 *     """ Cast any appropriate object to a LinearExpression.
 *     """
 *     if isinstance(obj, LinearExpression):             # <<<<<<<<<<<<<<
 *         return obj
 *     elif isinstance(obj, (float, int, long)):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "casuarius.pyx":538
 *     """
 *     if isinstance(obj, LinearExpression):
 *         return obj             # <<<<<<<<<<<<<<
 *     elif isinstance(obj, (float, int, long)):
 *         obj = float(obj)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    if (!(likely(((__pyx_v_obj) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_obj, __pyx_ptype_9casuarius_LinearExpression))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_obj);
    __pyx_r = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_v_obj);
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "casuarius.pyx":539
 *     if isinstance(obj, LinearExpression):
 *         return obj
 *     elif isinstance(obj, (float, int, long)):             # <<<<<<<<<<<<<<
 *         obj = float(obj)
 *         return LinearExpression((), obj)
 */
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_t_1 = __pyx_v_obj;
  __pyx_t_2 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_2) {
    __pyx_t_3 = PyInt_Check(__pyx_t_1); 
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = PyLong_Check(__pyx_t_1); 
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "casuarius.pyx":540
 *         return obj
 *     elif isinstance(obj, (float, int, long)):
 *         obj = float(obj)             # <<<<<<<<<<<<<<
 *         return LinearExpression((), obj)
 *     elif isinstance(obj, ConstraintVariable):
 */
    __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_obj); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_obj);
    __pyx_v_obj = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "casuarius.pyx":541
 *     elif isinstance(obj, (float, int, long)):
 *         obj = float(obj)
 *         return LinearExpression((), obj)             # <<<<<<<<<<<<<<
 *     elif isinstance(obj, ConstraintVariable):
 *         return LinearExpression((Term(obj),))
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_empty_tuple));
    __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple));
    __Pyx_INCREF(__pyx_v_obj);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_obj);
    __Pyx_GIVEREF(__pyx_v_obj);
    __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "casuarius.pyx":542
 *         obj = float(obj)
 *         return LinearExpression((), obj)
 *     elif isinstance(obj, ConstraintVariable):             # <<<<<<<<<<<<<<
 *         return LinearExpression((Term(obj),))
 *     elif isinstance(obj, Term):
 */
  __pyx_t_6 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_ConstraintVariable));
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_6); 
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {

    /* "casuarius.pyx":543
 *         return LinearExpression((), obj)
 *     elif isinstance(obj, ConstraintVariable):
 *         return LinearExpression((Term(obj),))             # <<<<<<<<<<<<<<
 *     elif isinstance(obj, Term):
 *         return LinearExpression((obj,))
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_obj);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_obj);
    __Pyx_GIVEREF(__pyx_v_obj);
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "casuarius.pyx":544
 *     elif isinstance(obj, ConstraintVariable):
 *         return LinearExpression((Term(obj),))
 *     elif isinstance(obj, Term):             # <<<<<<<<<<<<<<
 *         return LinearExpression((obj,))
 *     else:
 */
  __pyx_t_6 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Term));
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_6); 
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {

    /* "casuarius.pyx":545
 *         return LinearExpression((Term(obj),))
 *     elif isinstance(obj, Term):
 *         return LinearExpression((obj,))             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("Cannot cast {0!r}, a {1!r}, to LinearExpression.".format(obj, type(obj)))
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_obj);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_obj);
    __Pyx_GIVEREF(__pyx_v_obj);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearExpression)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "casuarius.pyx":547
 *         return LinearExpression((obj,))
 *     else:
 *         raise TypeError("Cannot cast {0!r}, a {1!r}, to LinearExpression.".format(obj, type(obj)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_40), __pyx_n_s__format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_obj);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_obj);
    __Pyx_GIVEREF(__pyx_v_obj);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_obj)));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_TYPE(__pyx_v_obj)));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_obj)));
    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __pyx_r = ((struct __pyx_obj_9casuarius_LinearExpression *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("casuarius.as_linear_expression", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":558
 *     cdef P_Constraint *cl_linear_constraint
 * 
 *     def __cinit__(self, lhs, rhs, *args, **kwds):             # <<<<<<<<<<<<<<
 *         self.lhs = as_linear_expression(lhs)
 *         self.rhs = as_linear_expression(rhs)
 */

static int __pyx_pf_9casuarius_16LinearConstraint___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_16LinearConstraint___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lhs = 0;
  PyObject *__pyx_v_rhs = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwds = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,0};
  __Pyx_RefNannySetupContext("__cinit__");
  __pyx_v_kwds = PyDict_New(); if (unlikely(!__pyx_v_kwds)) return -1;
  __Pyx_GOTREF(__pyx_v_kwds);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwds); __pyx_v_kwds = 0;
      __Pyx_RefNannyFinishContext();
      return -1;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 2) ? PyTuple_GET_SIZE(__pyx_args) : 2;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwds, values, used_pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_lhs = values[0];
    __pyx_v_rhs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwds); __pyx_v_kwds = 0;
  __Pyx_AddTraceback("casuarius.LinearConstraint.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":559
 * 
 *     def __cinit__(self, lhs, rhs, *args, **kwds):
 *         self.lhs = as_linear_expression(lhs)             # <<<<<<<<<<<<<<
 *         self.rhs = as_linear_expression(rhs)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9casuarius_as_linear_expression(__pyx_v_lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "casuarius.pyx":560
 *     def __cinit__(self, lhs, rhs, *args, **kwds):
 *         self.lhs = as_linear_expression(lhs)
 *         self.rhs = as_linear_expression(rhs)             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9casuarius_as_linear_expression(__pyx_v_rhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs = ((struct __pyx_obj_9casuarius_LinearExpression *)__pyx_t_1);
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.LinearConstraint.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwds);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":562
 *         self.rhs = as_linear_expression(rhs)
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         self._strength = strength
 *         self._weight = weight
 */

static int __pyx_pf_9casuarius_16LinearConstraint_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_16LinearConstraint_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lhs = 0;
  PyObject *__pyx_v_rhs = 0;
  struct __pyx_obj_9casuarius_Strength *__pyx_v_strength = 0;
  double __pyx_v_weight;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__strength,&__pyx_n_s__weight,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[4] = {0,0,0,0};
    values[2] = (PyObject *)__pyx_k_41;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strength);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lhs = values[0];
    __pyx_v_rhs = values[1];
    __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)values[2]);
    if (values[3]) {
      __pyx_v_weight = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_weight == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_weight = ((double)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.LinearConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strength), __pyx_ptype_9casuarius_Strength, 1, "strength", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":563
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         self._strength = strength             # <<<<<<<<<<<<<<
 *         self._weight = weight
 *         self.cl_linear_constraint = self.as_cl_linear_constraint()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_strength));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_strength));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength));
  ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength = __pyx_v_strength;

  /* "casuarius.pyx":564
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         self._strength = strength
 *         self._weight = weight             # <<<<<<<<<<<<<<
 *         self.cl_linear_constraint = self.as_cl_linear_constraint()
 * 
 */
  ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_weight = __pyx_v_weight;

  /* "casuarius.pyx":565
 *         self._strength = strength
 *         self._weight = weight
 *         self.cl_linear_constraint = self.as_cl_linear_constraint()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->cl_linear_constraint = ((struct __pyx_vtabstruct_9casuarius_LinearConstraint *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->__pyx_vtab)->as_cl_linear_constraint(((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self));

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":567
 *         self.cl_linear_constraint = self.as_cl_linear_constraint()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         delete_P_Constraint(self.cl_linear_constraint)
 * 
 */

static void __pyx_pf_9casuarius_16LinearConstraint_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_9casuarius_16LinearConstraint_2__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "casuarius.pyx":568
 * 
 *     def __dealloc__(self):
 *         delete_P_Constraint(self.cl_linear_constraint)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  delete_P_Constraint(((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->cl_linear_constraint);

  __Pyx_RefNannyFinishContext();
}

/* "casuarius.pyx":570
 *         delete_P_Constraint(self.cl_linear_constraint)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<%s: (%s %s %s) | %s | %s>' % (type(self).__name__, self.lhs,
 *             self.op, self.rhs, self.strength, self.weight)
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_3__repr__(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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "casuarius.pyx":571
 * 
 *     def __repr__(self):
 *         return '<%s: (%s %s %s) | %s | %s>' % (type(self).__name__, self.lhs,             # <<<<<<<<<<<<<<
 *             self.op, self.rhs, self.strength, self.weight)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)Py_TYPE(__pyx_v_self)), __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "casuarius.pyx":572
 *     def __repr__(self):
 *         return '<%s: (%s %s %s) | %s | %s>' % (type(self).__name__, self.lhs,
 *             self.op, self.rhs, self.strength, self.weight)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strength); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__weight); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op));
  PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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("casuarius.LinearConstraint.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":574
 *             self.op, self.rhs, self.strength, self.weight)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return '%s %s %s' % (self.lhs, self.op, self.rhs)
 * 
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_4__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_4__str__(PyObject *__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("__str__");

  /* "casuarius.pyx":575
 * 
 *     def __str__(self):
 *         return '%s %s %s' % (self.lhs, self.op, self.rhs)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("casuarius.LinearConstraint.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":579
 * 
 *     property strength:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._strength
 *         def __set__(self, Strength strength):
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_8strength___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_8strength___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");

  /* "casuarius.pyx":580
 *     property strength:
 *         def __get__(self):
 *             return self._strength             # <<<<<<<<<<<<<<
 *         def __set__(self, Strength strength):
 *             self._strength = strength
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":581
 *         def __get__(self):
 *             return self._strength
 *         def __set__(self, Strength strength):             # <<<<<<<<<<<<<<
 *             self._strength = strength
 *             deref(self.cl_linear_constraint).ChangeStrength(deref(strength.strength))
 */

static int __pyx_pf_9casuarius_16LinearConstraint_8strength_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_strength); /*proto*/
static int __pyx_pf_9casuarius_16LinearConstraint_8strength_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_strength) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strength), __pyx_ptype_9casuarius_Strength, 1, "strength", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":582
 *             return self._strength
 *         def __set__(self, Strength strength):
 *             self._strength = strength             # <<<<<<<<<<<<<<
 *             deref(self.cl_linear_constraint).ChangeStrength(deref(strength.strength))
 * 
 */
  __Pyx_INCREF(__pyx_v_strength);
  __Pyx_GIVEREF(__pyx_v_strength);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength));
  ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_strength);

  /* "casuarius.pyx":583
 *         def __set__(self, Strength strength):
 *             self._strength = strength
 *             deref(self.cl_linear_constraint).ChangeStrength(deref(strength.strength))             # <<<<<<<<<<<<<<
 * 
 *     property weight:
 */
  try {(*((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->cl_linear_constraint)->ChangeStrength((*((struct __pyx_obj_9casuarius_Strength *)__pyx_v_strength)->strength));} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearConstraint.strength.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":586
 * 
 *     property weight:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._weight
 *         def __set__(self, double weight):
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_6weight___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_6weight___get__(PyObject *__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__");

  /* "casuarius.pyx":587
 *     property weight:
 *         def __get__(self):
 *             return self._weight             # <<<<<<<<<<<<<<
 *         def __set__(self, double weight):
 *             self._weight = weight
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_weight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.LinearConstraint.weight.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":588
 *         def __get__(self):
 *             return self._weight
 *         def __set__(self, double weight):             # <<<<<<<<<<<<<<
 *             self._weight = weight
 *             deref(self.cl_linear_constraint).ChangeWeight(weight)
 */

static int __pyx_pf_9casuarius_16LinearConstraint_6weight_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_weight); /*proto*/
static int __pyx_pf_9casuarius_16LinearConstraint_6weight_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_weight) {
  double __pyx_v_weight;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_weight); {
    __pyx_v_weight = __pyx_PyFloat_AsDouble(__pyx_arg_weight); if (unlikely((__pyx_v_weight == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.LinearConstraint.weight.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":589
 *             return self._weight
 *         def __set__(self, double weight):
 *             self._weight = weight             # <<<<<<<<<<<<<<
 *             deref(self.cl_linear_constraint).ChangeWeight(weight)
 * 
 */
  ((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->_weight = __pyx_v_weight;

  /* "casuarius.pyx":590
 *         def __set__(self, double weight):
 *             self._weight = weight
 *             deref(self.cl_linear_constraint).ChangeWeight(weight)             # <<<<<<<<<<<<<<
 * 
 *     def __or__(self, other):
 */
  try {(*((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->cl_linear_constraint)->ChangeWeight(__pyx_v_weight);} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.LinearConstraint.weight.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":592
 *             deref(self.cl_linear_constraint).ChangeWeight(weight)
 * 
 *     def __or__(self, other):             # <<<<<<<<<<<<<<
 *         cdef Strength strength = self.strength
 *         cdef double weight = self.weight
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_5__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_5__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_9casuarius_Strength *__pyx_v_strength = 0;
  double __pyx_v_weight;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  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("__or__");

  /* "casuarius.pyx":593
 * 
 *     def __or__(self, other):
 *         cdef Strength strength = self.strength             # <<<<<<<<<<<<<<
 *         cdef double weight = self.weight
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strength); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "casuarius.pyx":594
 *     def __or__(self, other):
 *         cdef Strength strength = self.strength
 *         cdef double weight = self.weight             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(other, (float, int, long)):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__weight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_weight = __pyx_t_2;

  /* "casuarius.pyx":596
 *         cdef double weight = self.weight
 * 
 *         if isinstance(other, (float, int, long)):             # <<<<<<<<<<<<<<
 *             weight = other
 *         elif isinstance(other, basestring):
 */
  __Pyx_INCREF(__pyx_v_other);
  __pyx_t_1 = __pyx_v_other;
  __pyx_t_3 = PyFloat_Check(__pyx_t_1); 
  if (!__pyx_t_3) {
    __pyx_t_4 = PyInt_Check(__pyx_t_1); 
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = PyLong_Check(__pyx_t_1); 
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "casuarius.pyx":597
 * 
 *         if isinstance(other, (float, int, long)):
 *             weight = other             # <<<<<<<<<<<<<<
 *         elif isinstance(other, basestring):
 *             if other in STRENGTH_MAP:
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_weight = __pyx_t_2;
    goto __pyx_L5;
  }

  /* "casuarius.pyx":598
 *         if isinstance(other, (float, int, long)):
 *             weight = other
 *         elif isinstance(other, basestring):             # <<<<<<<<<<<<<<
 *             if other in STRENGTH_MAP:
 *                 strength = STRENGTH_MAP[other]
 */
  __pyx_t_1 = __pyx_builtin_basestring;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_other, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "casuarius.pyx":599
 *             weight = other
 *         elif isinstance(other, basestring):
 *             if other in STRENGTH_MAP:             # <<<<<<<<<<<<<<
 *                 strength = STRENGTH_MAP[other]
 *             else:
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__STRENGTH_MAP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = ((PySequence_Contains(__pyx_t_1, __pyx_v_other))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "casuarius.pyx":600
 *         elif isinstance(other, basestring):
 *             if other in STRENGTH_MAP:
 *                 strength = STRENGTH_MAP[other]             # <<<<<<<<<<<<<<
 *             else:
 *                 msg = "Expected a known strength string or a Strength. Got {!r} instead.".format(other)
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__STRENGTH_MAP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_v_other); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_strength));
      __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "casuarius.pyx":602
 *                 strength = STRENGTH_MAP[other]
 *             else:
 *                 msg = "Expected a known strength string or a Strength. Got {!r} instead.".format(other)             # <<<<<<<<<<<<<<
 *                 raise ValueError(msg)
 *         elif isinstance(other, Strength):
 */
      __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_44), __pyx_n_s__format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_INCREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_v_msg = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "casuarius.pyx":603
 *             else:
 *                 msg = "Expected a known strength string or a Strength. Got {!r} instead.".format(other)
 *                 raise ValueError(msg)             # <<<<<<<<<<<<<<
 *         elif isinstance(other, Strength):
 *             strength = other
 */
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_INCREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_msg);
      __Pyx_GIVEREF(__pyx_v_msg);
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "casuarius.pyx":604
 *                 msg = "Expected a known strength string or a Strength. Got {!r} instead.".format(other)
 *                 raise ValueError(msg)
 *         elif isinstance(other, Strength):             # <<<<<<<<<<<<<<
 *             strength = other
 *         else:
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Strength));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "casuarius.pyx":605
 *                 raise ValueError(msg)
 *         elif isinstance(other, Strength):
 *             strength = other             # <<<<<<<<<<<<<<
 *         else:
 *             msg = "Expected a known strength string, a Strength or a float weight. Got {!r} instead.".format(other)
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_DECREF(((PyObject *)__pyx_v_strength));
    __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_other);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "casuarius.pyx":607
 *             strength = other
 *         else:
 *             msg = "Expected a known strength string, a Strength or a float weight. Got {!r} instead.".format(other)             # <<<<<<<<<<<<<<
 *             raise ValueError(msg)
 *         return type(self)(self.lhs, self.rhs, strength=strength, weight=weight)
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_45), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_msg = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "casuarius.pyx":608
 *         else:
 *             msg = "Expected a known strength string, a Strength or a float weight. Got {!r} instead.".format(other)
 *             raise ValueError(msg)             # <<<<<<<<<<<<<<
 *         return type(self)(self.lhs, self.rhs, strength=strength, weight=weight)
 * 
 */
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "casuarius.pyx":609
 *             msg = "Expected a known strength string, a Strength or a float weight. Got {!r} instead.".format(other)
 *             raise ValueError(msg)
 *         return type(self)(self.lhs, self.rhs, strength=strength, weight=weight)             # <<<<<<<<<<<<<<
 * 
 *     def __ror__(self, Strength other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lhs); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rhs); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_7 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__strength), ((PyObject *)__pyx_v_strength)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__weight), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)Py_TYPE(__pyx_v_self)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("casuarius.LinearConstraint.__or__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_strength);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":611
 *         return type(self)(self.lhs, self.rhs, strength=strength, weight=weight)
 * 
 *     def __ror__(self, Strength other):             # <<<<<<<<<<<<<<
 *         return self.__or__(other)
 * 
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_6__ror__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_6__ror__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__ror__");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9casuarius_Strength, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":612
 * 
 *     def __ror__(self, Strength other):
 *         return self.__or__(other)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____or__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_other);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other);
  __Pyx_GIVEREF(__pyx_v_other);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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("casuarius.LinearConstraint.__ror__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":614
 *         return self.__or__(other)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return id(self)
 * 
 */

static Py_hash_t __pyx_pf_9casuarius_16LinearConstraint_7__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pf_9casuarius_16LinearConstraint_7__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_hash_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__");

  /* "casuarius.pyx":615
 * 
 *     def __hash__(self):
 *         return id(self)             # <<<<<<<<<<<<<<
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsHash_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_hash_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("casuarius.LinearConstraint.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":617
 *         return id(self)
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):             # <<<<<<<<<<<<<<
 *         return NULL
 * 
 */

static P_Constraint *__pyx_f_9casuarius_16LinearConstraint_as_cl_linear_constraint(struct __pyx_obj_9casuarius_LinearConstraint *__pyx_v_self) {
  P_Constraint *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("as_cl_linear_constraint");

  /* "casuarius.pyx":618
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):
 *         return NULL             # <<<<<<<<<<<<<<
 * 
 * cdef class LEConstraint(LinearConstraint):
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":551
 * 
 * cdef class LinearConstraint:
 *     cdef readonly LinearExpression lhs             # <<<<<<<<<<<<<<
 *     cdef readonly LinearExpression rhs
 *     cdef Strength _strength
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_3lhs___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_3lhs___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->lhs);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":552
 * cdef class LinearConstraint:
 *     cdef readonly LinearExpression lhs
 *     cdef readonly LinearExpression rhs             # <<<<<<<<<<<<<<
 *     cdef Strength _strength
 *     cdef double _weight
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_3rhs___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_3rhs___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->rhs);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":555
 *     cdef Strength _strength
 *     cdef double _weight
 *     cdef readonly bytes op             # <<<<<<<<<<<<<<
 *     cdef P_Constraint *cl_linear_constraint
 * 
 */

static PyObject *__pyx_pf_9casuarius_16LinearConstraint_2op___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_16LinearConstraint_2op___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_self)->op);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":622
 * cdef class LEConstraint(LinearConstraint):
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'<='
 */

static int __pyx_pf_9casuarius_12LEConstraint___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_12LEConstraint___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lhs = 0;
  PyObject *__pyx_v_rhs = 0;
  struct __pyx_obj_9casuarius_Strength *__pyx_v_strength = 0;
  double __pyx_v_weight;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__strength,&__pyx_n_s__weight,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[4] = {0,0,0,0};
    values[2] = (PyObject *)__pyx_k_46;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strength);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lhs = values[0];
    __pyx_v_rhs = values[1];
    __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)values[2]);
    if (values[3]) {
      __pyx_v_weight = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_weight == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_weight = ((double)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.LEConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strength), __pyx_ptype_9casuarius_Strength, 1, "strength", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":623
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)             # <<<<<<<<<<<<<<
 *         self.op = b'<='
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearConstraint)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_lhs);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lhs);
  __Pyx_GIVEREF(__pyx_v_lhs);
  __Pyx_INCREF(__pyx_v_rhs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_rhs);
  __Pyx_GIVEREF(__pyx_v_rhs);
  __Pyx_INCREF(((PyObject *)__pyx_v_strength));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_strength));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_strength));
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "casuarius.pyx":624
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'<='             # <<<<<<<<<<<<<<
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_47));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_47));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_LEConstraint *)__pyx_v_self)->__pyx_base.op);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_LEConstraint *)__pyx_v_self)->__pyx_base.op));
  ((struct __pyx_obj_9casuarius_LEConstraint *)__pyx_v_self)->__pyx_base.op = __pyx_kp_b_47;

  __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_AddTraceback("casuarius.LEConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":626
 *         self.op = b'<='
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):             # <<<<<<<<<<<<<<
 *         cdef P_Constraint *inequality
 *         cdef P_LinearExpression lhs_le
 */

static P_Constraint *__pyx_f_9casuarius_12LEConstraint_as_cl_linear_constraint(struct __pyx_obj_9casuarius_LEConstraint *__pyx_v_self) {
  P_Constraint *__pyx_v_inequality;
  P_Constraint *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("as_cl_linear_constraint");

  /* "casuarius.pyx":631
 *         cdef P_LinearExpression rhs_le
 * 
 *         inequality = newLinearInequality(self.lhs.as_cl_linear_expression(), cnLEQ, self.rhs.as_cl_linear_expression(), deref(self._strength.strength), self._weight)             # <<<<<<<<<<<<<<
 *         return inequality
 * 
 */
  __pyx_v_inequality = newLinearInequality(((struct __pyx_vtabstruct_9casuarius_LinearExpression *)__pyx_v_self->__pyx_base.lhs->__pyx_base.__pyx_vtab)->as_cl_linear_expression(__pyx_v_self->__pyx_base.lhs), cnLEQ, ((struct __pyx_vtabstruct_9casuarius_LinearExpression *)__pyx_v_self->__pyx_base.rhs->__pyx_base.__pyx_vtab)->as_cl_linear_expression(__pyx_v_self->__pyx_base.rhs), (*__pyx_v_self->__pyx_base._strength->strength), __pyx_v_self->__pyx_base._weight);

  /* "casuarius.pyx":632
 * 
 *         inequality = newLinearInequality(self.lhs.as_cl_linear_expression(), cnLEQ, self.rhs.as_cl_linear_expression(), deref(self._strength.strength), self._weight)
 *         return inequality             # <<<<<<<<<<<<<<
 * 
 *     property error:
 */
  __pyx_r = __pyx_v_inequality;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":635
 * 
 *     property error:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.lhs.value - self.rhs.value
 * 
 */

static PyObject *__pyx_pf_9casuarius_12LEConstraint_5error___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_12LEConstraint_5error___get__(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "casuarius.pyx":636
 *     property error:
 *         def __get__(self):
 *             return self.lhs.value - self.rhs.value             # <<<<<<<<<<<<<<
 * 
 * cdef class GEConstraint(LinearConstraint):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9casuarius_LEConstraint *)__pyx_v_self)->__pyx_base.lhs), __pyx_n_s__value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9casuarius_LEConstraint *)__pyx_v_self)->__pyx_base.rhs), __pyx_n_s__value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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("casuarius.LEConstraint.error.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":640
 * cdef class GEConstraint(LinearConstraint):
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'>='
 */

static int __pyx_pf_9casuarius_12GEConstraint___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_12GEConstraint___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lhs = 0;
  PyObject *__pyx_v_rhs = 0;
  struct __pyx_obj_9casuarius_Strength *__pyx_v_strength = 0;
  double __pyx_v_weight;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__strength,&__pyx_n_s__weight,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[4] = {0,0,0,0};
    values[2] = (PyObject *)__pyx_k_48;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strength);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lhs = values[0];
    __pyx_v_rhs = values[1];
    __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)values[2]);
    if (values[3]) {
      __pyx_v_weight = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_weight == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_weight = ((double)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.GEConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strength), __pyx_ptype_9casuarius_Strength, 1, "strength", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":641
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)             # <<<<<<<<<<<<<<
 *         self.op = b'>='
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearConstraint)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_lhs);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lhs);
  __Pyx_GIVEREF(__pyx_v_lhs);
  __Pyx_INCREF(__pyx_v_rhs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_rhs);
  __Pyx_GIVEREF(__pyx_v_rhs);
  __Pyx_INCREF(((PyObject *)__pyx_v_strength));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_strength));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_strength));
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "casuarius.pyx":642
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'>='             # <<<<<<<<<<<<<<
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_49));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_49));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_GEConstraint *)__pyx_v_self)->__pyx_base.op);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_GEConstraint *)__pyx_v_self)->__pyx_base.op));
  ((struct __pyx_obj_9casuarius_GEConstraint *)__pyx_v_self)->__pyx_base.op = __pyx_kp_b_49;

  __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_AddTraceback("casuarius.GEConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":644
 *         self.op = b'>='
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):             # <<<<<<<<<<<<<<
 *         cdef P_Constraint *inequality
 *         cdef P_LinearExpression lhs_le
 */

static P_Constraint *__pyx_f_9casuarius_12GEConstraint_as_cl_linear_constraint(struct __pyx_obj_9casuarius_GEConstraint *__pyx_v_self) {
  P_Constraint *__pyx_v_inequality;
  P_Constraint *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("as_cl_linear_constraint");

  /* "casuarius.pyx":649
 *         cdef P_LinearExpression rhs_le
 * 
 *         inequality = newLinearInequality(self.lhs.as_cl_linear_expression(), cnGEQ, self.rhs.as_cl_linear_expression(), deref(self._strength.strength), self._weight)             # <<<<<<<<<<<<<<
 *         return inequality
 * 
 */
  __pyx_v_inequality = newLinearInequality(((struct __pyx_vtabstruct_9casuarius_LinearExpression *)__pyx_v_self->__pyx_base.lhs->__pyx_base.__pyx_vtab)->as_cl_linear_expression(__pyx_v_self->__pyx_base.lhs), cnGEQ, ((struct __pyx_vtabstruct_9casuarius_LinearExpression *)__pyx_v_self->__pyx_base.rhs->__pyx_base.__pyx_vtab)->as_cl_linear_expression(__pyx_v_self->__pyx_base.rhs), (*__pyx_v_self->__pyx_base._strength->strength), __pyx_v_self->__pyx_base._weight);

  /* "casuarius.pyx":650
 * 
 *         inequality = newLinearInequality(self.lhs.as_cl_linear_expression(), cnGEQ, self.rhs.as_cl_linear_expression(), deref(self._strength.strength), self._weight)
 *         return inequality             # <<<<<<<<<<<<<<
 * 
 *     property error:
 */
  __pyx_r = __pyx_v_inequality;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":653
 * 
 *     property error:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.rhs.value - self.lhs.value
 * 
 */

static PyObject *__pyx_pf_9casuarius_12GEConstraint_5error___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_12GEConstraint_5error___get__(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "casuarius.pyx":654
 *     property error:
 *         def __get__(self):
 *             return self.rhs.value - self.lhs.value             # <<<<<<<<<<<<<<
 * 
 * cdef class EQConstraint(LinearConstraint):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9casuarius_GEConstraint *)__pyx_v_self)->__pyx_base.rhs), __pyx_n_s__value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9casuarius_GEConstraint *)__pyx_v_self)->__pyx_base.lhs), __pyx_n_s__value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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("casuarius.GEConstraint.error.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":658
 * cdef class EQConstraint(LinearConstraint):
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'=='
 */

static int __pyx_pf_9casuarius_12EQConstraint___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_12EQConstraint___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lhs = 0;
  PyObject *__pyx_v_rhs = 0;
  struct __pyx_obj_9casuarius_Strength *__pyx_v_strength = 0;
  double __pyx_v_weight;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__strength,&__pyx_n_s__weight,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[4] = {0,0,0,0};
    values[2] = (PyObject *)__pyx_k_50;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strength);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lhs = values[0];
    __pyx_v_rhs = values[1];
    __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)values[2]);
    if (values[3]) {
      __pyx_v_weight = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_weight == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_weight = ((double)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.EQConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strength), __pyx_ptype_9casuarius_Strength, 1, "strength", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":659
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)             # <<<<<<<<<<<<<<
 *         self.op = b'=='
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_LinearConstraint)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_lhs);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lhs);
  __Pyx_GIVEREF(__pyx_v_lhs);
  __Pyx_INCREF(__pyx_v_rhs);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_rhs);
  __Pyx_GIVEREF(__pyx_v_rhs);
  __Pyx_INCREF(((PyObject *)__pyx_v_strength));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_strength));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_strength));
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "casuarius.pyx":660
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'=='             # <<<<<<<<<<<<<<
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_51));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_EQConstraint *)__pyx_v_self)->__pyx_base.op);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_EQConstraint *)__pyx_v_self)->__pyx_base.op));
  ((struct __pyx_obj_9casuarius_EQConstraint *)__pyx_v_self)->__pyx_base.op = __pyx_kp_b_51;

  __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_AddTraceback("casuarius.EQConstraint.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":662
 *         self.op = b'=='
 * 
 *     cdef P_Constraint *as_cl_linear_constraint(self):             # <<<<<<<<<<<<<<
 *         cdef P_Constraint *equation
 *         cdef P_LinearExpression lhs_le
 */

static P_Constraint *__pyx_f_9casuarius_12EQConstraint_as_cl_linear_constraint(struct __pyx_obj_9casuarius_EQConstraint *__pyx_v_self) {
  P_Constraint *__pyx_v_equation;
  P_Constraint *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("as_cl_linear_constraint");

  /* "casuarius.pyx":667
 *         cdef P_LinearExpression rhs_le
 * 
 *         equation = newLinearEquation(self.lhs.as_cl_linear_expression(), self.rhs.as_cl_linear_expression(), deref(self._strength.strength), self._weight)             # <<<<<<<<<<<<<<
 *         return equation
 * 
 */
  __pyx_v_equation = newLinearEquation(((struct __pyx_vtabstruct_9casuarius_LinearExpression *)__pyx_v_self->__pyx_base.lhs->__pyx_base.__pyx_vtab)->as_cl_linear_expression(__pyx_v_self->__pyx_base.lhs), ((struct __pyx_vtabstruct_9casuarius_LinearExpression *)__pyx_v_self->__pyx_base.rhs->__pyx_base.__pyx_vtab)->as_cl_linear_expression(__pyx_v_self->__pyx_base.rhs), (*__pyx_v_self->__pyx_base._strength->strength), __pyx_v_self->__pyx_base._weight);

  /* "casuarius.pyx":668
 * 
 *         equation = newLinearEquation(self.lhs.as_cl_linear_expression(), self.rhs.as_cl_linear_expression(), deref(self._strength.strength), self._weight)
 *         return equation             # <<<<<<<<<<<<<<
 * 
 *     property error:
 */
  __pyx_r = __pyx_v_equation;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":671
 * 
 *     property error:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return abs(self.rhs.value - self.lhs.value)
 * 
 */

static PyObject *__pyx_pf_9casuarius_12EQConstraint_5error___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_12EQConstraint_5error___get__(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "casuarius.pyx":672
 *     property error:
 *         def __get__(self):
 *             return abs(self.rhs.value - self.lhs.value)             # <<<<<<<<<<<<<<
 * 
 * cdef class Solver:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9casuarius_EQConstraint *)__pyx_v_self)->__pyx_base.rhs), __pyx_n_s__value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9casuarius_EQConstraint *)__pyx_v_self)->__pyx_base.lhs), __pyx_n_s__value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("casuarius.EQConstraint.error.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":679
 *     cdef bint _explaining
 * 
 *     def __cinit__(self, bint autosolve=False, bint explaining=True):             # <<<<<<<<<<<<<<
 *         self.solver = new ClSimplexSolver()
 *         self.autosolve = autosolve
 */

static int __pyx_pf_9casuarius_6Solver___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_6Solver___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_autosolve;
  int __pyx_v_explaining;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__autosolve,&__pyx_n_s__explaining,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__autosolve);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__explaining);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_autosolve = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_autosolve == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_autosolve = ((int)0);
    }
    if (values[1]) {
      __pyx_v_explaining = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_explaining == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_explaining = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.Solver.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":680
 * 
 *     def __cinit__(self, bint autosolve=False, bint explaining=True):
 *         self.solver = new ClSimplexSolver()             # <<<<<<<<<<<<<<
 *         self.autosolve = autosolve
 *         self.explaining = explaining
 */
  ((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->solver = new SimplexSolver();

  /* "casuarius.pyx":681
 *     def __cinit__(self, bint autosolve=False, bint explaining=True):
 *         self.solver = new ClSimplexSolver()
 *         self.autosolve = autosolve             # <<<<<<<<<<<<<<
 *         self.explaining = explaining
 * 
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_autosolve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__autosolve, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":682
 *         self.solver = new ClSimplexSolver()
 *         self.autosolve = autosolve
 *         self.explaining = explaining             # <<<<<<<<<<<<<<
 * 
 *     property autosolve:
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_explaining); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__explaining, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.Solver.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":685
 * 
 *     property autosolve:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._autosolve
 * 
 */

static PyObject *__pyx_pf_9casuarius_6Solver_9autosolve___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_6Solver_9autosolve___get__(PyObject *__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__");

  /* "casuarius.pyx":686
 *     property autosolve:
 *         def __get__(self):
 *             return self._autosolve             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, bint autosolve):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->_autosolve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.Solver.autosolve.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":688
 *             return self._autosolve
 * 
 *         def __set__(self, bint autosolve):             # <<<<<<<<<<<<<<
 *             self._autosolve = autosolve
 *             self.solver.SetAutosolve(autosolve)
 */

static int __pyx_pf_9casuarius_6Solver_9autosolve_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_autosolve); /*proto*/
static int __pyx_pf_9casuarius_6Solver_9autosolve_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_autosolve) {
  int __pyx_v_autosolve;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_autosolve); {
    __pyx_v_autosolve = __Pyx_PyObject_IsTrue(__pyx_arg_autosolve); if (unlikely((__pyx_v_autosolve == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.Solver.autosolve.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":689
 * 
 *         def __set__(self, bint autosolve):
 *             self._autosolve = autosolve             # <<<<<<<<<<<<<<
 *             self.solver.SetAutosolve(autosolve)
 * 
 */
  ((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->_autosolve = __pyx_v_autosolve;

  /* "casuarius.pyx":690
 *         def __set__(self, bint autosolve):
 *             self._autosolve = autosolve
 *             self.solver.SetAutosolve(autosolve)             # <<<<<<<<<<<<<<
 * 
 *     property explaining:
 */
  try {((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->solver->SetAutosolve(__pyx_v_autosolve);} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Solver.autosolve.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":693
 * 
 *     property explaining:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._explaining
 * 
 */

static PyObject *__pyx_pf_9casuarius_6Solver_10explaining___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_6Solver_10explaining___get__(PyObject *__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__");

  /* "casuarius.pyx":694
 *     property explaining:
 *         def __get__(self):
 *             return self._explaining             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, bint explaining):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->_explaining); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.Solver.explaining.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":696
 *             return self._explaining
 * 
 *         def __set__(self, bint explaining):             # <<<<<<<<<<<<<<
 *             self._explaining = explaining
 *             self.solver.SetExplaining(explaining)
 */

static int __pyx_pf_9casuarius_6Solver_10explaining_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_explaining); /*proto*/
static int __pyx_pf_9casuarius_6Solver_10explaining_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_explaining) {
  int __pyx_v_explaining;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_explaining); {
    __pyx_v_explaining = __Pyx_PyObject_IsTrue(__pyx_arg_explaining); if (unlikely((__pyx_v_explaining == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.Solver.explaining.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":697
 * 
 *         def __set__(self, bint explaining):
 *             self._explaining = explaining             # <<<<<<<<<<<<<<
 *             self.solver.SetExplaining(explaining)
 * 
 */
  ((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->_explaining = __pyx_v_explaining;

  /* "casuarius.pyx":698
 *         def __set__(self, bint explaining):
 *             self._explaining = explaining
 *             self.solver.SetExplaining(explaining)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->solver->SetExplaining(__pyx_v_explaining);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":700
 *             self.solver.SetExplaining(explaining)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self.solver
 * 
 */

static void __pyx_pf_9casuarius_6Solver_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_9casuarius_6Solver_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "casuarius.pyx":701
 * 
 *     def __dealloc__(self):
 *         del self.solver             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  delete ((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->solver;

  __Pyx_RefNannyFinishContext();
}

/* "casuarius.pyx":703
 *         del self.solver
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return solver_str(self.solver).c_str()
 * 
 */

static PyObject *__pyx_pf_9casuarius_6Solver_2__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_6Solver_2__str__(PyObject *__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("__str__");

  /* "casuarius.pyx":704
 * 
 *     def __str__(self):
 *         return solver_str(self.solver).c_str()             # <<<<<<<<<<<<<<
 * 
 *     def add_constraint(self, LinearConstraint constraint):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyBytes_FromString(solver_str(((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->solver).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.Solver.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":706
 *         return solver_str(self.solver).c_str()
 * 
 *     def add_constraint(self, LinearConstraint constraint):             # <<<<<<<<<<<<<<
 *         self.solver.AddConstraint(deref(constraint.cl_linear_constraint))
 * 
 */

static PyObject *__pyx_pf_9casuarius_6Solver_3add_constraint(PyObject *__pyx_v_self, PyObject *__pyx_v_constraint); /*proto*/
static PyObject *__pyx_pf_9casuarius_6Solver_3add_constraint(PyObject *__pyx_v_self, PyObject *__pyx_v_constraint) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_constraint");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constraint), __pyx_ptype_9casuarius_LinearConstraint, 1, "constraint", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":707
 * 
 *     def add_constraint(self, LinearConstraint constraint):
 *         self.solver.AddConstraint(deref(constraint.cl_linear_constraint))             # <<<<<<<<<<<<<<
 * 
 *     def remove_constraint(self, LinearConstraint constraint):
 */
  try {((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->solver->AddConstraint((*((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_constraint)->cl_linear_constraint));} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Solver.add_constraint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":709
 *         self.solver.AddConstraint(deref(constraint.cl_linear_constraint))
 * 
 *     def remove_constraint(self, LinearConstraint constraint):             # <<<<<<<<<<<<<<
 *         self.solver.RemoveConstraint(deref(constraint.cl_linear_constraint))
 * 
 */

static PyObject *__pyx_pf_9casuarius_6Solver_4remove_constraint(PyObject *__pyx_v_self, PyObject *__pyx_v_constraint); /*proto*/
static PyObject *__pyx_pf_9casuarius_6Solver_4remove_constraint(PyObject *__pyx_v_self, PyObject *__pyx_v_constraint) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove_constraint");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_constraint), __pyx_ptype_9casuarius_LinearConstraint, 1, "constraint", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":710
 * 
 *     def remove_constraint(self, LinearConstraint constraint):
 *         self.solver.RemoveConstraint(deref(constraint.cl_linear_constraint))             # <<<<<<<<<<<<<<
 * 
 *     def suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):
 */
  try {((struct __pyx_obj_9casuarius_Solver *)__pyx_v_self)->solver->RemoveConstraint((*((struct __pyx_obj_9casuarius_LinearConstraint *)__pyx_v_constraint)->cl_linear_constraint));} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Solver.remove_constraint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":712
 *         self.solver.RemoveConstraint(deref(constraint.cl_linear_constraint))
 * 
 *     def suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):             # <<<<<<<<<<<<<<
 *         return SolverEditContext(self, var_vals, default_strength, default_weight)
 * 
 */

static PyObject *__pyx_pf_9casuarius_6Solver_5suggest_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_9casuarius_6Solver_5suggest_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_var_vals = 0;
  struct __pyx_obj_9casuarius_Strength *__pyx_v_default_strength = 0;
  double __pyx_v_default_weight;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__var_vals,&__pyx_n_s__default_strength,&__pyx_n_s__default_weight,0};
  __Pyx_RefNannySetupContext("suggest_values");
  {
    PyObject* values[3] = {0,0,0};
    values[1] = (PyObject *)__pyx_k_52;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__var_vals);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default_strength);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default_weight);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "suggest_values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_var_vals = values[0];
    __pyx_v_default_strength = ((struct __pyx_obj_9casuarius_Strength *)values[1]);
    if (values[2]) {
      __pyx_v_default_weight = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_default_weight == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_default_weight = ((double)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("suggest_values", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.Solver.suggest_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_default_strength), __pyx_ptype_9casuarius_Strength, 1, "default_strength", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":713
 * 
 *     def suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):
 *         return SolverEditContext(self, var_vals, default_strength, default_weight)             # <<<<<<<<<<<<<<
 * 
 *     cdef object _begin_edit_suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_default_weight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_var_vals);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_var_vals);
  __Pyx_GIVEREF(__pyx_v_var_vals);
  __Pyx_INCREF(((PyObject *)__pyx_v_default_strength));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_default_strength));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_default_strength));
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_SolverEditContext)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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("casuarius.Solver.suggest_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":715
 *         return SolverEditContext(self, var_vals, default_strength, default_weight)
 * 
 *     cdef object _begin_edit_suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):             # <<<<<<<<<<<<<<
 *         cdef ConstraintVariable variable
 *         cdef double value
 */

static PyObject *__pyx_f_9casuarius_6Solver__begin_edit_suggest_values(struct __pyx_obj_9casuarius_Solver *__pyx_v_self, PyObject *__pyx_v_var_vals, struct __pyx_opt_args_9casuarius_6Solver__begin_edit_suggest_values *__pyx_optional_args) {
  struct __pyx_obj_9casuarius_Strength *__pyx_v_default_strength = __pyx_k_53;
  double __pyx_v_default_weight = ((double)1.0);
  struct __pyx_obj_9casuarius_ConstraintVariable *__pyx_v_variable = 0;
  double __pyx_v_value;
  struct __pyx_obj_9casuarius_Strength *__pyx_v_strength = 0;
  double __pyx_v_weight;
  PyObject *__pyx_v_item = 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;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  double __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  double __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_begin_edit_suggest_values");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_strength = __pyx_optional_args->default_strength;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_default_weight = __pyx_optional_args->default_weight;
      }
    }
  }

  /* "casuarius.pyx":721
 *         cdef double weight
 * 
 *         for item in var_vals:             # <<<<<<<<<<<<<<
 *             strength = default_strength
 *             weight = default_weight
 */
  if (PyList_CheckExact(__pyx_v_var_vals) || PyTuple_CheckExact(__pyx_v_var_vals)) {
    __pyx_t_1 = __pyx_v_var_vals; __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_var_vals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF(__pyx_v_item);
    __pyx_v_item = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "casuarius.pyx":722
 * 
 *         for item in var_vals:
 *             strength = default_strength             # <<<<<<<<<<<<<<
 *             weight = default_weight
 *             if len(item) == 2:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_default_strength));
    __Pyx_XDECREF(((PyObject *)__pyx_v_strength));
    __pyx_v_strength = __pyx_v_default_strength;

    /* "casuarius.pyx":723
 *         for item in var_vals:
 *             strength = default_strength
 *             weight = default_weight             # <<<<<<<<<<<<<<
 *             if len(item) == 2:
 *                 variable, value = item
 */
    __pyx_v_weight = __pyx_v_default_weight;

    /* "casuarius.pyx":724
 *             strength = default_strength
 *             weight = default_weight
 *             if len(item) == 2:             # <<<<<<<<<<<<<<
 *                 variable, value = item
 *             elif len(item) == 3:
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 == 2);
    if (__pyx_t_6) {

      /* "casuarius.pyx":725
 *             weight = default_weight
 *             if len(item) == 2:
 *                 variable, value = item             # <<<<<<<<<<<<<<
 *             elif len(item) == 3:
 *                 variable, value, strength = item
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_item))) || (PyList_CheckExact(__pyx_v_item))) {
        PyObject* sequence = __pyx_v_item;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_v_item); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L7_unpacking_done:;
      }
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_9casuarius_ConstraintVariable))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_variable));
      __pyx_v_variable = ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_v_value = __pyx_t_10;
      goto __pyx_L5;
    }

    /* "casuarius.pyx":726
 *             if len(item) == 2:
 *                 variable, value = item
 *             elif len(item) == 3:             # <<<<<<<<<<<<<<
 *                 variable, value, strength = item
 *             elif len(item) == 4:
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 == 3);
    if (__pyx_t_6) {

      /* "casuarius.pyx":727
 *                 variable, value = item
 *             elif len(item) == 3:
 *                 variable, value, strength = item             # <<<<<<<<<<<<<<
 *             elif len(item) == 4:
 *                 variable, value, strength, weight = item
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_item))) || (PyList_CheckExact(__pyx_v_item))) {
        PyObject* sequence = __pyx_v_item;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
            if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
            if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_v_item); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 2; __pyx_t_8 = __pyx_t_9(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L9_unpacking_done:;
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_9casuarius_ConstraintVariable))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_variable));
      __pyx_v_variable = ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_v_value = __pyx_t_10;
      __Pyx_DECREF(((PyObject *)__pyx_v_strength));
      __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_8);
      __pyx_t_8 = 0;
      goto __pyx_L5;
    }

    /* "casuarius.pyx":728
 *             elif len(item) == 3:
 *                 variable, value, strength = item
 *             elif len(item) == 4:             # <<<<<<<<<<<<<<
 *                 variable, value, strength, weight = item
 *             self.solver.AddEditVar(deref(variable.variable), deref(strength.strength), weight)
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 == 4);
    if (__pyx_t_6) {

      /* "casuarius.pyx":729
 *                 variable, value, strength = item
 *             elif len(item) == 4:
 *                 variable, value, strength, weight = item             # <<<<<<<<<<<<<<
 *             self.solver.AddEditVar(deref(variable.variable), deref(strength.strength), weight)
 * 
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_item))) || (PyList_CheckExact(__pyx_v_item))) {
        PyObject* sequence = __pyx_v_item;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
            if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
            if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_11);
      } else {
        Py_ssize_t index = -1;
        __pyx_t_12 = PyObject_GetIter(__pyx_v_item); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = Py_TYPE(__pyx_t_12)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_8)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 3; __pyx_t_11 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_12), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L11_unpacking_done;
        __pyx_L10_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L11_unpacking_done:;
      }
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_9casuarius_ConstraintVariable))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_variable));
      __pyx_v_variable = ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_v_value = __pyx_t_10;
      __Pyx_DECREF(((PyObject *)__pyx_v_strength));
      __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_v_weight = __pyx_t_13;
      goto __pyx_L5;
    }
    __pyx_L5:;
    if (unlikely(!__pyx_v_variable)) { __Pyx_RaiseUnboundLocalError("variable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }try {__pyx_v_self->solver->AddEditVar((*__pyx_v_variable->variable), (*__pyx_v_strength->strength), __pyx_v_weight);} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

    /* "casuarius.pyx":730
 *             elif len(item) == 4:
 *                 variable, value, strength, weight = item
 *             self.solver.AddEditVar(deref(variable.variable), deref(strength.strength), weight)             # <<<<<<<<<<<<<<
 * 
 *         self.solver.BeginEdit()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":732
 *             self.solver.AddEditVar(deref(variable.variable), deref(strength.strength), weight)
 * 
 *         self.solver.BeginEdit()             # <<<<<<<<<<<<<<
 *         for item in var_vals:
 *             strength = default_strength
 */
  try {__pyx_v_self->solver->BeginEdit();} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  /* "casuarius.pyx":733
 * 
 *         self.solver.BeginEdit()
 *         for item in var_vals:             # <<<<<<<<<<<<<<
 *             strength = default_strength
 *             weight = default_weight
 */
  if (PyList_CheckExact(__pyx_v_var_vals) || PyTuple_CheckExact(__pyx_v_var_vals)) {
    __pyx_t_1 = __pyx_v_var_vals; __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_var_vals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_11); __pyx_t_2++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_11); __pyx_t_2++;
    } else {
      __pyx_t_11 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_11)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_11);
    }
    __Pyx_XDECREF(__pyx_v_item);
    __pyx_v_item = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "casuarius.pyx":734
 *         self.solver.BeginEdit()
 *         for item in var_vals:
 *             strength = default_strength             # <<<<<<<<<<<<<<
 *             weight = default_weight
 *             if len(item) == 2:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_default_strength));
    __Pyx_XDECREF(((PyObject *)__pyx_v_strength));
    __pyx_v_strength = __pyx_v_default_strength;

    /* "casuarius.pyx":735
 *         for item in var_vals:
 *             strength = default_strength
 *             weight = default_weight             # <<<<<<<<<<<<<<
 *             if len(item) == 2:
 *                 variable, value = item
 */
    __pyx_v_weight = __pyx_v_default_weight;

    /* "casuarius.pyx":736
 *             strength = default_strength
 *             weight = default_weight
 *             if len(item) == 2:             # <<<<<<<<<<<<<<
 *                 variable, value = item
 *             elif len(item) == 3:
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 == 2);
    if (__pyx_t_6) {

      /* "casuarius.pyx":737
 *             weight = default_weight
 *             if len(item) == 2:
 *                 variable, value = item             # <<<<<<<<<<<<<<
 *             elif len(item) == 3:
 *                 variable, value, strength = item
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_item))) || (PyList_CheckExact(__pyx_v_item))) {
        PyObject* sequence = __pyx_v_item;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_v_item); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_11 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_11)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L16_unpacking_done;
        __pyx_L15_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L16_unpacking_done:;
      }
      if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_9casuarius_ConstraintVariable))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_variable));
      __pyx_v_variable = ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_v_value = __pyx_t_13;
      goto __pyx_L14;
    }

    /* "casuarius.pyx":738
 *             if len(item) == 2:
 *                 variable, value = item
 *             elif len(item) == 3:             # <<<<<<<<<<<<<<
 *                 variable, value, strength = item
 *             elif len(item) == 4:
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 == 3);
    if (__pyx_t_6) {

      /* "casuarius.pyx":739
 *                 variable, value = item
 *             elif len(item) == 3:
 *                 variable, value, strength = item             # <<<<<<<<<<<<<<
 *             elif len(item) == 4:
 *                 variable, value, strength, weight = item
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_item))) || (PyList_CheckExact(__pyx_v_item))) {
        PyObject* sequence = __pyx_v_item;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
            if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
            if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_4);
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_v_item); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_11 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_11)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 2; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L18_unpacking_done;
        __pyx_L17_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L18_unpacking_done:;
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_9casuarius_ConstraintVariable))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_variable));
      __pyx_v_variable = ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_v_value = __pyx_t_13;
      __Pyx_DECREF(((PyObject *)__pyx_v_strength));
      __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L14;
    }

    /* "casuarius.pyx":740
 *             elif len(item) == 3:
 *                 variable, value, strength = item
 *             elif len(item) == 4:             # <<<<<<<<<<<<<<
 *                 variable, value, strength, weight = item
 *             self.solver.SuggestValue(deref(variable.variable), value)
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_item); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_5 == 4);
    if (__pyx_t_6) {

      /* "casuarius.pyx":741
 *                 variable, value, strength = item
 *             elif len(item) == 4:
 *                 variable, value, strength, weight = item             # <<<<<<<<<<<<<<
 *             self.solver.SuggestValue(deref(variable.variable), value)
 * 
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_item))) || (PyList_CheckExact(__pyx_v_item))) {
        PyObject* sequence = __pyx_v_item;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
            if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
            if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
      } else {
        Py_ssize_t index = -1;
        __pyx_t_12 = PyObject_GetIter(__pyx_v_item); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = Py_TYPE(__pyx_t_12)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L19_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_11 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L19_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_7)) goto __pyx_L19_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 3; __pyx_t_8 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_8)) goto __pyx_L19_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_12), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L20_unpacking_done;
        __pyx_L19_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L20_unpacking_done:;
      }
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_9casuarius_ConstraintVariable))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_variable));
      __pyx_v_variable = ((struct __pyx_obj_9casuarius_ConstraintVariable *)__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_v_value = __pyx_t_13;
      __Pyx_DECREF(((PyObject *)__pyx_v_strength));
      __pyx_v_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_v_weight = __pyx_t_10;
      goto __pyx_L14;
    }
    __pyx_L14:;
    if (unlikely(!__pyx_v_variable)) { __Pyx_RaiseUnboundLocalError("variable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }try {__pyx_v_self->solver->SuggestValue((*__pyx_v_variable->variable), __pyx_v_value);} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

    /* "casuarius.pyx":742
 *             elif len(item) == 4:
 *                 variable, value, strength, weight = item
 *             self.solver.SuggestValue(deref(variable.variable), value)             # <<<<<<<<<<<<<<
 * 
 *         self.solver.Resolve()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":744
 *             self.solver.SuggestValue(deref(variable.variable), value)
 * 
 *         self.solver.Resolve()             # <<<<<<<<<<<<<<
 * 
 *     cdef _end_edit(self):
 */
  try {__pyx_v_self->solver->Resolve();} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  __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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("casuarius.Solver._begin_edit_suggest_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_variable);
  __Pyx_XDECREF((PyObject *)__pyx_v_strength);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":746
 *         self.solver.Resolve()
 * 
 *     cdef _end_edit(self):             # <<<<<<<<<<<<<<
 *         self.solver.EndEdit()
 * 
 */

static PyObject *__pyx_f_9casuarius_6Solver__end_edit(struct __pyx_obj_9casuarius_Solver *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_end_edit");

  /* "casuarius.pyx":747
 * 
 *     cdef _end_edit(self):
 *         self.solver.EndEdit()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  try {__pyx_v_self->solver->EndEdit();} catch(...) {__pyx_f_9casuarius_raise_cassowary_error(); if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError , "Error converting c++ exception."); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.Solver._end_edit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":758
 *     cdef public double default_weight
 * 
 *     def __cinit__(self, solver, suggest_var_vals,             # <<<<<<<<<<<<<<
 *         Strength default_strength=strong, double default_weight=1.0):
 *         self.solver = solver
 */

static int __pyx_pf_9casuarius_17SolverEditContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_solver = 0;
  PyObject *__pyx_v_suggest_var_vals = 0;
  struct __pyx_obj_9casuarius_Strength *__pyx_v_default_strength = 0;
  double __pyx_v_default_weight;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__solver,&__pyx_n_s__suggest_var_vals,&__pyx_n_s__default_strength,&__pyx_n_s__default_weight,0};
  __Pyx_RefNannySetupContext("__cinit__");
  {
    PyObject* values[4] = {0,0,0,0};
    values[2] = (PyObject *)__pyx_k_54;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__suggest_var_vals);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default_strength);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default_weight);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_solver = values[0];
    __pyx_v_suggest_var_vals = values[1];
    __pyx_v_default_strength = ((struct __pyx_obj_9casuarius_Strength *)values[2]);
    if (values[3]) {
      __pyx_v_default_weight = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_default_weight == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "casuarius.pyx":759
 * 
 *     def __cinit__(self, solver, suggest_var_vals,
 *         Strength default_strength=strong, double default_weight=1.0):             # <<<<<<<<<<<<<<
 *         self.solver = solver
 *         self.suggest_var_vals = suggest_var_vals
 */
      __pyx_v_default_weight = ((double)1.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.SolverEditContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_default_strength), __pyx_ptype_9casuarius_Strength, 1, "default_strength", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "casuarius.pyx":760
 *     def __cinit__(self, solver, suggest_var_vals,
 *         Strength default_strength=strong, double default_weight=1.0):
 *         self.solver = solver             # <<<<<<<<<<<<<<
 *         self.suggest_var_vals = suggest_var_vals
 *         self.default_strength = default_strength
 */
  if (!(likely(((__pyx_v_solver) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_solver, __pyx_ptype_9casuarius_Solver))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_solver);
  __Pyx_GIVEREF(__pyx_v_solver);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver));
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver = ((struct __pyx_obj_9casuarius_Solver *)__pyx_v_solver);

  /* "casuarius.pyx":761
 *         Strength default_strength=strong, double default_weight=1.0):
 *         self.solver = solver
 *         self.suggest_var_vals = suggest_var_vals             # <<<<<<<<<<<<<<
 *         self.default_strength = default_strength
 *         self.default_weight = default_weight
 */
  __Pyx_INCREF(__pyx_v_suggest_var_vals);
  __Pyx_GIVEREF(__pyx_v_suggest_var_vals);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals);
  __Pyx_DECREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals);
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals = __pyx_v_suggest_var_vals;

  /* "casuarius.pyx":762
 *         self.solver = solver
 *         self.suggest_var_vals = suggest_var_vals
 *         self.default_strength = default_strength             # <<<<<<<<<<<<<<
 *         self.default_weight = default_weight
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_default_strength));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_default_strength));
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength));
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength = __pyx_v_default_strength;

  /* "casuarius.pyx":763
 *         self.suggest_var_vals = suggest_var_vals
 *         self.default_strength = default_strength
 *         self.default_weight = default_weight             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_weight = __pyx_v_default_weight;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.SolverEditContext.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":765
 *         self.default_weight = default_weight
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         self.solver._begin_edit_suggest_values(self.suggest_var_vals, self.default_strength, self.default_weight)
 * 
 */

static PyObject *__pyx_pf_9casuarius_17SolverEditContext_1__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_9casuarius_17SolverEditContext_1__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_9casuarius_6Solver__begin_edit_suggest_values __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__enter__");

  /* "casuarius.pyx":766
 * 
 *     def __enter__(self):
 *         self.solver._begin_edit_suggest_values(self.suggest_var_vals, self.default_strength, self.default_weight)             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 */
  __pyx_t_1 = ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4.__pyx_n = 2;
  __pyx_t_4.default_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __pyx_t_4.default_weight = ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_weight;
  __pyx_t_3 = ((struct __pyx_vtabstruct_9casuarius_Solver *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver->__pyx_vtab)->_begin_edit_suggest_values(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver, __pyx_t_1, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __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("casuarius.SolverEditContext.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":768
 *         self.solver._begin_edit_suggest_values(self.suggest_var_vals, self.default_strength, self.default_weight)
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         self.solver._end_edit()
 */

static PyObject *__pyx_pf_9casuarius_17SolverEditContext_2__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_9casuarius_17SolverEditContext_2__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_exc_type = 0;
  PyObject *__pyx_v_exc_val = 0;
  PyObject *__pyx_v_exc_tb = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_val,&__pyx_n_s__exc_tb,0};
  __Pyx_RefNannySetupContext("__exit__");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_type);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_val);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_tb);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_exc_type = values[0];
    __pyx_v_exc_val = values[1];
    __pyx_v_exc_tb = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("casuarius.SolverEditContext.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "casuarius.pyx":769
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         self.solver._end_edit()             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_9casuarius_Solver *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver->__pyx_vtab)->_end_edit(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.SolverEditContext.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":753
 *     """ Context manager for suggesting variables in a solver.
 *     """
 *     cdef public Solver solver             # <<<<<<<<<<<<<<
 *     cdef public suggest_var_vals
 *     cdef public Strength default_strength
 */

static PyObject *__pyx_pf_9casuarius_17SolverEditContext_6solver___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_17SolverEditContext_6solver___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_17SolverEditContext_6solver_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext_6solver_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_9casuarius_Solver))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver));
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver = ((struct __pyx_obj_9casuarius_Solver *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.SolverEditContext.solver.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_17SolverEditContext_6solver_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext_6solver_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver));
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->solver = ((struct __pyx_obj_9casuarius_Solver *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":754
 *     """
 *     cdef public Solver solver
 *     cdef public suggest_var_vals             # <<<<<<<<<<<<<<
 *     cdef public Strength default_strength
 *     cdef public double default_weight
 */

static PyObject *__pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals);
  __pyx_r = ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals);
  __Pyx_DECREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals);
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals);
  __Pyx_DECREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals);
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->suggest_var_vals = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":755
 *     cdef public Solver solver
 *     cdef public suggest_var_vals
 *     cdef public Strength default_strength             # <<<<<<<<<<<<<<
 *     cdef public double default_weight
 * 
 */

static PyObject *__pyx_pf_9casuarius_17SolverEditContext_16default_strength___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_17SolverEditContext_16default_strength___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength));
  __pyx_r = ((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_17SolverEditContext_16default_strength_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext_16default_strength_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength));
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength = ((struct __pyx_obj_9casuarius_Strength *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.SolverEditContext.default_strength.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_17SolverEditContext_16default_strength_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext_16default_strength_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength));
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_strength = ((struct __pyx_obj_9casuarius_Strength *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "casuarius.pyx":756
 *     cdef public suggest_var_vals
 *     cdef public Strength default_strength
 *     cdef public double default_weight             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, solver, suggest_var_vals,
 */

static PyObject *__pyx_pf_9casuarius_17SolverEditContext_14default_weight___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_9casuarius_17SolverEditContext_14default_weight___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_weight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("casuarius.SolverEditContext.default_weight.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_9casuarius_17SolverEditContext_14default_weight_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_9casuarius_17SolverEditContext_14default_weight_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_9casuarius_SolverEditContext *)__pyx_v_self)->default_weight = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("casuarius.SolverEditContext.default_weight.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_9casuarius_SymbolicWeight(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_SymbolicWeight *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_SymbolicWeight *)o);
  p->weights = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_9casuarius_14SymbolicWeight___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_SymbolicWeight(PyObject *o) {
  struct __pyx_obj_9casuarius_SymbolicWeight *p = (struct __pyx_obj_9casuarius_SymbolicWeight *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_9casuarius_14SymbolicWeight_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->weights));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius_SymbolicWeight(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius_SymbolicWeight *p = (struct __pyx_obj_9casuarius_SymbolicWeight *)o;
  if (p->weights) {
    e = (*v)(p->weights, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius_SymbolicWeight(PyObject *o) {
  struct __pyx_obj_9casuarius_SymbolicWeight *p = (struct __pyx_obj_9casuarius_SymbolicWeight *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->weights);
  p->weights = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9casuarius_14SymbolicWeight_weights(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_14SymbolicWeight_7weights___get__(o);
}

static PyMethodDef __pyx_methods_9casuarius_SymbolicWeight[] = {
  {__Pyx_NAMESTR("__rmul__"), (PyCFunction)__pyx_pf_9casuarius_14SymbolicWeight_4__rmul__, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_SymbolicWeight[] = {
  {(char *)"weights", __pyx_getprop_9casuarius_14SymbolicWeight_weights, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SymbolicWeight = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  __pyx_pf_9casuarius_14SymbolicWeight_3__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_14SymbolicWeight_2__float__, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SymbolicWeight = {
  0, /*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_SymbolicWeight = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SymbolicWeight = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_SymbolicWeight = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.SymbolicWeight"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_SymbolicWeight), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_SymbolicWeight, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_14SymbolicWeight_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_SymbolicWeight, /*tp_as_number*/
  &__pyx_tp_as_sequence_SymbolicWeight, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SymbolicWeight, /*tp_as_mapping*/
  __pyx_pf_9casuarius_14SymbolicWeight_6__hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SymbolicWeight, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_SymbolicWeight, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_SymbolicWeight, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_SymbolicWeight, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_SymbolicWeight, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_SymbolicWeight, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius_Strength(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_Strength *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_Strength *)o);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->symbolic_weight = ((struct __pyx_obj_9casuarius_SymbolicWeight *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_9casuarius_8Strength___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_Strength(PyObject *o) {
  struct __pyx_obj_9casuarius_Strength *p = (struct __pyx_obj_9casuarius_Strength *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_9casuarius_8Strength_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->name));
  Py_XDECREF(((PyObject *)p->symbolic_weight));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius_Strength(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius_Strength *p = (struct __pyx_obj_9casuarius_Strength *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  if (p->symbolic_weight) {
    e = (*v)(((PyObject*)p->symbolic_weight), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius_Strength(PyObject *o) {
  struct __pyx_obj_9casuarius_Strength *p = (struct __pyx_obj_9casuarius_Strength *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->name);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->symbolic_weight);
  p->symbolic_weight = ((struct __pyx_obj_9casuarius_SymbolicWeight *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9casuarius_8Strength_name(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_8Strength_4name___get__(o);
}

static PyObject *__pyx_getprop_9casuarius_8Strength_symbolic_weight(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_8Strength_15symbolic_weight___get__(o);
}

static PyObject *__pyx_getprop_9casuarius_8Strength_is_required(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_8Strength_11is_required___get__(o);
}

static PyMethodDef __pyx_methods_9casuarius_Strength[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_Strength[] = {
  {(char *)"name", __pyx_getprop_9casuarius_8Strength_name, 0, 0, 0},
  {(char *)"symbolic_weight", __pyx_getprop_9casuarius_8Strength_symbolic_weight, 0, 0, 0},
  {(char *)"is_required", __pyx_getprop_9casuarius_8Strength_is_required, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Strength = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Strength = {
  0, /*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_Strength = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Strength = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_Strength = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.Strength"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_Strength), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_Strength, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_8Strength_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Strength, /*tp_as_number*/
  &__pyx_tp_as_sequence_Strength, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Strength, /*tp_as_mapping*/
  __pyx_pf_9casuarius_8Strength_4__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_9casuarius_8Strength_3__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Strength, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_Strength, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_Strength, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_Strength, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_Strength, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_Strength, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_LinearSymbolic __pyx_vtable_9casuarius_LinearSymbolic;

static PyObject *__pyx_tp_new_9casuarius_LinearSymbolic(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_LinearSymbolic *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_LinearSymbolic *)o);
  p->__pyx_vtab = __pyx_vtabptr_9casuarius_LinearSymbolic;
  return o;
}

static void __pyx_tp_dealloc_9casuarius_LinearSymbolic(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_9casuarius_LinearSymbolic[] = {
  {__Pyx_NAMESTR("nonlinear"), (PyCFunction)__pyx_pf_9casuarius_14LinearSymbolic_nonlinear, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("nonlinear_op"), (PyCFunction)__pyx_pf_9casuarius_14LinearSymbolic_1nonlinear_op, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("convert_to_csw"), (PyCFunction)__pyx_pf_9casuarius_14LinearSymbolic_2convert_to_csw, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_richcmp_le"), (PyCFunction)__pyx_pf_9casuarius_14LinearSymbolic_19_richcmp_le, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_richcmp_ge"), (PyCFunction)__pyx_pf_9casuarius_14LinearSymbolic_20_richcmp_ge, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_richcmp_eq"), (PyCFunction)__pyx_pf_9casuarius_14LinearSymbolic_21_richcmp_eq, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LinearSymbolic = {
  __pyx_pf_9casuarius_14LinearSymbolic_4__add__, /*nb_add*/
  __pyx_pf_9casuarius_14LinearSymbolic_8__sub__, /*nb_subtract*/
  __pyx_pf_9casuarius_14LinearSymbolic_5__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pf_9casuarius_14LinearSymbolic_6__div__, /*nb_divide*/
  #endif
  __pyx_pf_9casuarius_14LinearSymbolic_10__mod__, /*nb_remainder*/
  __pyx_pf_9casuarius_14LinearSymbolic_11__divmod__, /*nb_divmod*/
  __pyx_pf_9casuarius_14LinearSymbolic_12__pow__, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  __pyx_pf_9casuarius_14LinearSymbolic_13__lshift__, /*nb_lshift*/
  __pyx_pf_9casuarius_14LinearSymbolic_14__rshift__, /*nb_rshift*/
  __pyx_pf_9casuarius_14LinearSymbolic_15__and__, /*nb_and*/
  __pyx_pf_9casuarius_14LinearSymbolic_17__xor__, /*nb_xor*/
  __pyx_pf_9casuarius_14LinearSymbolic_16__or__, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  __pyx_pf_9casuarius_14LinearSymbolic_9__floordiv__, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_LinearSymbolic = {
  0, /*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_LinearSymbolic = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_LinearSymbolic = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_LinearSymbolic = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.LinearSymbolic"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_LinearSymbolic), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_LinearSymbolic, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_14LinearSymbolic_3__repr__, /*tp_repr*/
  &__pyx_tp_as_number_LinearSymbolic, /*tp_as_number*/
  &__pyx_tp_as_sequence_LinearSymbolic, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LinearSymbolic, /*tp_as_mapping*/
  __pyx_pf_9casuarius_14LinearSymbolic_22__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_9casuarius_14LinearSymbolic_7__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LinearSymbolic, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pf_9casuarius_14LinearSymbolic_18__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_LinearSymbolic, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_LinearSymbolic, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_ConstraintVariable __pyx_vtable_9casuarius_ConstraintVariable;

static PyObject *__pyx_tp_new_9casuarius_ConstraintVariable(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_ConstraintVariable *p;
  PyObject *o = __pyx_tp_new_9casuarius_LinearSymbolic(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_ConstraintVariable *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9casuarius_LinearSymbolic*)__pyx_vtabptr_9casuarius_ConstraintVariable;
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_9casuarius_18ConstraintVariable___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_ConstraintVariable(PyObject *o) {
  struct __pyx_obj_9casuarius_ConstraintVariable *p = (struct __pyx_obj_9casuarius_ConstraintVariable *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_9casuarius_18ConstraintVariable_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->name));
  __pyx_tp_dealloc_9casuarius_LinearSymbolic(o);
}

static int __pyx_tp_traverse_9casuarius_ConstraintVariable(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius_ConstraintVariable *p = (struct __pyx_obj_9casuarius_ConstraintVariable *)o;
  if (__pyx_ptype_9casuarius_LinearSymbolic->tp_traverse) {
    e = __pyx_ptype_9casuarius_LinearSymbolic->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius_ConstraintVariable(PyObject *o) {
  struct __pyx_obj_9casuarius_ConstraintVariable *p = (struct __pyx_obj_9casuarius_ConstraintVariable *)o;
  PyObject* tmp;
  if (__pyx_ptype_9casuarius_LinearSymbolic->tp_clear) {
    __pyx_ptype_9casuarius_LinearSymbolic->tp_clear(o);
  }
  tmp = ((PyObject*)p->name);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9casuarius_18ConstraintVariable_value(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_18ConstraintVariable_5value___get__(o);
}

static PyObject *__pyx_getprop_9casuarius_18ConstraintVariable_name(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_18ConstraintVariable_4name___get__(o);
}

static PyMethodDef __pyx_methods_9casuarius_ConstraintVariable[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_ConstraintVariable[] = {
  {(char *)"value", __pyx_getprop_9casuarius_18ConstraintVariable_value, 0, 0, 0},
  {(char *)"name", __pyx_getprop_9casuarius_18ConstraintVariable_name, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ConstraintVariable = {
  __pyx_pf_9casuarius_18ConstraintVariable_4__add__, /*nb_add*/
  0, /*nb_subtract*/
  __pyx_pf_9casuarius_18ConstraintVariable_5__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pf_9casuarius_18ConstraintVariable_6__div__, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ConstraintVariable = {
  0, /*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_ConstraintVariable = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ConstraintVariable = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_ConstraintVariable = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.ConstraintVariable"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_ConstraintVariable), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_ConstraintVariable, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_18ConstraintVariable_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_ConstraintVariable, /*tp_as_number*/
  &__pyx_tp_as_sequence_ConstraintVariable, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ConstraintVariable, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_9casuarius_18ConstraintVariable_3__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ConstraintVariable, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_ConstraintVariable, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_ConstraintVariable, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_ConstraintVariable, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_ConstraintVariable, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_ConstraintVariable, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_Term __pyx_vtable_9casuarius_Term;

static PyObject *__pyx_tp_new_9casuarius_Term(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_Term *p;
  PyObject *o = __pyx_tp_new_9casuarius_LinearSymbolic(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_Term *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9casuarius_LinearSymbolic*)__pyx_vtabptr_9casuarius_Term;
  p->var = ((struct __pyx_obj_9casuarius_ConstraintVariable *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_9casuarius_4Term___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_Term(PyObject *o) {
  struct __pyx_obj_9casuarius_Term *p = (struct __pyx_obj_9casuarius_Term *)o;
  Py_XDECREF(((PyObject *)p->var));
  __pyx_tp_dealloc_9casuarius_LinearSymbolic(o);
}

static int __pyx_tp_traverse_9casuarius_Term(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius_Term *p = (struct __pyx_obj_9casuarius_Term *)o;
  if (__pyx_ptype_9casuarius_LinearSymbolic->tp_traverse) {
    e = __pyx_ptype_9casuarius_LinearSymbolic->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->var) {
    e = (*v)(((PyObject*)p->var), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius_Term(PyObject *o) {
  struct __pyx_obj_9casuarius_Term *p = (struct __pyx_obj_9casuarius_Term *)o;
  PyObject* tmp;
  if (__pyx_ptype_9casuarius_LinearSymbolic->tp_clear) {
    __pyx_ptype_9casuarius_LinearSymbolic->tp_clear(o);
  }
  tmp = ((PyObject*)p->var);
  p->var = ((struct __pyx_obj_9casuarius_ConstraintVariable *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9casuarius_4Term_var(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_4Term_3var___get__(o);
}

static int __pyx_setprop_9casuarius_4Term_var(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_4Term_3var_1__set__(o, v);
  }
  else {
    return __pyx_pf_9casuarius_4Term_3var_2__del__(o);
  }
}

static PyObject *__pyx_getprop_9casuarius_4Term_coeff(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_4Term_5coeff___get__(o);
}

static int __pyx_setprop_9casuarius_4Term_coeff(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_4Term_5coeff_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_9casuarius_Term[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_Term[] = {
  {(char *)"var", __pyx_getprop_9casuarius_4Term_var, __pyx_setprop_9casuarius_4Term_var, 0, 0},
  {(char *)"coeff", __pyx_getprop_9casuarius_4Term_coeff, __pyx_setprop_9casuarius_4Term_coeff, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Term = {
  __pyx_pf_9casuarius_4Term_3__add__, /*nb_add*/
  0, /*nb_subtract*/
  __pyx_pf_9casuarius_4Term_4__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pf_9casuarius_4Term_5__div__, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Term = {
  0, /*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_Term = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Term = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_Term = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.Term"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_Term), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_Term, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_4Term_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Term, /*tp_as_number*/
  &__pyx_tp_as_sequence_Term, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Term, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_9casuarius_4Term_2__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Term, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_Term, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_Term, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_Term, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_Term, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_Term, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_LinearExpression __pyx_vtable_9casuarius_LinearExpression;

static PyObject *__pyx_tp_new_9casuarius_LinearExpression(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_LinearExpression *p;
  PyObject *o = __pyx_tp_new_9casuarius_LinearSymbolic(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_LinearExpression *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9casuarius_LinearSymbolic*)__pyx_vtabptr_9casuarius_LinearExpression;
  p->terms = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_9casuarius_16LinearExpression_1__cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_LinearExpression(PyObject *o) {
  struct __pyx_obj_9casuarius_LinearExpression *p = (struct __pyx_obj_9casuarius_LinearExpression *)o;
  Py_XDECREF(((PyObject *)p->terms));
  __pyx_tp_dealloc_9casuarius_LinearSymbolic(o);
}

static int __pyx_tp_traverse_9casuarius_LinearExpression(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius_LinearExpression *p = (struct __pyx_obj_9casuarius_LinearExpression *)o;
  if (__pyx_ptype_9casuarius_LinearSymbolic->tp_traverse) {
    e = __pyx_ptype_9casuarius_LinearSymbolic->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->terms) {
    e = (*v)(p->terms, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius_LinearExpression(PyObject *o) {
  struct __pyx_obj_9casuarius_LinearExpression *p = (struct __pyx_obj_9casuarius_LinearExpression *)o;
  PyObject* tmp;
  if (__pyx_ptype_9casuarius_LinearSymbolic->tp_clear) {
    __pyx_ptype_9casuarius_LinearSymbolic->tp_clear(o);
  }
  tmp = ((PyObject*)p->terms);
  p->terms = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9casuarius_16LinearExpression_value(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearExpression_5value___get__(o);
}

static PyObject *__pyx_getprop_9casuarius_16LinearExpression_terms(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearExpression_5terms___get__(o);
}

static int __pyx_setprop_9casuarius_16LinearExpression_terms(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_16LinearExpression_5terms_1__set__(o, v);
  }
  else {
    return __pyx_pf_9casuarius_16LinearExpression_5terms_2__del__(o);
  }
}

static PyObject *__pyx_getprop_9casuarius_16LinearExpression_constant(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearExpression_8constant___get__(o);
}

static int __pyx_setprop_9casuarius_16LinearExpression_constant(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_16LinearExpression_8constant_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_9casuarius_LinearExpression[] = {
  {__Pyx_NAMESTR("reduce_terms"), (PyCFunction)__pyx_pf_9casuarius_16LinearExpression_reduce_terms, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_LinearExpression[] = {
  {(char *)"value", __pyx_getprop_9casuarius_16LinearExpression_value, 0, 0, 0},
  {(char *)"terms", __pyx_getprop_9casuarius_16LinearExpression_terms, __pyx_setprop_9casuarius_16LinearExpression_terms, 0, 0},
  {(char *)"constant", __pyx_getprop_9casuarius_16LinearExpression_constant, __pyx_setprop_9casuarius_16LinearExpression_constant, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LinearExpression = {
  __pyx_pf_9casuarius_16LinearExpression_3__add__, /*nb_add*/
  0, /*nb_subtract*/
  __pyx_pf_9casuarius_16LinearExpression_4__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pf_9casuarius_16LinearExpression_5__div__, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_LinearExpression = {
  0, /*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_LinearExpression = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_LinearExpression = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_LinearExpression = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.LinearExpression"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_LinearExpression), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_LinearExpression, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_16LinearExpression_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_LinearExpression, /*tp_as_number*/
  &__pyx_tp_as_sequence_LinearExpression, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LinearExpression, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LinearExpression, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_LinearExpression, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_LinearExpression, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_LinearExpression, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_LinearExpression, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_LinearExpression, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_LinearConstraint __pyx_vtable_9casuarius_LinearConstraint;

static PyObject *__pyx_tp_new_9casuarius_LinearConstraint(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_LinearConstraint *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_LinearConstraint *)o);
  p->__pyx_vtab = __pyx_vtabptr_9casuarius_LinearConstraint;
  p->lhs = ((struct __pyx_obj_9casuarius_LinearExpression *)Py_None); Py_INCREF(Py_None);
  p->rhs = ((struct __pyx_obj_9casuarius_LinearExpression *)Py_None); Py_INCREF(Py_None);
  p->_strength = ((struct __pyx_obj_9casuarius_Strength *)Py_None); Py_INCREF(Py_None);
  p->op = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_9casuarius_16LinearConstraint___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_LinearConstraint(PyObject *o) {
  struct __pyx_obj_9casuarius_LinearConstraint *p = (struct __pyx_obj_9casuarius_LinearConstraint *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_9casuarius_16LinearConstraint_2__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->lhs));
  Py_XDECREF(((PyObject *)p->rhs));
  Py_XDECREF(((PyObject *)p->_strength));
  Py_XDECREF(((PyObject *)p->op));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius_LinearConstraint(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius_LinearConstraint *p = (struct __pyx_obj_9casuarius_LinearConstraint *)o;
  if (p->lhs) {
    e = (*v)(((PyObject*)p->lhs), a); if (e) return e;
  }
  if (p->rhs) {
    e = (*v)(((PyObject*)p->rhs), a); if (e) return e;
  }
  if (p->_strength) {
    e = (*v)(((PyObject*)p->_strength), a); if (e) return e;
  }
  if (p->op) {
    e = (*v)(p->op, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius_LinearConstraint(PyObject *o) {
  struct __pyx_obj_9casuarius_LinearConstraint *p = (struct __pyx_obj_9casuarius_LinearConstraint *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->lhs);
  p->lhs = ((struct __pyx_obj_9casuarius_LinearExpression *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rhs);
  p->rhs = ((struct __pyx_obj_9casuarius_LinearExpression *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_strength);
  p->_strength = ((struct __pyx_obj_9casuarius_Strength *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->op);
  p->op = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9casuarius_16LinearConstraint_strength(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearConstraint_8strength___get__(o);
}

static int __pyx_setprop_9casuarius_16LinearConstraint_strength(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_16LinearConstraint_8strength_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_9casuarius_16LinearConstraint_weight(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearConstraint_6weight___get__(o);
}

static int __pyx_setprop_9casuarius_16LinearConstraint_weight(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_16LinearConstraint_6weight_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_9casuarius_16LinearConstraint_lhs(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearConstraint_3lhs___get__(o);
}

static PyObject *__pyx_getprop_9casuarius_16LinearConstraint_rhs(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearConstraint_3rhs___get__(o);
}

static PyObject *__pyx_getprop_9casuarius_16LinearConstraint_op(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_16LinearConstraint_2op___get__(o);
}

static PyMethodDef __pyx_methods_9casuarius_LinearConstraint[] = {
  {__Pyx_NAMESTR("__ror__"), (PyCFunction)__pyx_pf_9casuarius_16LinearConstraint_6__ror__, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_LinearConstraint[] = {
  {(char *)"strength", __pyx_getprop_9casuarius_16LinearConstraint_strength, __pyx_setprop_9casuarius_16LinearConstraint_strength, 0, 0},
  {(char *)"weight", __pyx_getprop_9casuarius_16LinearConstraint_weight, __pyx_setprop_9casuarius_16LinearConstraint_weight, 0, 0},
  {(char *)"lhs", __pyx_getprop_9casuarius_16LinearConstraint_lhs, 0, 0, 0},
  {(char *)"rhs", __pyx_getprop_9casuarius_16LinearConstraint_rhs, 0, 0, 0},
  {(char *)"op", __pyx_getprop_9casuarius_16LinearConstraint_op, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LinearConstraint = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  __pyx_pf_9casuarius_16LinearConstraint_5__or__, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_LinearConstraint = {
  0, /*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_LinearConstraint = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_LinearConstraint = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_LinearConstraint = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.LinearConstraint"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_LinearConstraint), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_LinearConstraint, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_9casuarius_16LinearConstraint_3__repr__, /*tp_repr*/
  &__pyx_tp_as_number_LinearConstraint, /*tp_as_number*/
  &__pyx_tp_as_sequence_LinearConstraint, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LinearConstraint, /*tp_as_mapping*/
  __pyx_pf_9casuarius_16LinearConstraint_7__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_9casuarius_16LinearConstraint_4__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LinearConstraint, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_LinearConstraint, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_LinearConstraint, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_LinearConstraint, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_LinearConstraint, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_9casuarius_16LinearConstraint_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_LinearConstraint, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_LEConstraint __pyx_vtable_9casuarius_LEConstraint;

static PyObject *__pyx_tp_new_9casuarius_LEConstraint(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_LEConstraint *p;
  PyObject *o = __pyx_tp_new_9casuarius_LinearConstraint(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_LEConstraint *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9casuarius_LinearConstraint*)__pyx_vtabptr_9casuarius_LEConstraint;
  return o;
}

static PyObject *__pyx_getprop_9casuarius_12LEConstraint_error(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_12LEConstraint_5error___get__(o);
}

static PyMethodDef __pyx_methods_9casuarius_LEConstraint[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_LEConstraint[] = {
  {(char *)"error", __pyx_getprop_9casuarius_12LEConstraint_error, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LEConstraint = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_LEConstraint = {
  0, /*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_LEConstraint = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_LEConstraint = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_LEConstraint = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.LEConstraint"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_LEConstraint), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_LinearConstraint, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_LEConstraint, /*tp_as_number*/
  &__pyx_tp_as_sequence_LEConstraint, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LEConstraint, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LEConstraint, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_LinearConstraint, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_LinearConstraint, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_LEConstraint, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_LEConstraint, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_9casuarius_12LEConstraint___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_LEConstraint, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_GEConstraint __pyx_vtable_9casuarius_GEConstraint;

static PyObject *__pyx_tp_new_9casuarius_GEConstraint(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_GEConstraint *p;
  PyObject *o = __pyx_tp_new_9casuarius_LinearConstraint(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_GEConstraint *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9casuarius_LinearConstraint*)__pyx_vtabptr_9casuarius_GEConstraint;
  return o;
}

static PyObject *__pyx_getprop_9casuarius_12GEConstraint_error(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_12GEConstraint_5error___get__(o);
}

static PyMethodDef __pyx_methods_9casuarius_GEConstraint[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_GEConstraint[] = {
  {(char *)"error", __pyx_getprop_9casuarius_12GEConstraint_error, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_GEConstraint = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_GEConstraint = {
  0, /*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_GEConstraint = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_GEConstraint = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_GEConstraint = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.GEConstraint"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_GEConstraint), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_LinearConstraint, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_GEConstraint, /*tp_as_number*/
  &__pyx_tp_as_sequence_GEConstraint, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_GEConstraint, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_GEConstraint, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_LinearConstraint, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_LinearConstraint, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_GEConstraint, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_GEConstraint, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_9casuarius_12GEConstraint___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_GEConstraint, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_EQConstraint __pyx_vtable_9casuarius_EQConstraint;

static PyObject *__pyx_tp_new_9casuarius_EQConstraint(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_EQConstraint *p;
  PyObject *o = __pyx_tp_new_9casuarius_LinearConstraint(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_EQConstraint *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9casuarius_LinearConstraint*)__pyx_vtabptr_9casuarius_EQConstraint;
  return o;
}

static PyObject *__pyx_getprop_9casuarius_12EQConstraint_error(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_12EQConstraint_5error___get__(o);
}

static PyMethodDef __pyx_methods_9casuarius_EQConstraint[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_EQConstraint[] = {
  {(char *)"error", __pyx_getprop_9casuarius_12EQConstraint_error, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_EQConstraint = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_EQConstraint = {
  0, /*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_EQConstraint = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_EQConstraint = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_EQConstraint = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.EQConstraint"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_EQConstraint), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_LinearConstraint, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_EQConstraint, /*tp_as_number*/
  &__pyx_tp_as_sequence_EQConstraint, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_EQConstraint, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_EQConstraint, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius_LinearConstraint, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_LinearConstraint, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_EQConstraint, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_EQConstraint, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_9casuarius_12EQConstraint___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_EQConstraint, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_9casuarius_Solver __pyx_vtable_9casuarius_Solver;

static PyObject *__pyx_tp_new_9casuarius_Solver(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_Solver *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_Solver *)o);
  p->__pyx_vtab = __pyx_vtabptr_9casuarius_Solver;
  if (__pyx_pf_9casuarius_6Solver___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_Solver(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_9casuarius_6Solver_1__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_9casuarius_6Solver_autosolve(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_6Solver_9autosolve___get__(o);
}

static int __pyx_setprop_9casuarius_6Solver_autosolve(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_6Solver_9autosolve_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_9casuarius_6Solver_explaining(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_6Solver_10explaining___get__(o);
}

static int __pyx_setprop_9casuarius_6Solver_explaining(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_6Solver_10explaining_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_9casuarius_Solver[] = {
  {__Pyx_NAMESTR("add_constraint"), (PyCFunction)__pyx_pf_9casuarius_6Solver_3add_constraint, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("remove_constraint"), (PyCFunction)__pyx_pf_9casuarius_6Solver_4remove_constraint, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("suggest_values"), (PyCFunction)__pyx_pf_9casuarius_6Solver_5suggest_values, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_Solver[] = {
  {(char *)"autosolve", __pyx_getprop_9casuarius_6Solver_autosolve, __pyx_setprop_9casuarius_6Solver_autosolve, 0, 0},
  {(char *)"explaining", __pyx_getprop_9casuarius_6Solver_explaining, __pyx_setprop_9casuarius_6Solver_explaining, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Solver = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Solver = {
  0, /*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_Solver = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Solver = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_Solver = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.Solver"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_Solver), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_Solver, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_Solver, /*tp_as_number*/
  &__pyx_tp_as_sequence_Solver, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Solver, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_9casuarius_6Solver_2__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Solver, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|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*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_Solver, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_Solver, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_Solver, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius_SolverEditContext(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius_SolverEditContext *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius_SolverEditContext *)o);
  p->solver = ((struct __pyx_obj_9casuarius_Solver *)Py_None); Py_INCREF(Py_None);
  p->suggest_var_vals = Py_None; Py_INCREF(Py_None);
  p->default_strength = ((struct __pyx_obj_9casuarius_Strength *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_9casuarius_17SolverEditContext___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_9casuarius_SolverEditContext(PyObject *o) {
  struct __pyx_obj_9casuarius_SolverEditContext *p = (struct __pyx_obj_9casuarius_SolverEditContext *)o;
  Py_XDECREF(((PyObject *)p->solver));
  Py_XDECREF(p->suggest_var_vals);
  Py_XDECREF(((PyObject *)p->default_strength));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius_SolverEditContext(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius_SolverEditContext *p = (struct __pyx_obj_9casuarius_SolverEditContext *)o;
  if (p->solver) {
    e = (*v)(((PyObject*)p->solver), a); if (e) return e;
  }
  if (p->suggest_var_vals) {
    e = (*v)(p->suggest_var_vals, a); if (e) return e;
  }
  if (p->default_strength) {
    e = (*v)(((PyObject*)p->default_strength), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius_SolverEditContext(PyObject *o) {
  struct __pyx_obj_9casuarius_SolverEditContext *p = (struct __pyx_obj_9casuarius_SolverEditContext *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->solver);
  p->solver = ((struct __pyx_obj_9casuarius_Solver *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->suggest_var_vals);
  p->suggest_var_vals = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->default_strength);
  p->default_strength = ((struct __pyx_obj_9casuarius_Strength *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_9casuarius_17SolverEditContext_solver(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_17SolverEditContext_6solver___get__(o);
}

static int __pyx_setprop_9casuarius_17SolverEditContext_solver(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_17SolverEditContext_6solver_1__set__(o, v);
  }
  else {
    return __pyx_pf_9casuarius_17SolverEditContext_6solver_2__del__(o);
  }
}

static PyObject *__pyx_getprop_9casuarius_17SolverEditContext_suggest_var_vals(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals___get__(o);
}

static int __pyx_setprop_9casuarius_17SolverEditContext_suggest_var_vals(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals_1__set__(o, v);
  }
  else {
    return __pyx_pf_9casuarius_17SolverEditContext_16suggest_var_vals_2__del__(o);
  }
}

static PyObject *__pyx_getprop_9casuarius_17SolverEditContext_default_strength(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_17SolverEditContext_16default_strength___get__(o);
}

static int __pyx_setprop_9casuarius_17SolverEditContext_default_strength(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_17SolverEditContext_16default_strength_1__set__(o, v);
  }
  else {
    return __pyx_pf_9casuarius_17SolverEditContext_16default_strength_2__del__(o);
  }
}

static PyObject *__pyx_getprop_9casuarius_17SolverEditContext_default_weight(PyObject *o, void *x) {
  return __pyx_pf_9casuarius_17SolverEditContext_14default_weight___get__(o);
}

static int __pyx_setprop_9casuarius_17SolverEditContext_default_weight(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_9casuarius_17SolverEditContext_14default_weight_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_9casuarius_SolverEditContext[] = {
  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_9casuarius_17SolverEditContext_1__enter__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_9casuarius_17SolverEditContext_2__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_9casuarius_SolverEditContext[] = {
  {(char *)"solver", __pyx_getprop_9casuarius_17SolverEditContext_solver, __pyx_setprop_9casuarius_17SolverEditContext_solver, 0, 0},
  {(char *)"suggest_var_vals", __pyx_getprop_9casuarius_17SolverEditContext_suggest_var_vals, __pyx_setprop_9casuarius_17SolverEditContext_suggest_var_vals, 0, 0},
  {(char *)"default_strength", __pyx_getprop_9casuarius_17SolverEditContext_default_strength, __pyx_setprop_9casuarius_17SolverEditContext_default_strength, 0, 0},
  {(char *)"default_weight", __pyx_getprop_9casuarius_17SolverEditContext_default_weight, __pyx_setprop_9casuarius_17SolverEditContext_default_weight, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SolverEditContext = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SolverEditContext = {
  0, /*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_SolverEditContext = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SolverEditContext = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius_SolverEditContext = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.SolverEditContext"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius_SolverEditContext), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius_SolverEditContext, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_SolverEditContext, /*tp_as_number*/
  &__pyx_tp_as_sequence_SolverEditContext, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SolverEditContext, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SolverEditContext, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR(" Context manager for suggesting variables in a solver.\n    "), /*tp_doc*/
  __pyx_tp_traverse_9casuarius_SolverEditContext, /*tp_traverse*/
  __pyx_tp_clear_9casuarius_SolverEditContext, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius_SolverEditContext, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_9casuarius_SolverEditContext, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius_SolverEditContext, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius___pyx_scope_struct____mul__(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *)o);
  p->__pyx_v_self = 0;
  return o;
}

static void __pyx_tp_dealloc_9casuarius___pyx_scope_struct____mul__(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *p = (struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *)o;
  Py_XDECREF(p->__pyx_v_self);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius___pyx_scope_struct____mul__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *p = (struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius___pyx_scope_struct____mul__(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *p = (struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_9casuarius___pyx_scope_struct____mul__[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct____mul__ = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct____mul__ = {
  0, /*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___pyx_scope_struct____mul__ = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct____mul__ = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius___pyx_scope_struct____mul__ = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.__pyx_scope_struct____mul__"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius___pyx_scope_struct____mul__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius___pyx_scope_struct____mul__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_scope_struct____mul__, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct____mul__, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct____mul__, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct____mul__, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius___pyx_scope_struct____mul__, /*tp_traverse*/
  __pyx_tp_clear_9casuarius___pyx_scope_struct____mul__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius___pyx_scope_struct____mul__, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius___pyx_scope_struct____mul__, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius___pyx_Generator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_Generator_object *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_Generator_object *)o);
  p->exc_type = 0;
  p->exc_value = 0;
  p->exc_traceback = 0;
  return o;
}

static void __pyx_tp_dealloc_9casuarius___pyx_Generator(PyObject *o) {
  struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o;
  Py_XDECREF(p->exc_type);
  Py_XDECREF(p->exc_value);
  Py_XDECREF(p->exc_traceback);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius___pyx_Generator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o;
  if (p->exc_type) {
    e = (*v)(p->exc_type, a); if (e) return e;
  }
  if (p->exc_value) {
    e = (*v)(p->exc_value, a); if (e) return e;
  }
  if (p->exc_traceback) {
    e = (*v)(p->exc_traceback, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius___pyx_Generator(PyObject *o) {
  struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->exc_type);
  p->exc_type = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->exc_value);
  p->exc_value = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->exc_traceback);
  p->exc_traceback = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_9casuarius___pyx_Generator[] = {
  {__Pyx_NAMESTR("send"), (PyCFunction)__Pyx_Generator_Send, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__Pyx_Generator_Close, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("throw"), (PyCFunction)__Pyx_Generator_Throw, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_Generator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_Generator = {
  0, /*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___pyx_Generator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_Generator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_Generator_type = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.__pyx_Generator"), /*tp_name*/
  sizeof(struct __pyx_Generator_object), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius___pyx_Generator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_Generator, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_Generator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_Generator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_Generator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius___pyx_Generator, /*tp_traverse*/
  __pyx_tp_clear_9casuarius___pyx_Generator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  PyObject_SelfIter, /*tp_iter*/
  __Pyx_Generator_Next, /*tp_iternext*/
  __pyx_methods_9casuarius___pyx_Generator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius___pyx_Generator, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *p;
  PyObject *o = __pyx_tp_new_9casuarius___pyx_Generator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *)o);
  p->__pyx_outer_scope = 0;
  p->__pyx_v_x = 0;
  p->__pyx_t_0 = 0;
  return o;
}

static void __pyx_tp_dealloc_9casuarius___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *)o;
  Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
  Py_XDECREF(p->__pyx_v_x);
  Py_XDECREF(p->__pyx_t_0);
  __pyx_tp_dealloc_9casuarius___pyx_Generator(o);
}

static int __pyx_tp_traverse_9casuarius___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *)o;
  e = __pyx_tp_traverse_9casuarius___pyx_Generator(o, 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_v_x) {
    e = (*v)(p->__pyx_v_x, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr *)o;
  PyObject* tmp;
  __pyx_tp_clear_9casuarius___pyx_Generator(o);
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9casuarius___pyx_scope_struct____mul__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_x);
  p->__pyx_v_x = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_9casuarius___pyx_scope_struct_1_genexpr[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_genexpr = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_genexpr = {
  0, /*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___pyx_scope_struct_1_genexpr = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_genexpr = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.__pyx_scope_struct_1_genexpr"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_scope_struct_1_genexpr, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_1_genexpr, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_1_genexpr, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct_1_genexpr, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9casuarius___pyx_scope_struct_1_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius___pyx_scope_struct_1_genexpr, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius___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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius___pyx_scope_struct_2_reduce_terms(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *)o);
  p->__pyx_v_mapping = 0;
  return o;
}

static void __pyx_tp_dealloc_9casuarius___pyx_scope_struct_2_reduce_terms(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *)o;
  Py_XDECREF(p->__pyx_v_mapping);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius___pyx_scope_struct_2_reduce_terms(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *)o;
  if (p->__pyx_v_mapping) {
    e = (*v)(p->__pyx_v_mapping, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius___pyx_scope_struct_2_reduce_terms(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_mapping);
  p->__pyx_v_mapping = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_9casuarius___pyx_scope_struct_2_reduce_terms[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_2_reduce_terms = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_2_reduce_terms = {
  0, /*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___pyx_scope_struct_2_reduce_terms = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2_reduce_terms = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius___pyx_scope_struct_2_reduce_terms = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.__pyx_scope_struct_2_reduce_terms"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius___pyx_scope_struct_2_reduce_terms, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_scope_struct_2_reduce_terms, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_2_reduce_terms, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_2_reduce_terms, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct_2_reduce_terms, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius___pyx_scope_struct_2_reduce_terms, /*tp_traverse*/
  __pyx_tp_clear_9casuarius___pyx_scope_struct_2_reduce_terms, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius___pyx_scope_struct_2_reduce_terms, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius___pyx_scope_struct_2_reduce_terms, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *p;
  PyObject *o = __pyx_tp_new_9casuarius___pyx_Generator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *)o);
  p->__pyx_outer_scope = 0;
  p->__pyx_v_coeff = 0;
  p->__pyx_v_var = 0;
  p->__pyx_t_0 = 0;
  return o;
}

static void __pyx_tp_dealloc_9casuarius___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *)o;
  Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
  Py_XDECREF(p->__pyx_v_coeff);
  Py_XDECREF(p->__pyx_v_var);
  Py_XDECREF(p->__pyx_t_0);
  __pyx_tp_dealloc_9casuarius___pyx_Generator(o);
}

static int __pyx_tp_traverse_9casuarius___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *)o;
  e = __pyx_tp_traverse_9casuarius___pyx_Generator(o, 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_v_coeff) {
    e = (*v)(p->__pyx_v_coeff, a); if (e) return e;
  }
  if (p->__pyx_v_var) {
    e = (*v)(p->__pyx_v_var, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr *)o;
  PyObject* tmp;
  __pyx_tp_clear_9casuarius___pyx_Generator(o);
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9casuarius___pyx_scope_struct_2_reduce_terms *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_coeff);
  p->__pyx_v_coeff = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_var);
  p->__pyx_v_var = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_9casuarius___pyx_scope_struct_3_genexpr[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_genexpr = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_3_genexpr = {
  0, /*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___pyx_scope_struct_3_genexpr = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_genexpr = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.__pyx_scope_struct_3_genexpr"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_scope_struct_3_genexpr, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_3_genexpr, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_3_genexpr, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct_3_genexpr, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9casuarius___pyx_scope_struct_3_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius___pyx_scope_struct_3_genexpr, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius___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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius___pyx_scope_struct_4___repr__(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *)o);
  p->__pyx_v_s = 0;
  return o;
}

static void __pyx_tp_dealloc_9casuarius___pyx_scope_struct_4___repr__(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *)o;
  Py_XDECREF(p->__pyx_v_s);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_9casuarius___pyx_scope_struct_4___repr__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *)o;
  if (p->__pyx_v_s) {
    e = (*v)(p->__pyx_v_s, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius___pyx_scope_struct_4___repr__(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_s);
  p->__pyx_v_s = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_9casuarius___pyx_scope_struct_4___repr__[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_4___repr__ = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_4___repr__ = {
  0, /*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___pyx_scope_struct_4___repr__ = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_4___repr__ = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius___pyx_scope_struct_4___repr__ = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.__pyx_scope_struct_4___repr__"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius___pyx_scope_struct_4___repr__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_scope_struct_4___repr__, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_4___repr__, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_4___repr__, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct_4___repr__, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius___pyx_scope_struct_4___repr__, /*tp_traverse*/
  __pyx_tp_clear_9casuarius___pyx_scope_struct_4___repr__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius___pyx_scope_struct_4___repr__, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius___pyx_scope_struct_4___repr__, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_9casuarius___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *p;
  PyObject *o = __pyx_tp_new_9casuarius___pyx_Generator(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *)o);
  p->__pyx_outer_scope = 0;
  p->__pyx_v_term = 0;
  p->__pyx_t_0 = 0;
  return o;
}

static void __pyx_tp_dealloc_9casuarius___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *)o;
  Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
  Py_XDECREF(p->__pyx_v_term);
  Py_XDECREF(p->__pyx_t_0);
  __pyx_tp_dealloc_9casuarius___pyx_Generator(o);
}

static int __pyx_tp_traverse_9casuarius___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *)o;
  e = __pyx_tp_traverse_9casuarius___pyx_Generator(o, 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_v_term) {
    e = (*v)(p->__pyx_v_term, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_9casuarius___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr *)o;
  PyObject* tmp;
  __pyx_tp_clear_9casuarius___pyx_Generator(o);
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_9casuarius___pyx_scope_struct_4___repr__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_term);
  p->__pyx_v_term = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_9casuarius___pyx_scope_struct_5_genexpr[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_5_genexpr = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_5_genexpr = {
  0, /*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___pyx_scope_struct_5_genexpr = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_5_genexpr = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_9casuarius___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("casuarius.__pyx_scope_struct_5_genexpr"), /*tp_name*/
  sizeof(struct __pyx_obj_9casuarius___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_9casuarius___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number___pyx_scope_struct_5_genexpr, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_5_genexpr, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_5_genexpr, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct_5_genexpr, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_9casuarius___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  __pyx_tp_clear_9casuarius___pyx_scope_struct_5_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_9casuarius___pyx_scope_struct_5_genexpr, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_9casuarius___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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("casuarius"),
    __Pyx_DOCSTR(__pyx_k_55), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
  {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
  {&__pyx_kp_b_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 0, 0},
  {&__pyx_kp_b_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 0, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_b_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 0, 0},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_n_s__CassowaryError, __pyx_k__CassowaryError, sizeof(__pyx_k__CassowaryError), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s__STRENGTH_MAP, __pyx_k__STRENGTH_MAP, sizeof(__pyx_k__STRENGTH_MAP), 0, 0, 1, 1},
  {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____mul__, __pyx_k____mul__, sizeof(__pyx_k____mul__), 0, 0, 1, 1},
  {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
  {&__pyx_n_s____or__, __pyx_k____or__, sizeof(__pyx_k____or__), 0, 0, 1, 1},
  {&__pyx_n_s____repr__, __pyx_k____repr__, sizeof(__pyx_k____repr__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s___richcmp_eq, __pyx_k___richcmp_eq, sizeof(__pyx_k___richcmp_eq), 0, 0, 1, 1},
  {&__pyx_n_s___richcmp_ge, __pyx_k___richcmp_ge, sizeof(__pyx_k___richcmp_ge), 0, 0, 1, 1},
  {&__pyx_n_s___richcmp_le, __pyx_k___richcmp_le, sizeof(__pyx_k___richcmp_le), 0, 0, 1, 1},
  {&__pyx_n_s__attrgetter, __pyx_k__attrgetter, sizeof(__pyx_k__attrgetter), 0, 0, 1, 1},
  {&__pyx_n_s__autosolve, __pyx_k__autosolve, sizeof(__pyx_k__autosolve), 0, 0, 1, 1},
  {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1},
  {&__pyx_n_s__casuarius, __pyx_k__casuarius, sizeof(__pyx_k__casuarius), 0, 0, 1, 1},
  {&__pyx_n_s__coeff, __pyx_k__coeff, sizeof(__pyx_k__coeff), 0, 0, 1, 1},
  {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
  {&__pyx_n_s__constant, __pyx_k__constant, sizeof(__pyx_k__constant), 0, 0, 1, 1},
  {&__pyx_n_s__default_strength, __pyx_k__default_strength, sizeof(__pyx_k__default_strength), 0, 0, 1, 1},
  {&__pyx_n_s__default_weight, __pyx_k__default_weight, sizeof(__pyx_k__default_weight), 0, 0, 1, 1},
  {&__pyx_n_s__defaultdict, __pyx_k__defaultdict, sizeof(__pyx_k__defaultdict), 0, 0, 1, 1},
  {&__pyx_n_s__divmod, __pyx_k__divmod, sizeof(__pyx_k__divmod), 0, 0, 1, 1},
  {&__pyx_n_s__exc_tb, __pyx_k__exc_tb, sizeof(__pyx_k__exc_tb), 0, 0, 1, 1},
  {&__pyx_n_s__exc_type, __pyx_k__exc_type, sizeof(__pyx_k__exc_type), 0, 0, 1, 1},
  {&__pyx_n_s__exc_val, __pyx_k__exc_val, sizeof(__pyx_k__exc_val), 0, 0, 1, 1},
  {&__pyx_n_s__explaining, __pyx_k__explaining, sizeof(__pyx_k__explaining), 0, 0, 1, 1},
  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
  {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
  {&__pyx_n_s__is_required, __pyx_k__is_required, sizeof(__pyx_k__is_required), 0, 0, 1, 1},
  {&__pyx_n_s__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 0, 0, 1, 1},
  {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
  {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
  {&__pyx_n_s__lhs, __pyx_k__lhs, sizeof(__pyx_k__lhs), 0, 0, 1, 1},
  {&__pyx_n_s__medium, __pyx_k__medium, sizeof(__pyx_k__medium), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__nonlinear, __pyx_k__nonlinear, sizeof(__pyx_k__nonlinear), 0, 0, 1, 1},
  {&__pyx_n_s__nonlinear_op, __pyx_k__nonlinear_op, sizeof(__pyx_k__nonlinear_op), 0, 0, 1, 1},
  {&__pyx_n_s__operator, __pyx_k__operator, sizeof(__pyx_k__operator), 0, 0, 1, 1},
  {&__pyx_n_s__reduce_terms, __pyx_k__reduce_terms, sizeof(__pyx_k__reduce_terms), 0, 0, 1, 1},
  {&__pyx_n_s__required, __pyx_k__required, sizeof(__pyx_k__required), 0, 0, 1, 1},
  {&__pyx_n_s__rhs, __pyx_k__rhs, sizeof(__pyx_k__rhs), 0, 0, 1, 1},
  {&__pyx_n_s__solver, __pyx_k__solver, sizeof(__pyx_k__solver), 0, 0, 1, 1},
  {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
  {&__pyx_n_s__strength, __pyx_k__strength, sizeof(__pyx_k__strength), 0, 0, 1, 1},
  {&__pyx_n_s__strong, __pyx_k__strong, sizeof(__pyx_k__strong), 0, 0, 1, 1},
  {&__pyx_n_s__suggest_var_vals, __pyx_k__suggest_var_vals, sizeof(__pyx_k__suggest_var_vals), 0, 0, 1, 1},
  {&__pyx_n_s__symbolic_weight, __pyx_k__symbolic_weight, sizeof(__pyx_k__symbolic_weight), 0, 0, 1, 1},
  {&__pyx_n_s__terms, __pyx_k__terms, sizeof(__pyx_k__terms), 0, 0, 1, 1},
  {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
  {&__pyx_n_s__var, __pyx_k__var, sizeof(__pyx_k__var), 0, 0, 1, 1},
  {&__pyx_n_s__var_vals, __pyx_k__var_vals, sizeof(__pyx_k__var_vals), 0, 0, 1, 1},
  {&__pyx_n_s__weak, __pyx_k__weak, sizeof(__pyx_k__weak), 0, 0, 1, 1},
  {&__pyx_n_s__weight, __pyx_k__weight, sizeof(__pyx_k__weight), 0, 0, 1, 1},
  {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_basestring = __Pyx_GetName(__pyx_b, __pyx_n_s__basestring); if (!__pyx_builtin_basestring) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");

  /* "casuarius.pyx":233
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('//')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));

  /* "casuarius.pyx":239
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('%')             # <<<<<<<<<<<<<<
 * 
 *     def __divmod__(self, other):
 */
  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));

  /* "casuarius.pyx":244
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('divmod')             # <<<<<<<<<<<<<<
 * 
 *     def __pow__(self, other, mod):
 */
  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__divmod));
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_n_s__divmod));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__divmod));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "casuarius.pyx":249
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('**')             # <<<<<<<<<<<<<<
 * 
 *     def __lshift__(self, other):
 */
  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));

  /* "casuarius.pyx":254
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('<<')             # <<<<<<<<<<<<<<
 * 
 *     def __rshift__(self, other):
 */
  __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));

  /* "casuarius.pyx":259
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('>>')             # <<<<<<<<<<<<<<
 * 
 *     def __and__(self, other):
 */
  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

  /* "casuarius.pyx":264
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('&')             # <<<<<<<<<<<<<<
 * 
 *     def __or__(self, other):
 */
  __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));

  /* "casuarius.pyx":269
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('|')             # <<<<<<<<<<<<<<
 * 
 *     def __xor__(self, other):
 */
  __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));

  /* "casuarius.pyx":274
 *         if not isinstance(self, LinearSymbolic):
 *             self = other
 *         self.nonlinear_op('^')             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_21));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "casuarius.pyx":278
 *     def __richcmp__(self, other, int op):
 *         if op == 0 or op == 4 or op == 3:
 *             raise ValueError('Invalid constraint operation.')             # <<<<<<<<<<<<<<
 *         elif op == 2:
 *             return self._richcmp_eq(other)
 */
  __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));

  /* "casuarius.pyx":470
 *     def __repr__(self):
 *         if len(self.terms) > 0:
 *             s = sorted(self.terms, key=operator.attrgetter('var.name'))             # <<<<<<<<<<<<<<
 *             terms = ' + '.join(str(term) for term in s)
 *             if self.constant > 0.0:
 */
  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_35));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcasuarius(void); /*proto*/
PyMODINIT_FUNC initcasuarius(void)
#else
PyMODINIT_FUNC PyInit_casuarius(void); /*proto*/
PyMODINIT_FUNC PyInit_casuarius(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  #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("PyMODINIT_FUNC PyInit_casuarius(void)");
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __pyx_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("casuarius"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_55), 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_casuarius) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_9casuarius_SymbolicWeight) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SymbolicWeight", (PyObject *)&__pyx_type_9casuarius_SymbolicWeight) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_SymbolicWeight = &__pyx_type_9casuarius_SymbolicWeight;
  if (PyType_Ready(&__pyx_type_9casuarius_Strength) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Strength", (PyObject *)&__pyx_type_9casuarius_Strength) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_Strength = &__pyx_type_9casuarius_Strength;
  __pyx_vtabptr_9casuarius_LinearSymbolic = &__pyx_vtable_9casuarius_LinearSymbolic;
  __pyx_vtable_9casuarius_LinearSymbolic._richcmp_le = (struct __pyx_obj_9casuarius_LinearConstraint *(*)(struct __pyx_obj_9casuarius_LinearSymbolic *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9casuarius_14LinearSymbolic__richcmp_le;
  __pyx_vtable_9casuarius_LinearSymbolic._richcmp_ge = (struct __pyx_obj_9casuarius_LinearConstraint *(*)(struct __pyx_obj_9casuarius_LinearSymbolic *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9casuarius_14LinearSymbolic__richcmp_ge;
  __pyx_vtable_9casuarius_LinearSymbolic._richcmp_eq = (struct __pyx_obj_9casuarius_LinearConstraint *(*)(struct __pyx_obj_9casuarius_LinearSymbolic *, PyObject *, int __pyx_skip_dispatch))__pyx_f_9casuarius_14LinearSymbolic__richcmp_eq;
  if (PyType_Ready(&__pyx_type_9casuarius_LinearSymbolic) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_LinearSymbolic.tp_dict, __pyx_vtabptr_9casuarius_LinearSymbolic) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "LinearSymbolic", (PyObject *)&__pyx_type_9casuarius_LinearSymbolic) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_LinearSymbolic = &__pyx_type_9casuarius_LinearSymbolic;
  __pyx_vtabptr_9casuarius_ConstraintVariable = &__pyx_vtable_9casuarius_ConstraintVariable;
  __pyx_vtable_9casuarius_ConstraintVariable.__pyx_base = *__pyx_vtabptr_9casuarius_LinearSymbolic;
  __pyx_type_9casuarius_ConstraintVariable.tp_base = __pyx_ptype_9casuarius_LinearSymbolic;
  if (PyType_Ready(&__pyx_type_9casuarius_ConstraintVariable) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_ConstraintVariable.tp_dict, __pyx_vtabptr_9casuarius_ConstraintVariable) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ConstraintVariable", (PyObject *)&__pyx_type_9casuarius_ConstraintVariable) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_ConstraintVariable = &__pyx_type_9casuarius_ConstraintVariable;
  __pyx_vtabptr_9casuarius_Term = &__pyx_vtable_9casuarius_Term;
  __pyx_vtable_9casuarius_Term.__pyx_base = *__pyx_vtabptr_9casuarius_LinearSymbolic;
  __pyx_type_9casuarius_Term.tp_base = __pyx_ptype_9casuarius_LinearSymbolic;
  if (PyType_Ready(&__pyx_type_9casuarius_Term) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_Term.tp_dict, __pyx_vtabptr_9casuarius_Term) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Term", (PyObject *)&__pyx_type_9casuarius_Term) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_Term = &__pyx_type_9casuarius_Term;
  __pyx_vtabptr_9casuarius_LinearExpression = &__pyx_vtable_9casuarius_LinearExpression;
  __pyx_vtable_9casuarius_LinearExpression.__pyx_base = *__pyx_vtabptr_9casuarius_LinearSymbolic;
  __pyx_vtable_9casuarius_LinearExpression.as_cl_linear_expression = (P_LinearExpression (*)(struct __pyx_obj_9casuarius_LinearExpression *))__pyx_f_9casuarius_16LinearExpression_as_cl_linear_expression;
  __pyx_type_9casuarius_LinearExpression.tp_base = __pyx_ptype_9casuarius_LinearSymbolic;
  if (PyType_Ready(&__pyx_type_9casuarius_LinearExpression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_LinearExpression.tp_dict, __pyx_vtabptr_9casuarius_LinearExpression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "LinearExpression", (PyObject *)&__pyx_type_9casuarius_LinearExpression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_LinearExpression = &__pyx_type_9casuarius_LinearExpression;
  __pyx_vtabptr_9casuarius_LinearConstraint = &__pyx_vtable_9casuarius_LinearConstraint;
  __pyx_vtable_9casuarius_LinearConstraint.as_cl_linear_constraint = (P_Constraint *(*)(struct __pyx_obj_9casuarius_LinearConstraint *))__pyx_f_9casuarius_16LinearConstraint_as_cl_linear_constraint;
  if (PyType_Ready(&__pyx_type_9casuarius_LinearConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_LinearConstraint.tp_dict, __pyx_vtabptr_9casuarius_LinearConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "LinearConstraint", (PyObject *)&__pyx_type_9casuarius_LinearConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_LinearConstraint = &__pyx_type_9casuarius_LinearConstraint;
  __pyx_vtabptr_9casuarius_LEConstraint = &__pyx_vtable_9casuarius_LEConstraint;
  __pyx_vtable_9casuarius_LEConstraint.__pyx_base = *__pyx_vtabptr_9casuarius_LinearConstraint;
  __pyx_vtable_9casuarius_LEConstraint.__pyx_base.as_cl_linear_constraint = (P_Constraint *(*)(struct __pyx_obj_9casuarius_LinearConstraint *))__pyx_f_9casuarius_12LEConstraint_as_cl_linear_constraint;
  __pyx_type_9casuarius_LEConstraint.tp_base = __pyx_ptype_9casuarius_LinearConstraint;
  if (PyType_Ready(&__pyx_type_9casuarius_LEConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_LEConstraint.tp_dict, __pyx_vtabptr_9casuarius_LEConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "LEConstraint", (PyObject *)&__pyx_type_9casuarius_LEConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_LEConstraint = &__pyx_type_9casuarius_LEConstraint;
  __pyx_vtabptr_9casuarius_GEConstraint = &__pyx_vtable_9casuarius_GEConstraint;
  __pyx_vtable_9casuarius_GEConstraint.__pyx_base = *__pyx_vtabptr_9casuarius_LinearConstraint;
  __pyx_vtable_9casuarius_GEConstraint.__pyx_base.as_cl_linear_constraint = (P_Constraint *(*)(struct __pyx_obj_9casuarius_LinearConstraint *))__pyx_f_9casuarius_12GEConstraint_as_cl_linear_constraint;
  __pyx_type_9casuarius_GEConstraint.tp_base = __pyx_ptype_9casuarius_LinearConstraint;
  if (PyType_Ready(&__pyx_type_9casuarius_GEConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_GEConstraint.tp_dict, __pyx_vtabptr_9casuarius_GEConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GEConstraint", (PyObject *)&__pyx_type_9casuarius_GEConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_GEConstraint = &__pyx_type_9casuarius_GEConstraint;
  __pyx_vtabptr_9casuarius_EQConstraint = &__pyx_vtable_9casuarius_EQConstraint;
  __pyx_vtable_9casuarius_EQConstraint.__pyx_base = *__pyx_vtabptr_9casuarius_LinearConstraint;
  __pyx_vtable_9casuarius_EQConstraint.__pyx_base.as_cl_linear_constraint = (P_Constraint *(*)(struct __pyx_obj_9casuarius_LinearConstraint *))__pyx_f_9casuarius_12EQConstraint_as_cl_linear_constraint;
  __pyx_type_9casuarius_EQConstraint.tp_base = __pyx_ptype_9casuarius_LinearConstraint;
  if (PyType_Ready(&__pyx_type_9casuarius_EQConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_EQConstraint.tp_dict, __pyx_vtabptr_9casuarius_EQConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "EQConstraint", (PyObject *)&__pyx_type_9casuarius_EQConstraint) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_EQConstraint = &__pyx_type_9casuarius_EQConstraint;
  __pyx_vtabptr_9casuarius_Solver = &__pyx_vtable_9casuarius_Solver;
  __pyx_vtable_9casuarius_Solver._begin_edit_suggest_values = (PyObject *(*)(struct __pyx_obj_9casuarius_Solver *, PyObject *, struct __pyx_opt_args_9casuarius_6Solver__begin_edit_suggest_values *__pyx_optional_args))__pyx_f_9casuarius_6Solver__begin_edit_suggest_values;
  __pyx_vtable_9casuarius_Solver._end_edit = (PyObject *(*)(struct __pyx_obj_9casuarius_Solver *))__pyx_f_9casuarius_6Solver__end_edit;
  if (PyType_Ready(&__pyx_type_9casuarius_Solver) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_9casuarius_Solver.tp_dict, __pyx_vtabptr_9casuarius_Solver) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Solver", (PyObject *)&__pyx_type_9casuarius_Solver) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_Solver = &__pyx_type_9casuarius_Solver;
  if (PyType_Ready(&__pyx_type_9casuarius_SolverEditContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SolverEditContext", (PyObject *)&__pyx_type_9casuarius_SolverEditContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius_SolverEditContext = &__pyx_type_9casuarius_SolverEditContext;
  if (PyType_Ready(&__pyx_type_9casuarius___pyx_scope_struct____mul__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius___pyx_scope_struct____mul__ = &__pyx_type_9casuarius___pyx_scope_struct____mul__;
  if (PyType_Ready(&__pyx_Generator_type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius___pyx_Generator = &__pyx_Generator_type;
  __pyx_type_9casuarius___pyx_scope_struct_1_genexpr.tp_base = __pyx_ptype_9casuarius___pyx_Generator;
  if (PyType_Ready(&__pyx_type_9casuarius___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius___pyx_scope_struct_1_genexpr = &__pyx_type_9casuarius___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_9casuarius___pyx_scope_struct_2_reduce_terms) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius___pyx_scope_struct_2_reduce_terms = &__pyx_type_9casuarius___pyx_scope_struct_2_reduce_terms;
  __pyx_type_9casuarius___pyx_scope_struct_3_genexpr.tp_base = __pyx_ptype_9casuarius___pyx_Generator;
  if (PyType_Ready(&__pyx_type_9casuarius___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius___pyx_scope_struct_3_genexpr = &__pyx_type_9casuarius___pyx_scope_struct_3_genexpr;
  if (PyType_Ready(&__pyx_type_9casuarius___pyx_scope_struct_4___repr__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius___pyx_scope_struct_4___repr__ = &__pyx_type_9casuarius___pyx_scope_struct_4___repr__;
  __pyx_type_9casuarius___pyx_scope_struct_5_genexpr.tp_base = __pyx_ptype_9casuarius___pyx_Generator;
  if (PyType_Ready(&__pyx_type_9casuarius___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9casuarius___pyx_scope_struct_5_genexpr = &__pyx_type_9casuarius___pyx_scope_struct_5_genexpr;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "casuarius.pyx":9
 * from libcpp.vector cimport vector
 * 
 * import operator             # <<<<<<<<<<<<<<
 * from collections import defaultdict
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__operator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":10
 * 
 * import operator
 * from collections import defaultdict             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__defaultdict));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__defaultdict));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__defaultdict));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__defaultdict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "casuarius.pyx":17
 * 
 * 
 * class CassowaryError(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__CassowaryError, __pyx_n_s__casuarius); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CassowaryError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "casuarius.pyx":184
 * 
 * 
 * required = Strength('required', SymbolicWeight((1000.0, 1000.0, 1000.0)), is_required=True)             # <<<<<<<<<<<<<<
 * strong = Strength('strong', SymbolicWeight((1.0, 0.0, 0.0)))
 * medium = Strength('medium', SymbolicWeight((0.0, 1.0, 0.0)))
 */
  __pyx_t_2 = PyFloat_FromDouble(1000.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(1000.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyFloat_FromDouble(1000.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_SymbolicWeight)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__required));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__required));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__required));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__is_required), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Strength)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__required, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "casuarius.pyx":185
 * 
 * required = Strength('required', SymbolicWeight((1000.0, 1000.0, 1000.0)), is_required=True)
 * strong = Strength('strong', SymbolicWeight((1.0, 0.0, 0.0)))             # <<<<<<<<<<<<<<
 * medium = Strength('medium', SymbolicWeight((0.0, 1.0, 0.0)))
 * weak = Strength('weak', SymbolicWeight((0.0, 0.0, 1.0)))
 */
  __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_SymbolicWeight)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__strong));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__strong));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strong));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Strength)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__strong, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "casuarius.pyx":186
 * required = Strength('required', SymbolicWeight((1000.0, 1000.0, 1000.0)), is_required=True)
 * strong = Strength('strong', SymbolicWeight((1.0, 0.0, 0.0)))
 * medium = Strength('medium', SymbolicWeight((0.0, 1.0, 0.0)))             # <<<<<<<<<<<<<<
 * weak = Strength('weak', SymbolicWeight((0.0, 0.0, 1.0)))
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_SymbolicWeight)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__medium));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__medium));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__medium));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Strength)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__medium, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "casuarius.pyx":187
 * strong = Strength('strong', SymbolicWeight((1.0, 0.0, 0.0)))
 * medium = Strength('medium', SymbolicWeight((0.0, 1.0, 0.0)))
 * weak = Strength('weak', SymbolicWeight((0.0, 0.0, 1.0)))             # <<<<<<<<<<<<<<
 * 
 * STRENGTH_MAP = dict(
 */
  __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_SymbolicWeight)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weak));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__weak));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weak));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9casuarius_Strength)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weak, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "casuarius.pyx":189
 * weak = Strength('weak', SymbolicWeight((0.0, 0.0, 1.0)))
 * 
 * STRENGTH_MAP = dict(             # <<<<<<<<<<<<<<
 *     required=required,
 *     strong=strong,
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));

  /* "casuarius.pyx":190
 * 
 * STRENGTH_MAP = dict(
 *     required=required,             # <<<<<<<<<<<<<<
 *     strong=strong,
 *     medium=medium,
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__required); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__required), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":191
 * STRENGTH_MAP = dict(
 *     required=required,
 *     strong=strong,             # <<<<<<<<<<<<<<
 *     medium=medium,
 *     weak=weak,
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__strong); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__strong), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":192
 *     required=required,
 *     strong=strong,
 *     medium=medium,             # <<<<<<<<<<<<<<
 *     weak=weak,
 * )
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__medium); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__medium), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "casuarius.pyx":193
 *     strong=strong,
 *     medium=medium,
 *     weak=weak,             # <<<<<<<<<<<<<<
 * )
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__weak); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__weak), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__STRENGTH_MAP, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "casuarius.pyx":457
 *         return terms
 * 
 *     def __cinit__(self, terms, constant=0.0):             # <<<<<<<<<<<<<<
 *         self.terms = self.reduce_terms(terms)
 *         self.constant = constant
 */
  __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_k_34 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":562
 *         self.rhs = as_linear_expression(rhs)
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         self._strength = strength
 *         self._weight = weight
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__required); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_41 = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":622
 * cdef class LEConstraint(LinearConstraint):
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'<='
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__required); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_46 = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":640
 * cdef class GEConstraint(LinearConstraint):
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'>='
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__required); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_48 = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":658
 * cdef class EQConstraint(LinearConstraint):
 * 
 *     def __init__(self, lhs, rhs, Strength strength=required, double weight=1.0):             # <<<<<<<<<<<<<<
 *         LinearConstraint.__init__(self, lhs, rhs, strength, weight)
 *         self.op = b'=='
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__required); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_50 = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":712
 *         self.solver.RemoveConstraint(deref(constraint.cl_linear_constraint))
 * 
 *     def suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):             # <<<<<<<<<<<<<<
 *         return SolverEditContext(self, var_vals, default_strength, default_weight)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__strong); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_52 = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":715
 *         return SolverEditContext(self, var_vals, default_strength, default_weight)
 * 
 *     cdef object _begin_edit_suggest_values(self, var_vals, Strength default_strength=strong, double default_weight=1.0):             # <<<<<<<<<<<<<<
 *         cdef ConstraintVariable variable
 *         cdef double value
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__strong); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_53 = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":759
 * 
 *     def __cinit__(self, solver, suggest_var_vals,
 *         Strength default_strength=strong, double default_weight=1.0):             # <<<<<<<<<<<<<<
 *         self.solver = solver
 *         self.suggest_var_vals = suggest_var_vals
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__strong); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9casuarius_Strength))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_54 = ((struct __pyx_obj_9casuarius_Strength *)__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "casuarius.pyx":1
 * """ Cython wrapper for Cassowary.             # <<<<<<<<<<<<<<
 * """
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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);
  if (__pyx_m) {
    __Pyx_AddTraceback("init casuarius", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init casuarius");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */

#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    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);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    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)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        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;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

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,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}


static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
    if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
        return PyFloat_AsDouble(obj);
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else if (PyErr_Occurred()) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        PyObject *py_level = PyInt_FromLong(level);
        if (!py_level)
            goto bad;
        module = PyObject_CallFunctionObjArgs(py_import,
            name, global_dict, empty_dict, list, py_level, NULL);
        Py_DECREF(py_level);
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
    /* Default metaclass */
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = PyObject_GetAttrString(base, (char *)"__class__");
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;

    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
        return NULL;

    /* Python2 __metaclass__ */
    metaclass = PyDict_GetItemString(dict, "__metaclass__");
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    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;

    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}

static CYTHON_INLINE void __Pyx_Generator_ExceptionClear(struct __pyx_Generator_object *self)
{
    Py_XDECREF(self->exc_type);
    Py_XDECREF(self->exc_value);
    Py_XDECREF(self->exc_traceback);

    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
}

static CYTHON_INLINE PyObject *__Pyx_Generator_SendEx(struct __pyx_Generator_object *self, PyObject *value)
{
    PyObject *retval;

    if (self->is_running) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return NULL;
    }

    if (self->resume_label == 0) {
        if (value && value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }

    if (self->resume_label == -1) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }


    if (value)
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
    else
        __Pyx_Generator_ExceptionClear(self);

    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;

    if (retval)
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
    else
        __Pyx_Generator_ExceptionClear(self);

    return retval;
}

static PyObject *__Pyx_Generator_Next(PyObject *self)
{
    return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, Py_None);
}

static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value)
{
    return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, value);
}

static PyObject *__Pyx_Generator_Close(PyObject *self)
{
    struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self;
    PyObject *retval;
#if PY_VERSION_HEX < 0x02050000
    PyErr_SetNone(PyExc_StopIteration);
#else
    PyErr_SetNone(PyExc_GeneratorExit);
#endif
    retval = __Pyx_Generator_SendEx(generator, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
#if PY_VERSION_HEX < 0x02050000
    if (PyErr_ExceptionMatches(PyExc_StopIteration))
#else
    if (PyErr_ExceptionMatches(PyExc_StopIteration)
        || PyErr_ExceptionMatches(PyExc_GeneratorExit))
#endif
    {
        PyErr_Clear();          /* ignore these errors */
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}

static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args, CYTHON_UNUSED PyObject *kwds)
{
    struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;

    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Generator_SendEx(generator, NULL);
}

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

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 PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  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 = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
