diff --git a/Csp/Integer/ConstrainedArray.cs b/Csp/Integer/ConstrainedArray.cs index 4779634..bafc2a2 100644 --- a/Csp/Integer/ConstrainedArray.cs +++ b/Csp/Integer/ConstrainedArray.cs @@ -69,10 +69,10 @@ private Bounds EvaluateBounds(ExpressionInteger left, ExpressionInteger rig { var elements = Elements(); - return new Bounds(elements.Min(), elements.Max()); - } + return new Bounds(elements.DefaultIfEmpty().Min(), elements.DefaultIfEmpty().Max()); + } - private ConstraintOperationResult Propagator(ExpressionInteger left, ExpressionInteger right, Bounds enforce) + private ConstraintOperationResult Propagator(ExpressionInteger left, ExpressionInteger right, Bounds enforce) { var result = ConstraintOperationResult.Undecided; diff --git a/Csp/Integer/ConstraintInteger.cs b/Csp/Integer/ConstraintInteger.cs index 7eff4a5..620c9bb 100644 --- a/Csp/Integer/ConstraintInteger.cs +++ b/Csp/Integer/ConstraintInteger.cs @@ -98,7 +98,7 @@ public void Propagate(out ConstraintOperationResult result) do { Propagate(enforce, out result); - } while ((result &= ConstraintOperationResult.Propagated) == ConstraintOperationResult.Propagated); + } while ((result & ConstraintOperationResult.Propagated) == ConstraintOperationResult.Propagated); } public bool StateChanged() diff --git a/Csp/Integer/ExpressionInteger.cs b/Csp/Integer/ExpressionInteger.cs index bc8606d..a0727a1 100644 --- a/Csp/Integer/ExpressionInteger.cs +++ b/Csp/Integer/ExpressionInteger.cs @@ -501,7 +501,7 @@ public class ExpressionInteger : Expression return new Bounds ( leftBounds.UpperBound < rightBounds.LowerBound ? 1 : 0, - leftBounds.LowerBound < leftBounds.UpperBound ? 1 : 0 + leftBounds.LowerBound <= leftBounds.UpperBound ? 1 : 0 ); }, propagator = (first, second, enforce) => @@ -571,7 +571,7 @@ public class ExpressionInteger : Expression return new Bounds ( leftBounds.LowerBound > rightBounds.UpperBound ? 1 : 0, - leftBounds.UpperBound > leftBounds.LowerBound ? 1 : 0 + leftBounds.UpperBound >= leftBounds.LowerBound ? 1 : 0 ); }, propagator = (first, second, enforce) =>