Skip to content

Commit

Permalink
Fix diagnostic alignment for small negative regularizations (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Jan 7, 2025
1 parent f018945 commit e751c50
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/util/PrintIterationDiagnostics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ void PrintIterationDiagnostics(int iterations, bool feasibilityRestoration,
double error, double cost, double infeasibility,
double δ, double α) {
if (iterations % 20 == 0) {
sleipnir::println("{:^4} {:^9} {:^13} {:^13} {:^13} {:^4} {:^10}",
sleipnir::println("{:^4} {:^9} {:^13} {:^13} {:^13} {:^5} {:^10}",
"iter", "time (ms)", "error", "cost", "infeasibility",
"reg", "backtracks");
sleipnir::println("{:=^79}", "");
sleipnir::println("{:=^80}", "");
}

sleipnir::print("{:4}{} {:9.3f} {:13e} {:13e} {:13e} ", iterations,
Expand All @@ -44,14 +44,14 @@ void PrintIterationDiagnostics(int iterations, bool feasibilityRestoration,

// Print regularization
if (δ == 0.0) {
sleipnir::print(" 0 ");
sleipnir::print(" 0 ");
} else {
int exponent = std::log10(δ);

if (exponent == 0) {
sleipnir::print(" 1 ");
sleipnir::print(" 1 ");
} else if (exponent == 1) {
sleipnir::print("10 ");
sleipnir::print("10 ");
} else {
// Gather regularization exponent digits
int n = std::abs(exponent);
Expand All @@ -73,7 +73,7 @@ void PrintIterationDiagnostics(int iterations, bool feasibilityRestoration,
reg += strs[digit];
}

sleipnir::print("{:<4}", reg);
sleipnir::print("{:<5}", reg);
}
}

Expand Down

0 comments on commit e751c50

Please sign in to comment.