diff --git a/CHANGES.mp.md b/CHANGES.mp.md index f4658c677..1b855949d 100644 --- a/CHANGES.mp.md +++ b/CHANGES.mp.md @@ -2,7 +2,7 @@ Summary of recent updates to the AMPL MP Library ================================================ -## 20240319 +## 20240320 - *SOS constraints*. - Fixed handling of SOS2 constraints created by AMPL as reformulations of PL expressions (`option diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dc9c06a3..149110a1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,7 @@ endif() ## NOT SKIP_BUILD_MP include_directories(include) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) -set(MP_DATE 20240319) +set(MP_DATE 20240320) set(MP_SYSINFO "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}") diff --git a/support/modelexplore/modelexplore.py b/support/modelexplore/modelexplore.py index 82bdeccda..f14a9699a 100644 --- a/support/modelexplore/modelexplore.py +++ b/support/modelexplore/modelexplore.py @@ -29,26 +29,43 @@ def MatchSelection(m, srch, fwd, bwd): return MatchSubmodel(m, srch, fwd, bwd) # Write dictionary of entries +@st.cache_data def WriteDict(d): + whole = "" for k, v in d.items(): if len(v): + whole = whole + '\n\n## ' + k + ' (' + str(v.count('\n')) + ')\n' + whole = whole + v with st.expander("""### """ + k + ' (' + \ str(v.count('\n')) + ')'): with st.container(height=200): st.code(v, language='ampl') + return whole + + +filename_upl = "" +modelNL = "" +modelFlat = "" # Or even better, call Streamlit functions inside a "with" block: if uploader is not None: model = ReadModel(uploader) + filename_upl = uploader.name subm1, subm2 = MatchSelection(model, srch, fwd, bwd) bytes1_data = subm1.GetData() bytes2_data = subm2.GetData() with left_column: st.write("""## NL model""") - WriteDict(bytes1_data) + modelNL = WriteDict(bytes1_data) with right_column: st.write("""## Flat model""") - WriteDict(bytes2_data) + modelFlat = WriteDict(bytes2_data) else: with left_column: st.write("No file selected.") + + +st.sidebar.download_button("Download NL Model", modelNL, filename_upl + '_NL.mod', + disabled = ("" == modelNL)) +st.sidebar.download_button("Download Solver Model", modelFlat, filename_upl + '_solver.mod', + disabled = ("" == modelFlat))