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

Allow description for a constraint #367

Merged
merged 7 commits into from
Sep 8, 2023
Merged

Allow description for a constraint #367

merged 7 commits into from
Sep 8, 2023

Conversation

IgnaceBleukx
Copy link
Collaborator

For explanation techniques, its usefull to have a human-intepretable representation for a constraint.
This pull request allows a user to create a constraint and then set its description, when the constraint is printed, the description is taken instead of the __repr__ method.

I guess we should take extra care for Minzinc for this one as we might convert an expression based on its string representation? But I could not see this happening anywhere.

@IgnaceBleukx
Copy link
Collaborator Author

Made following changes:

  • Add optional argument to NOT override str
  • Add optimal argument to print both description and representation

@IgnaceBleukx IgnaceBleukx requested a review from tias August 31, 2023 15:02
@Wout4
Copy link
Collaborator

Wout4 commented Sep 8, 2023

You could set a description for a variable as well, which i think is desirable. However some solvers use the string representation of a variable as the name to send to the solver. This should probably be changed to use the name (or uuid in another pr)

@Wout4 Wout4 merged commit 914153a into master Sep 8, 2023
1 check passed
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