@@ -5778,14 +5778,14 @@ cdef class Model:
57785778
57795779 return vars
57805780
5781- def getNVarsAnd (self , Constraint constraint ):
5781+ def getNVarsAnd (self , Constraint and_cons ):
57825782 """
57835783 Gets number of variables in and constraint.
57845784
57855785 Parameters
57865786 ----------
5787- constraint : Constraint
5788- Constraint to get the number of variables from.
5787+ and_cons : Constraint
5788+ AND constraint to get the number of variables from.
57895789
57905790 Returns
57915791 -------
@@ -5795,16 +5795,16 @@ cdef class Model:
57955795 cdef int nvars
57965796 cdef SCIP_Bool success
57975797
5798- return SCIPgetConsNVarsAnd (self ._scip, constraint .scip_cons)
5798+ return SCIPgetNVarsAnd (self ._scip, and_cons .scip_cons)
57995799
5800- def getConsVarsAnd (self , Constraint constraint ):
5800+ def getVarsAnd (self , Constraint and_cons ):
58015801 """
5802- Gets variables in and constraint.
5802+ Gets variables in AND constraint.
58035803
58045804 Parameters
58055805 ----------
5806- constraint : Constraint
5807- Constraint to get the variables from.
5806+ and_cons : Constraint
5807+ AND Constraint to get the variables from.
58085808
58095809 Returns
58105810 -------
@@ -5816,9 +5816,12 @@ cdef class Model:
58165816 cdef SCIP_Bool success
58175817 cdef int i
58185818
5819- SCIPgetConsNVarsAnd(self ._scip, constraint.scip_cons, & nvars, & success)
5819+ constype = bytes(SCIPconshdlrGetName(SCIPconsGetHdlr(and_cons.scip_cons))).decode(' UTF-8' )
5820+ assert (constype == ' and' , " The constraint handler %s does not have this functionality." % constype)
5821+
5822+ nvars = SCIPgetNVarsAnd(self ._scip, and_cons.scip_cons)
58205823 _vars = < SCIP_VAR** > malloc(nvars * sizeof(SCIP_VAR* ))
5821- _vars = SCIPgetConsVarsAnd (self ._scip, constraint .scip_cons)
5824+ _vars = SCIPgetVarsAnd (self ._scip, and_cons .scip_cons)
58225825
58235826 vars = []
58245827 for i in range (nvars):
@@ -5835,13 +5838,13 @@ cdef class Model:
58355838
58365839 return vars
58375840
5838- def getResultantAnd (self , Constraint constraint ):
5841+ def getResultantAnd (self , Constraint and_cons ):
58395842 """
58405843 Gets the resultant variable in And constraint.
58415844
58425845 Parameters
58435846 ----------
5844- constraint : Constraint
5847+ and_cons : Constraint
58455848 Constraint to get the resultant variable from.
58465849
58475850 Returns
@@ -5852,25 +5855,27 @@ cdef class Model:
58525855 cdef SCIP_VAR* _resultant
58535856 cdef SCIP_Bool success
58545857
5855- _resultant = SCIPgetResultantAnd(self ._scip, constraint .scip_cons)
5858+ _resultant = SCIPgetResultantAnd(self ._scip, and_cons .scip_cons)
58565859
58575860 ptr = < size_t> (_resultant)
58585861 # check whether the corresponding variable exists already
58595862 if ptr not in self ._modelvars:
58605863 # create a new variable
5861- var = Variable.create(_resultant)
5862- assert var.ptr() == ptr
5863- self ._modelvars[ptr] = var
5864+ resultant = Variable.create(_resultant)
5865+ assert resultant.ptr() == ptr
5866+ self ._modelvars[ptr] = resultant
5867+ else :
5868+ resultant = self ._modelvars[ptr]
58645869
58655870 return resultant
58665871
5867- def isAndConsSorted (self , Constraint constraint ):
5872+ def isAndConsSorted (self , Constraint and_cons ):
58685873 """
58695874 Returns if the variables of the AND-constraint are sorted with respect to their indices.
58705875
58715876 Parameters
58725877 ----------
5873- constraint : Constraint
5878+ and_cons : Constraint
58745879 Constraint to check.
58755880
58765881 Returns
@@ -5880,21 +5885,21 @@ cdef class Model:
58805885 """
58815886 cdef SCIP_Bool success
58825887
5883- return SCIPisAndConsSorted(self ._scip, constraint .scip_cons)
5888+ return SCIPisAndConsSorted(self ._scip, and_cons .scip_cons)
58845889
5885- def sortAndCons (self , Constraint constraint ):
5890+ def sortAndCons (self , Constraint and_cons ):
58865891 """
58875892 Sorts the variables of the AND-constraint with respect to their indices.
58885893
58895894 Parameters
58905895 ----------
5891- constraint : Constraint
5896+ and_cons : Constraint
58925897 Constraint to sort.
58935898
58945899 """
58955900 cdef SCIP_Bool success
58965901
5897- PY_SCIP_CALL(SCIPsortAndCons(self ._scip, constraint .scip_cons))
5902+ PY_SCIP_CALL(SCIPsortAndCons(self ._scip, and_cons .scip_cons))
58985903
58995904 def printCons (self , Constraint constraint ):
59005905 """
0 commit comments