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

[website] Rename the size column to instance, fix size filters #77

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions website/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,51 @@
filtered_sizes_df = sizes_df[sizes_df["Size"].isin(matching_sizes)]

if not filtered_sizes_df.empty:
display_sizes_df = filtered_sizes_df.drop(columns=["Size"])
display_sizes_df = filtered_sizes_df.rename(
columns={
"N. of variables": "n_of_variables",
"N. of constraints": "n_of_constraints",
},
)

# Build grid options for the filtered sizes table
gb_sizes = GridOptionsBuilder.from_dataframe(filtered_sizes_df)
gb_sizes.configure_grid_options(domLayout="autoHeight")
grid_options_sizes = gb_sizes.build()

column_config = [
{
"field": "Size",
"headerName": "Instance",
"pinned": "left",
},
{
"field": "Spatial resolution",
},
{
"field": "Temporal resolution",
},
{
"field": "n_of_variables",
"headerName": "N. of variables",
},
{
"field": "n_of_constraints",
"headerName": "N. of constraints",
},
]

grid_options = {
"columnDefs": column_config,
}

# Display filtered sizes table using ag-Grid
AgGrid(
filtered_sizes_df,
display_sizes_df,
editable=False,
sortable=True,
filter=True,
gridOptions=grid_options_sizes,
gridOptions=grid_options,
fit_columns_on_grid_load=True,
)
else:
Expand Down Expand Up @@ -156,7 +187,7 @@
for solver in status_subset["Solver"].unique():
subset = status_subset[status_subset["Solver"] == solver]
tooltip_text = subset.apply(
lambda row: f"Solver: {row['Solver']}<br>Size: {row['Size']}",
lambda row: f"Solver: {row['Solver']}<br>Instance: {row['Size']}",
axis=1,
)

Expand Down
2 changes: 1 addition & 1 deletion website/components/compare_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def create_comparison_chart(

# Create tooltips for hover information
hover_text = subset.apply(
lambda row: (f"{row['Benchmark']}<br>Size: {row['Size']}"),
lambda row: (f"{row['Benchmark']}<br>Instance: {row['Size']}"),
axis=1,
)

Expand Down
2 changes: 1 addition & 1 deletion website/components/home_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def render_benchmark_scatter_plot(data: pd.DataFrame, metadata, key):
status_symbols.get(status, "circle") for status in subset["Status"]
]
hover_text = subset.apply(
lambda row: f"{row['Benchmark']}<br>Size: {row['Size']}",
lambda row: f"{row['Benchmark']}<br>Instance: {row['Size']}",
axis=1,
)

Expand Down
3 changes: 3 additions & 0 deletions website/raw-results.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@
# Round the DataFrame values
df = df.round({"Objective Value": 2, "Runtime (s)": 1, "Memory Usage (MB)": 0})

# Rename 'Size' to 'Instance'
df = df.rename(columns={"Size": "Instance"})

# Display the filtered table
filtered_df = display_table(df)
9 changes: 6 additions & 3 deletions website/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@


def create_subplots(data, y_metric):
# Rename 'Size' to 'Instance'
data = data.rename(columns={"Size": "Instance"})

status_symbols = {
"TO": "x", # Timeout gets an "X"
"ok": "circle", # Normal execution gets a circle
Expand All @@ -22,7 +25,7 @@ def create_subplots(data, y_metric):
color="Solver",
symbol="Status",
symbol_map=status_symbols,
hover_data=["Benchmark", "Size"],
hover_data=["Benchmark", "Instance"],
title="Spatial Resolution",
)

Expand All @@ -33,7 +36,7 @@ def create_subplots(data, y_metric):
color="Solver",
symbol="Status",
symbol_map=status_symbols,
hover_data=["Benchmark", "Size"],
hover_data=["Benchmark", "Instance"],
title="Num Variables",
)

Expand All @@ -44,7 +47,7 @@ def create_subplots(data, y_metric):
color="Solver",
symbol="Status",
symbol_map=status_symbols,
hover_data=["Benchmark", "Size"],
hover_data=["Benchmark", "Instance"],
title="Num Constraints",
)

Expand Down
Loading