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

plot_highs_log.py now avoids printing spurious incumbent lines when best solution is NaN #1898

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
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
4 changes: 3 additions & 1 deletion examples/plot_highs_log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
import matplotlib.pyplot as plt
import numpy as np
import math as math


def parse_highs_log(log_file_path):
Expand Down Expand Up @@ -107,7 +108,8 @@ def plot_highs_log(

# Plot vertical hash lines where Best Solution changes
for i in range(1, len(best_sol_values)):
if best_sol_values[i] != best_sol_values[i - 1]: # Change detected
# Print if change detected and not NaN
if (best_sol_values[i] != best_sol_values[i - 1]) and not(math.isnan(best_sol_values[i])):
ax1.axvline(x=time_values[i], color="grey", linestyle="--", linewidth=0.5)

# Shift plot area left to make room on the right for the three y-axis labels.
Expand Down
Loading