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 2
2
3
3
## Unreleased
4
4
### Added
5
+ - Add getConshdlrName to class Constraint
5
6
### Fixed
6
7
### Changed
7
8
### Removed
Original file line number Diff line number Diff line change @@ -941,6 +941,11 @@ cdef class Constraint:
941
941
constype = bytes(SCIPconshdlrGetName(SCIPconsGetHdlr(self .scip_cons))).decode(' UTF-8' )
942
942
return constype == ' nonlinear'
943
943
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
+
944
949
def __hash__ (self ):
945
950
return hash (< size_t> self .scip_cons)
946
951
@@ -5142,4 +5147,4 @@ def is_memory_freed():
5142
5147
return BMSgetMemoryUsed() == 0
5143
5148
5144
5149
def 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():
96
96
assert m .isEQ (m .getVal (x [3 ]), 1 )
97
97
assert m .isEQ (m .getVal (x [4 ]), 1 )
98
98
assert m .isEQ (m .getVal (x [5 ]), 1 )
99
+ assert c1 .getConshdlrName () == "SOS1"
100
+ assert c2 .getConshdlrName () == "SOS2"
99
101
100
102
101
103
def test_cons_indicator ():
@@ -112,6 +114,7 @@ def test_cons_indicator():
112
114
assert m .isEQ (m .getVal (slack ), 0 )
113
115
assert m .isEQ (m .getVal (binvar ), 1 )
114
116
assert m .isEQ (m .getVal (x ), 1 )
117
+ assert c .getConshdlrName () == "indicator"
115
118
116
119
117
120
@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