@@ -808,7 +808,6 @@ cdef class Row:
808808 """
809809 cdef SCIP_COL** cols = SCIProwGetCols(self .scip_row)
810810 cdef int i
811-
812811 return [Column.create(cols[i]) for i in range (self .getNNonz())]
813812
814813 def getVals (self ):
@@ -822,7 +821,6 @@ cdef class Row:
822821 """
823822 cdef SCIP_Real* vals = SCIProwGetVals(self .scip_row)
824823 cdef int i
825-
826824 return [vals[i] for i in range (self .getNNonz())]
827825
828826 def getAge (self ):
@@ -908,7 +906,6 @@ cdef class NLRow:
908906 cdef SCIP_Real* lincoefs = SCIPnlrowGetLinearCoefs(self .scip_nlrow)
909907 cdef int nlinvars = SCIPnlrowGetNLinearVars(self .scip_nlrow)
910908 cdef int i
911-
912909 return [(Variable.create(linvars[i]), lincoefs[i]) for i in range (nlinvars)]
913910
914911 def getLhs (self ):
@@ -988,7 +985,6 @@ cdef class Solution:
988985 def __getitem__ (self , Expr expr ):
989986 # fast track for Variable
990987 cdef SCIP_Real coeff
991-
992988 if isinstance (expr, Variable):
993989 self ._checkStage(" SCIPgetSolVal" )
994990 var = < Variable> expr
@@ -1008,23 +1004,19 @@ cdef class Solution:
10081004 def __repr__ (self ):
10091005 cdef SCIP_VAR* scip_var
10101006 cdef int i
1011-
10121007 vals = {}
10131008 self ._checkStage(" SCIPgetSolVal" )
10141009 for i in range (SCIPgetNOrigVars(self .scip)):
10151010 scip_var = SCIPgetOrigVars(self .scip)[i]
1016-
10171011 # extract name
10181012 cname = bytes(SCIPvarGetName(scip_var))
10191013 name = cname.decode(' utf-8' )
1020-
10211014 vals[name] = SCIPgetSolVal(self .scip, self .sol, scip_var)
10221015 return str (vals)
10231016
10241017 def _checkStage (self , method ):
10251018 if method in [" SCIPgetSolVal" , " getSolObjVal" ]:
10261019 stage_check = SCIPgetStage(self .scip) not in [SCIP_STAGE_INIT, SCIP_STAGE_FREE]
1027-
10281020 if not stage_check or self .sol == NULL and SCIPgetStage(self .scip) != SCIP_STAGE_SOLVING:
10291021 raise Warning (f" {method} can only be called with a valid solution or in stage SOLVING (current stage: {SCIPgetStage(self.scip)})" )
10301022
@@ -1058,7 +1050,6 @@ cdef class Solution:
10581050 PY_SCIP_CALL(SCIPretransformSol(self .scip, self .sol))
10591051 cdef Solution targetSol = Solution.create(target._scip, NULL )
10601052 cdef SCIP_VAR** source_vars = SCIPgetOrigVars(self .scip)
1061-
10621053 PY_SCIP_CALL(SCIPtranslateSubSol(target._scip, self .scip, self .sol, NULL , source_vars, & (targetSol.sol)))
10631054 return targetSol
10641055
@@ -1186,7 +1177,6 @@ cdef class DomainChanges:
11861177 """
11871178 cdef nboundchgs = SCIPdomchgGetNBoundchgs(self .scip_domchg)
11881179 cdef int i
1189-
11901180 return [BoundChange.create(SCIPdomchgGetBoundchg(self .scip_domchg, i))
11911181 for i in range (nboundchgs)]
11921182
@@ -1291,14 +1281,11 @@ cdef class Node:
12911281
12921282 """
12931283 cdef int addedconsssize = SCIPnodeGetNAddedConss(self .scip_node)
1294-
12951284 if addedconsssize == 0 :
12961285 return []
1297-
12981286 cdef SCIP_CONS** addedconss = < SCIP_CONS** > malloc(addedconsssize * sizeof(SCIP_CONS* ))
12991287 cdef int nconss
13001288 cdef int i
1301-
13021289 SCIPnodeGetAddedConss(self .scip_node, addedconss, & nconss, addedconsssize)
13031290 assert nconss == addedconsssize
13041291 constraints = [Constraint.create(addedconss[i]) for i in range (nconss)]
@@ -1351,7 +1338,6 @@ cdef class Node:
13511338 cdef SCIP_Real dummy_branchbounds
13521339 cdef SCIP_BOUNDTYPE dummy_boundtypes
13531340 cdef int nbranchvars
1354-
13551341 # This is a hack: the SCIP interface has no function to directly get the
13561342 # number of parent branchings, i.e., SCIPnodeGetNParentBranchings() does
13571343 # not exist.
@@ -1372,22 +1358,18 @@ cdef class Node:
13721358
13731359 """
13741360 cdef int nbranchvars = self .getNParentBranchings()
1375-
13761361 if nbranchvars == 0 :
13771362 return None
1378-
13791363 cdef SCIP_VAR** branchvars = < SCIP_VAR** > malloc(nbranchvars * sizeof(SCIP_VAR* ))
13801364 cdef SCIP_Real* branchbounds = < SCIP_Real* > malloc(nbranchvars * sizeof(SCIP_Real))
13811365 cdef SCIP_BOUNDTYPE* boundtypes = < SCIP_BOUNDTYPE* > malloc(nbranchvars * sizeof(SCIP_BOUNDTYPE))
13821366 cdef int i
1383-
13841367 SCIPnodeGetParentBranchings(self .scip_node, branchvars, branchbounds,
13851368 boundtypes, & nbranchvars, nbranchvars)
13861369
13871370 py_variables = [Variable.create(branchvars[i]) for i in range (nbranchvars)]
13881371 py_branchbounds = [branchbounds[i] for i in range (nbranchvars)]
13891372 py_boundtypes = [boundtypes[i] for i in range (nbranchvars)]
1390-
13911373 free(boundtypes)
13921374 free(branchbounds)
13931375 free(branchvars)
@@ -1407,7 +1389,6 @@ cdef class Node:
14071389 cdef int nbranchings
14081390 cdef int nconsprop
14091391 cdef int nprop
1410-
14111392 SCIPnodeGetNDomchg(self .scip_node, & nbranchings, & nconsprop, & nprop)
14121393 return nbranchings, nconsprop, nprop
14131394
@@ -1657,7 +1638,6 @@ cdef class Variable(Expr):
16571638 mayround = SCIPvarMayRoundDown(self .scip_var)
16581639 else :
16591640 mayround = SCIPvarMayRoundUp(self .scip_var)
1660-
16611641 return mayround
16621642
16631643cdef class Constraint:
@@ -10088,7 +10068,7 @@ def readStatistics(filename):
1008810068
1008910069 stats = Statistics(** treated_result)
1009010070 return stats
10091-
10071+
1009210072# debugging memory management
1009310073def is_memory_freed ():
1009410074 return BMSgetMemoryUsed() == 0
0 commit comments