Skip to content

Support expressions in routing constraints - #93

Closed
willbryant wants to merge 3 commits into
ankane:masterfrom
willbryant:solver_constraints
Closed

willbryant wants to merge 3 commits into
ankane:masterfrom
willbryant:solver_constraints

Conversation

@willbryant

Copy link
Copy Markdown
Contributor

This supports all the expressions that can be represented using Expression, which in turn supports Comparison.

Test coverage includes:

  • IntVar + IntVar
  • IntVar - IntVar
  • IntVar + const
  • IntVar - const
  • sum(IntVar[])
  • IntVar + IntVar + const
  • IntVar*IntVar
  • IntVar*const
  • const*IntVar
  • -IntVar

Builds on #92. Simpler at runtime if #91 goes in, though I think I have it working OK without.

This supports all the expressions that can be represented using Expression, which in turn supports Comparison.

Test coverage includes:
* IntVar + IntVar
* IntVar - IntVar
* IntVar + const
* IntVar - const
* sum(IntVar[])
* IntVar + IntVar + const
* IntVar*IntVar
* IntVar*const
* const*IntVar
* -IntVar
ankane added a commit that referenced this pull request Sep 16, 2026
Co-authored-by: Will Bryant <will.bryant@gmail.com>
@ankane

ankane commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Hi @willbryant, added support for linear constraints in the commit above. If quadratic constraints are needed, it should be possible to use index_expression(..., check_linear: false) to extend this.

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