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

Add absolute values and convert to Minion #583

Merged
merged 1 commit into from
Jan 10, 2025
Merged

Conversation

niklasdewally
Copy link
Collaborator

Add support for absolute values, in particular:

  • Parsing from JSON.
  • The Abs expression variant.
  • The FlatAbsEq Minion constraint.
  • Flattening and conversion to Minion.

@niklasdewally niklasdewally self-assigned this Jan 10, 2025
@niklasdewally
Copy link
Collaborator Author

niklasdewally commented Jan 10, 2025

@ozgurakgun I have added a bug-fix for division domains to this commit. This fixes abs-03 giving different solutions with Oxide and Conjure

Updated commit message:

As part of this change, a division domain bug is fixed. In our domain
calculation we use truncating division, the default Rust integer
division operator. However, the semantics of Essence Prime specify floor
division.

Truncating division has the effect of rounding towards 0.

Truncating division does -5 / 2 =-2 and 5/2 = 2. However, we want
-5/2 = -3 and 5/2 = 2.

This caused the domains of variables containing negative divisions to
sometimes be one too high. For abs-03, this caused Oxide to give different
solutions than Conjure.

@niklasdewally niklasdewally marked this pull request as ready for review January 10, 2025 17:01
Add support for absolute values, in particular:

* Parsing from JSON.
* The `Abs` expression variant.
* The `FlatAbsEq` Minion constraint.
* Flattening and conversion to Minion.

As part of this change, a division domain bug is fixed. In our domain
calculation we use truncating division, the default Rust integer
division operator. However, the semantics of Essence Prime specify floor
division.

Truncating division has the effect of rounding towards 0.

Truncating division does `-5 / 2 =-2` and `5/2 = 2`. However, we want
`-5/2 = -3` and `5/2 = 2`.

This caused the domains of variables containing negative divisions to
sometimes be one too high. For abs-03, this caused Oxide to give
different solutions than Conjure.
@niklasdewally niklasdewally merged commit aa2c52d into main Jan 10, 2025
14 checks passed
@niklasdewally niklasdewally deleted the nik/pr/add-abs/01 branch January 10, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants