Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #67 #68

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Csp/Integer/ConstrainedArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ private Bounds<int> EvaluateBounds(ExpressionInteger left, ExpressionInteger rig
{
var elements = Elements();

return new Bounds<int>(elements.Min(), elements.Max());
}
return new Bounds<int>(elements.DefaultIfEmpty().Min(), elements.DefaultIfEmpty().Max());
}

private ConstraintOperationResult Propagator(ExpressionInteger left, ExpressionInteger right, Bounds<int> enforce)
private ConstraintOperationResult Propagator(ExpressionInteger left, ExpressionInteger right, Bounds<int> enforce)
{
var result = ConstraintOperationResult.Undecided;

Expand Down
2 changes: 1 addition & 1 deletion Csp/Integer/ConstraintInteger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions Csp/Integer/ExpressionInteger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public class ExpressionInteger : Expression<int>
return new Bounds<int>
(
leftBounds.UpperBound < rightBounds.LowerBound ? 1 : 0,
leftBounds.LowerBound < leftBounds.UpperBound ? 1 : 0
leftBounds.LowerBound <= leftBounds.UpperBound ? 1 : 0
);
},
propagator = (first, second, enforce) =>
Expand Down Expand Up @@ -571,7 +571,7 @@ public class ExpressionInteger : Expression<int>
return new Bounds<int>
(
leftBounds.LowerBound > rightBounds.UpperBound ? 1 : 0,
leftBounds.UpperBound > leftBounds.LowerBound ? 1 : 0
leftBounds.UpperBound >= leftBounds.LowerBound ? 1 : 0
);
},
propagator = (first, second, enforce) =>
Expand Down
Loading