Skip to content

Commit

Permalink
Merge pull request #1898 from ERGO-Code/MIP-log-plotter
Browse files Browse the repository at this point in the history
plot_highs_log.py now avoids printing spurious incumbent lines when best solution is NaN
  • Loading branch information
jajhall committed Aug 28, 2024
2 parents cdd1b39 + 754c204 commit f5a22b6
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit f5a22b6

Please sign in to comment.