File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44### Added
5+ - Add getConshdlrName to class Constraint
56### Fixed
67### Changed
78### Removed
Original file line number Diff line number Diff line change @@ -941,6 +941,11 @@ cdef class Constraint:
941941 constype = bytes(SCIPconshdlrGetName(SCIPconsGetHdlr(self .scip_cons))).decode(' UTF-8' )
942942 return constype == ' nonlinear'
943943
944+ def getConshdlrName (self ):
945+ """ Return the constraint handler's name"""
946+ constype = bytes(SCIPconshdlrGetName(SCIPconsGetHdlr(self .scip_cons))).decode(' UTF-8' )
947+ return constype
948+
944949 def __hash__ (self ):
945950 return hash (< size_t> self .scip_cons)
946951
@@ -5142,4 +5147,4 @@ def is_memory_freed():
51425147 return BMSgetMemoryUsed() == 0
51435148
51445149def print_memory_in_use ():
5145- BMScheckEmptyMemory()
5150+ BMScheckEmptyMemory()
Original file line number Diff line number Diff line change @@ -96,6 +96,8 @@ def test_SOScons():
9696 assert m .isEQ (m .getVal (x [3 ]), 1 )
9797 assert m .isEQ (m .getVal (x [4 ]), 1 )
9898 assert m .isEQ (m .getVal (x [5 ]), 1 )
99+ assert c1 .getConshdlrName () == "SOS1"
100+ assert c2 .getConshdlrName () == "SOS2"
99101
100102
101103def test_cons_indicator ():
@@ -112,6 +114,7 @@ def test_cons_indicator():
112114 assert m .isEQ (m .getVal (slack ), 0 )
113115 assert m .isEQ (m .getVal (binvar ), 1 )
114116 assert m .isEQ (m .getVal (x ), 1 )
117+ assert c .getConshdlrName () == "indicator"
115118
116119
117120@pytest .mark .xfail (reason = "addConsIndicator doesn't behave as expected when binary variable is False. See Issue #717." )
You can’t perform that action at this time.
0 commit comments