Skip to content

Commit

Permalink
fix .value()
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimosts committed May 10, 2024
1 parent 81a3b7f commit b38bcae
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cpmpy/expressions/globalconstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,12 @@ def decompose(self):
2) empty list of defining constraints
"""
args = self.args
return [(args[i] <= args[i+1]) for i in range(len(args)-1)], []
return [args[i] <= args[i+1] for i in range(len(args)-1)], []

def value(self):
from .python_builtins import all
args = self.args
return all((args[i] <= args[i+1]) for i in range(len(args)-1))
return all(args[i].value() <= args[i+1].value() for i in range(len(args)-1))


class Decreasing(GlobalConstraint):
Expand All @@ -555,12 +555,12 @@ def decompose(self):
2) empty list of defining constraints
"""
args = self.args
return [(args[i] >= args[i+1]) for i in range(len(args)-1)], []
return [args[i] >= args[i+1] for i in range(len(args)-1)], []

def value(self):
from .python_builtins import all
args = self.args
return all((args[i] >= args[i+1]) for i in range(len(args)-1))
return all(args[i].value() >= args[i+1].value() for i in range(len(args)-1))


class IncreasingStrict(GlobalConstraint):
Expand All @@ -578,12 +578,12 @@ def decompose(self):
2) empty list of defining constraints
"""
args = self.args
return [(args[i] < args[i+1]) for i in range(len(args)-1)], []
return [args[i] < args[i+1] for i in range(len(args)-1)], []

def value(self):
from .python_builtins import all
args = self.args
return all((args[i] < args[i+1]) for i in range(len(args)-1))
return all((args[i].value() < args[i+1].value()) for i in range(len(args)-1))


class DecreasingStrict(GlobalConstraint):
Expand All @@ -606,7 +606,7 @@ def decompose(self):
def value(self):
from .python_builtins import all
args = self.args
return all((args[i] > args[i+1]) for i in range(len(args)-1))
return all((args[i].value() > args[i+1].value()) for i in range(len(args)-1))


class DirectConstraint(Expression):
Expand Down

0 comments on commit b38bcae

Please sign in to comment.