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

Updating Degeneracy Hunter example #79

Merged
merged 9 commits into from
Nov 17, 2023

Conversation

andrewlee94
Copy link
Member

@andrewlee94 andrewlee94 commented Oct 3, 2023

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.

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

@andrewlee94 andrewlee94 requested a review from adowling2 October 3, 2023 19:33
@andrewlee94 andrewlee94 self-assigned this Oct 3, 2023
@andrewlee94 andrewlee94 added Priority:Normal Normal Priority Issue or PR documentation Improvements or additions to documentation enhancement New feature or request labels Oct 3, 2023
@andrewlee94
Copy link
Member Author

@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 IDAES/idaes-pse#1256.

@andrewlee94 andrewlee94 marked this pull request as ready for review October 9, 2023 18:53
Copy link
Contributor

@MarcusHolly MarcusHolly left a comment

Choose a reason for hiding this comment

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

With the exception of the failing test, this LGTM. I'm also not sure why the same file is seemingly duplicated 4 times tho...

Copy link
Contributor

@bpaul4 bpaul4 left a comment

Choose a reason for hiding this comment

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

@andrewlee94 the content looks good, I'm approving so this can be merged quickly once the tests pass.

The failure looks like it will be resolved once this issue is addressed. Please let @MarcusHolly and I know if there are any modifications to the solvers packages that require testing.

@MarcusHolly the four files exist for different purposes (see here).

@adowling2
Copy link

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
Copy link

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

Copy link

@adowling2 adowling2 left a comment

Choose a reason for hiding this comment

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

Looks great, I posted two suggestions above.

@andrewlee94
Copy link
Member Author

@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
Copy link
Member

ksbeattie commented Oct 19, 2023

This is waiting for IDAES/idaes-pse#1281

@lbianchi-lbl
Copy link
Contributor

lbianchi-lbl commented Nov 1, 2023

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
Copy link
Contributor

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

  • Add the SCIP installation step at the end of .github/actions/install.yml:
        - name: Install SCIP from AMPL
        shell: bash -l {0}
        run: |
          echo '::group::Output of "pip install ampl_module_scip" command'
          ${{ inputs.install-command }} --index-url https://pypi.ampl.com ampl_module_scip
          echo '::endgroup::'
  • (Optional) Add a commented code cell at the beginning of the notebook (before the imports) with an explanation, e.g.

    To run this notebook, the (a?) SCIP solver is required. If you don't have SCIP installed in your environment, you can install it by uncommenting and running the cell code below:

    %pip install --index-url https://pypi.ampl.com ampl_module_scip
    

@andrewlee94
Copy link
Member Author

@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.

@andrewlee94 andrewlee94 merged commit 261abe7 into IDAES:main Nov 17, 2023
6 checks passed
@andrewlee94 andrewlee94 deleted the degeneracy_hunter branch November 17, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants