Skip to content

Allow custom messages in IncompatibleModelError #3596

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

michaelbynum
Copy link
Contributor

Summary/Motivation:

The new direct interface to Gurobi attempts to pass a custom message to IncompatibleModelError here:

raise IncompatibleModelError(
. However, that exception does not currently except custom messages. This PR enables custom messages.

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

if msg is None:
msg = (
'Model is not compatible with the chosen solver. Please check '
+ 'the model and solver.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ 'the model and solver.'
'the model and solver.'

Fun fact: you don't need the +.

@@ -58,11 +58,13 @@ def __init__(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good change but can we do it for all of the custom error messages? E.g., for NoReducedCostsError, NoDualsError, etc.

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