diff --git a/pulp/pulp.py b/pulp/pulp.py index 76d8d327..6cf0dd79 100644 --- a/pulp/pulp.py +++ b/pulp/pulp.py @@ -311,8 +311,9 @@ def add_expression(self, e): self.expression = e self.addVariableToConstraints(e) + @classmethod def matrix( - self, + cls, name, indexs, lowBound=None, @@ -340,10 +341,9 @@ def matrix( for i in index ] - matrix = classmethod(matrix) - + @classmethod def dicts( - self, + cls, name, indexs, lowBound=None, @@ -386,9 +386,8 @@ def dicts( ) return d - dicts = classmethod(dicts) - - def dict(self, name, indexs, lowBound=None, upBound=None, cat=const.LpContinuous): + @classmethod + def dict(cls, name, indexs, lowBound=None, upBound=None, cat=const.LpContinuous): if not isinstance(indexs, tuple): indexs = (indexs,) if "%" not in name: @@ -420,11 +419,9 @@ def dict(self, name, indexs, lowBound=None, upBound=None, cat=const.LpContinuous d = {} for i in index: - d[i] = self(name % i, lowBound, upBound, cat) + d[i] = cls(name % i, lowBound, upBound, cat) return d - dict = classmethod(dict) - def getLb(self): return self.lowBound