IDAES / examples

IDAES platform examples and tutorials
https://idaes-examples.readthedocs.io
Other
14 stars 34 forks source link

Updating Degeneracy Hunter example #79

Closed andrewlee94 closed 7 months ago

andrewlee94 commented 9 months ago

This PR update the existing Degeneracy Hunter example to use the new API via the Diagnsotics Toolbox


Legal Acknowledgement

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

I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
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.

:books: Documentation preview :books:: https://idaes-examples--79.org.readthedocs.build/en/79/

andrewlee94 commented 9 months ago

@adowling2 I took a first pass at updating your existing tutorial to use the new API - for the most part it was straightforward although there are a couple of cells where I think the results are slightly different (checking residuals, bounds and the Jacobian rank come to mind). If you or a student could take a look and see what you think it would be appreciated.

Note that this PR requires the changes from https://github.com/IDAES/idaes-pse/pull/1256.

adowling2 commented 8 months ago

Proposed change, link to https://en.wikipedia.org/wiki/Karush%E2%80%93Kuhn%E2%80%93Tucker_conditions#Regularity_conditions_(or_constraint_qualifications) for "Linear independence constraint qualification", also fix capitalization

adowling2 commented 8 months ago

Proposed change, give the Degeneracy Hunter paper reference: Alexander W. Dowling and Lorenz T. Biegler (2015). Degeneracy Hunter: An Algorithm for Determining Irreducible Sets of Degenerate Constraints in Mathematical Programs. 12th International Symposium on Process Systems Engineering and 25th European Symposium on Computer Aided Process Engineering. Ed. by Krist V. Gernaey, Jakob K. Huusom, and Raqul Gani. Computer-Aided Chemical Engineering, Vol. 37, p. 809 – 814.

And link to the file: https://dowlinglab.nd.edu/assets/447116/2015_degeneracy_hunter_an_algorithm_for_determining_irreducible_sets_of_degenerate_constraints_in_mathematical_prog.pdf

andrewlee94 commented 8 months ago

@lbianchi-lbl @dangunter This is another PR that needs to have SCIP avaialble for testing (although for just documentation it should be fine as is - the cells are already filled in).

ksbeattie commented 8 months ago

This is waiting for IDAES/idaes-pse#1281

lbianchi-lbl commented 8 months ago

IDAES/idaes-pse#1282 introduces an internal utility function that enables SCIP (requires ampl_module_scip to be importable):

from pyomo.environ import SolverFactory
from idaes.core.util.testing import _enable_scip_solver_for_testing

scip_solver = SolverFactory("scip")
if not scip_solver.available():
    _enable_scip_solver_for_testing()
assert scip_solver.available()

Note that the issue of how to handle the ampl_module_scip dependency (pip install --index-url https://pypi.ampl.com ampl_module_scip) is still open.

lbianchi-lbl commented 7 months ago

@andrewlee94 To deal with the installation of ampl_module_scip, I propose the following:

andrewlee94 commented 7 months ago

@lbianchi-lbl I would be inclined to leave off the installation instructions - I beleive I already have a warning that an MILP solver is required. The example can be run with any MILP solver (not just SCIP, although the user would need to point to the solver of choice), plus there are better ways to install SCIP.