Skip to content

Commit

Permalink
Some fixes and clean-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
d-krupke committed May 9, 2024
1 parent a9a95de commit 46a80ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
The logic for parsing the log is in the `cpsat_log_parser` folder.
"""





import streamlit as st
from cpsat_log_parser import LogParser

Expand All @@ -21,9 +25,7 @@
from _app import print_header, input_log, show_overview

print_header()
data = input_log()

if data:
if data := input_log():
st.header("Log Analysis")
st.warning(
"This is just a prototype and may crash or show wrong results. Please report any issues [here](https://github.com/d-krupke/CP-SAT-Log-Analyzer). I welcome any feedback and complex logs to test this on."
Expand All @@ -46,20 +48,17 @@
if block.get_help():
st.info(block.get_help())
st.text(str(block))
fig = block.as_plotly()
if fig:
if fig := block.as_plotly():
st.plotly_chart(fig, use_container_width=True)
st.info(
"This plot shows you how the quality of the solution (objective), and the proved quality (bound) converge over time. It allows you to estimate if finding good solutions or proving optimality is the bottleneck."
)
fig_3 = block.gap_as_plotly()
if fig_3:
if fig_3 := block.gap_as_plotly():
st.plotly_chart(fig_3, use_container_width=True)
st.info(
"This plot shows you how the gap between the objective and the bound changes over time. If it quickly reaches a small value but then does not improve for a long time, you could set the `relative_gap_limit` parameter to allow to stop the search as soon as a specific solution quality is reached.\n\n The Final Gap is comparing the objective to the final bound, only known at the end. If it falls significantly faster than the Relative Gap, you could think about stopping the search earlier via a time limit, as the solution quality seems to improve quickly but proving the quality is slow."
)
fig_2 = block.model_changes_as_plotly()
if fig_2:
if fig_2 := block.model_changes_as_plotly():
st.plotly_chart(fig_2, use_container_width=True)
st.info(
"This plot shows you how the size of the model changes over time."
Expand Down Expand Up @@ -135,6 +134,7 @@
if block.get_help():
st.info(block.get_help())
tab1, tab2 = st.tabs(["Table", "Raw"])
assert isinstance(block, TableBlock), "Should be a TableBlock."
df = block.to_pandas()
tab1.dataframe(df, use_container_width=True)
tab2.text(str(block))
Expand Down
2 changes: 2 additions & 0 deletions cpsat_log_parser/blocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .presolve_summary import PresolveSummaryBlock
from .preloading_model import PreloadingModelBlock
from .sequential_search_progress import SequentialSearchProgressBlock
from .tables import TableBlock

# The order of the following list is important.
# The first matching block is used.
Expand Down Expand Up @@ -82,5 +83,6 @@
"PreloadingModelBlock",
"PresolveSummaryBlock",
"SequentialSearchProgressBlock",
"TableBlock",
"LogBlock",
]

0 comments on commit 46a80ab

Please sign in to comment.