Skip to content

Commit 4d51139

Browse files
Apply suggestions from code review
Co-authored-by: DominikKamp <130753997+DominikKamp@users.noreply.github.com>
1 parent 2bc0ab8 commit 4d51139

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/pyscipopt/scip.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,8 +1478,8 @@ cdef extern from "scip/cons_linear.h":
14781478
SCIP_RETCODE SCIPchgRhsLinear(SCIP* scip, SCIP_CONS* cons, SCIP_Real rhs)
14791479
SCIP_Real SCIPgetLhsLinear(SCIP* scip, SCIP_CONS* cons)
14801480
SCIP_Real SCIPgetRhsLinear(SCIP* scip, SCIP_CONS* cons)
1481-
SCIP_Real SCIPconsGetRhs(SCIP* scip, SCIP_CONS* cons, SCIP_Bool* success)
14821481
SCIP_Real SCIPconsGetLhs(SCIP* scip, SCIP_CONS* cons, SCIP_Bool* success)
1482+
SCIP_Real SCIPconsGetRhs(SCIP* scip, SCIP_CONS* cons, SCIP_Bool* success)
14831483
SCIP_RETCODE SCIPchgCoefLinear(SCIP* scip, SCIP_CONS* cons, SCIP_VAR* var, SCIP_Real newval)
14841484
SCIP_RETCODE SCIPdelCoefLinear(SCIP* scip, SCIP_CONS* cons, SCIP_VAR*)
14851485
SCIP_RETCODE SCIPaddCoefLinear(SCIP* scip, SCIP_CONS* cons, SCIP_VAR*, SCIP_Real val)

src/pyscipopt/scip.pxi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6067,22 +6067,22 @@ cdef class Model:
60676067
list of float
60686068
60696069
"""
6070-
cdef SCIP_Real* vals
6070+
cdef SCIP_Real* _vals
60716071
cdef int nvars
60726072
cdef SCIP_Bool success
60736073
cdef int i
60746074

60756075
nvars = self.getConsNVars(constraint)
6076-
vals = <SCIP_Real*> malloc(nvars * sizeof(SCIP_Real))
6077-
PY_SCIP_CALL(SCIPgetConsVals(self._scip, constraint.scip_cons, vals, nvars, &success))
6076+
_vals = <SCIP_Real*> malloc(nvars * sizeof(SCIP_Real))
6077+
PY_SCIP_CALL(SCIPgetConsVals(self._scip, constraint.scip_cons, _vals, nvars, &success))
60786078

60796079
if not success:
6080-
free(vals)
6080+
free(_vals)
60816081
return None
60826082

6083-
result = [vals[i] for i in range(nvars)]
6084-
free(vals)
6085-
return result
6083+
vals = [_vals[i] for i in range(nvars)]
6084+
free(_vals)
6085+
return vals
60866086

60876087
def getNVarsAnd(self, Constraint and_cons):
60886088
"""

0 commit comments

Comments
 (0)