Skip to content

Update Xpress interfaces to support 9.5#3392

Merged
jsiirola merged 9 commits intoPyomo:mainfrom
jsiirola:xpress-9.5
Oct 28, 2024
Merged

Update Xpress interfaces to support 9.5#3392
jsiirola merged 9 commits intoPyomo:mainfrom
jsiirola:xpress-9.5

Conversation

@jsiirola
Copy link
Copy Markdown
Member

@jsiirola jsiirola commented Oct 28, 2024

Fixes #3391 .

Summary/Motivation:

Xpress 9.5 was a disruptive release that introduced deprecation warnings and broke a number of tests. This PR builds on https://github.com/blnicho/pyomo/tree/xpress-9.5.0 and adds a compatibility shim to the underlying xpress module to support both pre- and post-9.5 Xpress.

Changes proposed in this PR:

  • Add a compatibility shim to the XpressDirect class for interacting with xpress
  • Update one test to track a change in the default Xpress behavior
  • Update ComponentMap / ComponentSet to expost the internal hasher dict and add a hasher.hashable() method to query / set the hashability for a given type.

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.

Comment on lines +1026 to +1032
# Xpress 9.5.0 has new behavior for unbounded
# problems that have mipsols > 0. Previously
# getSolution() would return a solution, but now
# raises a ModelError (even though the deprecated
# getmipsol() will return a solution). We will try
# to fall back on the [deprecated] getmipsol(), but
# if it fails, we will raise the original exception.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this worth reporting to the Xpress folks? It seems like undesirable behavior, to say the least, and they may eventually remove getmipsol.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes - it is, once we get our tests passing again. There were other changes that looked like compatibility issues until I got all the deprecation warnings silenced. (I have some evidence that other deprecation paths are not actually 100% backwards compatible).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just so that I understand correctly: you are saying that the MIPSOLS attribute returns a number greater than zero but still getSolution() raises an error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That is correct. It's probably an unintentional regression [and admittedly a pretty weird edge case that we happened to have a test case for] -- filing a bug report upstream is on our backlog (we are still working / fighting infrastructure to try and get a release out this week)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. We confirm that this is a defect in the Xpress C library. We will work on it.

@jsiirola jsiirola requested a review from mrmundt October 28, 2024 20:44
@jsiirola jsiirola merged commit cca6019 into Pyomo:main Oct 28, 2024
@jsiirola jsiirola deleted the xpress-9.5 branch October 28, 2024 22:16
opt.options['XSLP_SOLVER'] = 0
# xpress 9.5.0 now defaults to trying (and failing) to solve this problem
# using the global solver. This option forces the use of the local solver.
opt.options['NLPSOLVER'] = 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is most likely due to a change in the community license. The community license is the default license you get when you install Xpress via pip or conda and I suppose this is the license you are using for tests.
Pre 9.5 this license did not allow running the Xpress global solver. So Xpress did only aim for finding local optima here.
Starting with 9.5, the community license now allows using the global solver as well (with limits on the problem size). That is why Xpress now uses the global solver by default.

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.

Xpress 9.5 updated Xpress' Python API

3 participants