Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
begin migration of creation methods to Model
  • Loading branch information
ctdunc committed Apr 15, 2024
commit 53aa357a4fa9eae8f912015e55c7edc7423f98e3
1 change: 1 addition & 0 deletions src/pyscipopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# export user-relevant objects:
from pyscipopt.Multidict import multidict
from pyscipopt.scip import Model
from pyscipopt.scip import Decomposition
from pyscipopt.scip import Variable
from pyscipopt.scip import Constraint
from pyscipopt.scip import Benders
Expand Down
10 changes: 6 additions & 4 deletions src/pyscipopt/scip.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,8 @@ cdef class Constraint:

cdef class Decomposition:
"""Base class holding a pointer to SCIP decomposition"""

def __init__(self):
self.create()
@staticmethod
cdef create(SCIP_DECOMP* scip_decomp):
if scip_decomp == NULL:
Expand Down Expand Up @@ -1044,9 +1045,10 @@ cdef class Decomposition:
cdef SCIP_CONS** scip_conss = <SCIP_CONS**> malloc(nconss* sizeof(SCIP_CONS*))
cdef int* labels = <int*> malloc(nconss * sizeof(int))

for i in range(nconss):
scip_conss[i] = (<Constraint>cons_labels[i][0]).scip_cons
labels[i] = cons_labels[i][1]
for i, pair in enumerate(cons_labels):
cons, lab = pair
scip_conss[i] = (<Constraint>cons).scip_cons
labels[i] = lab

PY_SCIP_CALL(SCIPdecompSetConsLabels(self.scip_decomp, scip_conss, labels, nconss))

Expand Down