|
|
@ -77,56 +77,37 @@ class BenchmarkRunner:
|
|
|
|
def _push_result(self, result, solver, solver_name, instance):
|
|
|
|
def _push_result(self, result, solver, solver_name, instance):
|
|
|
|
if self.results is None:
|
|
|
|
if self.results is None:
|
|
|
|
self.results = pd.DataFrame(
|
|
|
|
self.results = pd.DataFrame(
|
|
|
|
|
|
|
|
# Show the following columns first in the CSV file
|
|
|
|
columns=[
|
|
|
|
columns=[
|
|
|
|
"Solver",
|
|
|
|
"Solver",
|
|
|
|
"Instance",
|
|
|
|
"Instance",
|
|
|
|
"Wallclock Time",
|
|
|
|
|
|
|
|
"Lower Bound",
|
|
|
|
|
|
|
|
"Upper Bound",
|
|
|
|
|
|
|
|
"Gap",
|
|
|
|
|
|
|
|
"Nodes",
|
|
|
|
|
|
|
|
"Mode",
|
|
|
|
|
|
|
|
"Sense",
|
|
|
|
|
|
|
|
"Predicted LB",
|
|
|
|
|
|
|
|
"Predicted UB",
|
|
|
|
|
|
|
|
]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
lb = result["Lower bound"]
|
|
|
|
lb = result["Lower bound"]
|
|
|
|
ub = result["Upper bound"]
|
|
|
|
ub = result["Upper bound"]
|
|
|
|
gap = (ub - lb) / lb
|
|
|
|
result["Solver"] = solver_name
|
|
|
|
if "Predicted LB" not in result:
|
|
|
|
result["Instance"] = instance
|
|
|
|
result["Predicted LB"] = float("nan")
|
|
|
|
result["Gap"] = (ub - lb) / lb
|
|
|
|
result["Predicted UB"] = float("nan")
|
|
|
|
result["Mode"] = solver.mode
|
|
|
|
self.results = self.results.append(
|
|
|
|
del result["Log"]
|
|
|
|
{
|
|
|
|
self.results = self.results.append(pd.DataFrame([result]))
|
|
|
|
"Solver": solver_name,
|
|
|
|
|
|
|
|
"Instance": instance,
|
|
|
|
# Compute relative statistics
|
|
|
|
"Wallclock Time": result["Wallclock time"],
|
|
|
|
|
|
|
|
"Lower Bound": lb,
|
|
|
|
|
|
|
|
"Upper Bound": ub,
|
|
|
|
|
|
|
|
"Gap": gap,
|
|
|
|
|
|
|
|
"Nodes": result["Nodes"],
|
|
|
|
|
|
|
|
"Mode": solver.mode,
|
|
|
|
|
|
|
|
"Sense": result["Sense"],
|
|
|
|
|
|
|
|
"Predicted LB": result["Predicted LB"],
|
|
|
|
|
|
|
|
"Predicted UB": result["Predicted UB"],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
ignore_index=True,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
groups = self.results.groupby("Instance")
|
|
|
|
groups = self.results.groupby("Instance")
|
|
|
|
best_lower_bound = groups["Lower Bound"].transform("max")
|
|
|
|
best_lower_bound = groups["Lower bound"].transform("max")
|
|
|
|
best_upper_bound = groups["Upper Bound"].transform("min")
|
|
|
|
best_upper_bound = groups["Upper bound"].transform("min")
|
|
|
|
best_gap = groups["Gap"].transform("min")
|
|
|
|
best_gap = groups["Gap"].transform("min")
|
|
|
|
best_nodes = np.maximum(1, groups["Nodes"].transform("min"))
|
|
|
|
best_nodes = np.maximum(1, groups["Nodes"].transform("min"))
|
|
|
|
best_wallclock_time = groups["Wallclock Time"].transform("min")
|
|
|
|
best_wallclock_time = groups["Wallclock time"].transform("min")
|
|
|
|
self.results["Relative Lower Bound"] = (
|
|
|
|
self.results["Relative lower bound"] = (
|
|
|
|
self.results["Lower Bound"] / best_lower_bound
|
|
|
|
self.results["Lower bound"] / best_lower_bound
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.results["Relative Upper Bound"] = (
|
|
|
|
self.results["Relative upper bound"] = (
|
|
|
|
self.results["Upper Bound"] / best_upper_bound
|
|
|
|
self.results["Upper bound"] / best_upper_bound
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.results["Relative Wallclock Time"] = (
|
|
|
|
self.results["Relative wallclock time"] = (
|
|
|
|
self.results["Wallclock Time"] / best_wallclock_time
|
|
|
|
self.results["Wallclock time"] / best_wallclock_time
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.results["Relative Gap"] = self.results["Gap"] / best_gap
|
|
|
|
self.results["Relative Gap"] = self.results["Gap"] / best_gap
|
|
|
|
self.results["Relative Nodes"] = self.results["Nodes"] / best_nodes
|
|
|
|
self.results["Relative Nodes"] = self.results["Nodes"] / best_nodes
|
|
|
@ -143,12 +124,12 @@ class BenchmarkRunner:
|
|
|
|
|
|
|
|
|
|
|
|
sense = results.loc[0, "Sense"]
|
|
|
|
sense = results.loc[0, "Sense"]
|
|
|
|
if sense == "min":
|
|
|
|
if sense == "min":
|
|
|
|
primal_column = "Relative Upper Bound"
|
|
|
|
primal_column = "Relative upper bound"
|
|
|
|
obj_column = "Upper Bound"
|
|
|
|
obj_column = "Upper bound"
|
|
|
|
predicted_obj_column = "Predicted UB"
|
|
|
|
predicted_obj_column = "Predicted UB"
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
primal_column = "Relative Lower Bound"
|
|
|
|
primal_column = "Relative lower bound"
|
|
|
|
obj_column = "Lower Bound"
|
|
|
|
obj_column = "Lower bound"
|
|
|
|
predicted_obj_column = "Predicted LB"
|
|
|
|
predicted_obj_column = "Predicted LB"
|
|
|
|
|
|
|
|
|
|
|
|
fig, (ax1, ax2, ax3, ax4) = plt.subplots(
|
|
|
|
fig, (ax1, ax2, ax3, ax4) = plt.subplots(
|
|
|
@ -158,10 +139,10 @@ class BenchmarkRunner:
|
|
|
|
gridspec_kw={"width_ratios": [2, 1, 1, 2]},
|
|
|
|
gridspec_kw={"width_ratios": [2, 1, 1, 2]},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Figure 1: Solver x Wallclock Time
|
|
|
|
# Figure 1: Solver x Wallclock time
|
|
|
|
sns.stripplot(
|
|
|
|
sns.stripplot(
|
|
|
|
x="Solver",
|
|
|
|
x="Solver",
|
|
|
|
y="Wallclock Time",
|
|
|
|
y="Wallclock time",
|
|
|
|
data=results,
|
|
|
|
data=results,
|
|
|
|
ax=ax1,
|
|
|
|
ax=ax1,
|
|
|
|
jitter=0.25,
|
|
|
|
jitter=0.25,
|
|
|
@ -169,14 +150,14 @@ class BenchmarkRunner:
|
|
|
|
)
|
|
|
|
)
|
|
|
|
sns.barplot(
|
|
|
|
sns.barplot(
|
|
|
|
x="Solver",
|
|
|
|
x="Solver",
|
|
|
|
y="Wallclock Time",
|
|
|
|
y="Wallclock time",
|
|
|
|
data=results,
|
|
|
|
data=results,
|
|
|
|
ax=ax1,
|
|
|
|
ax=ax1,
|
|
|
|
errwidth=0.0,
|
|
|
|
errwidth=0.0,
|
|
|
|
alpha=0.4,
|
|
|
|
alpha=0.4,
|
|
|
|
estimator=median,
|
|
|
|
estimator=median,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
ax1.set(ylabel="Wallclock Time (s)")
|
|
|
|
ax1.set(ylabel="Wallclock time (s)")
|
|
|
|
|
|
|
|
|
|
|
|
# Figure 2: Solver x Gap (%)
|
|
|
|
# Figure 2: Solver x Gap (%)
|
|
|
|
ax2.set_ylim(-0.5, 5.5)
|
|
|
|
ax2.set_ylim(-0.5, 5.5)
|
|
|
|