sage: Ensure that constraints are always fastfracs

Even if they are constants created in the formula functions. We now
lift integer constants to fastfracs.
This commit is contained in:
Tim Ruffing
2022-02-04 15:06:58 +01:00
parent d8d54859ed
commit ebb1beea78
2 changed files with 5 additions and 0 deletions

View File

@@ -164,6 +164,9 @@ class constraints:
def negate(self):
return constraints(zero=self.nonzero, nonzero=self.zero)
def map(self, fun):
return constraints(zero={fun(k): v for k, v in self.zero.items()}, nonzero={fun(k): v for k, v in self.nonzero.items()})
def __add__(self, other):
zero = self.zero.copy()
zero.update(other.zero)