[upstream_utils] Upgrade to Sleipnir 0.5.2

This fixes a bug in Sleipnir's Newton solver (the exit status was inaccurate because unconstrained optimization problems can't be infeasible).
This commit is contained in:
Tyler Veness
2026-04-09 17:03:57 -07:00
committed by GitHub
parent 9ca93fa190
commit 5a96685c86
6 changed files with 33 additions and 26 deletions

View File

@@ -18,21 +18,23 @@ public enum ExitStatus {
GLOBALLY_INFEASIBLE(-3),
/** The linear system factorization failed. */
FACTORIZATION_FAILED(-4),
/** The backtracking line search failed, and the problem isn't locally infeasible. */
LINE_SEARCH_FAILED(-5),
/**
* The solver failed to reach the desired tolerance, and feasibility restoration failed to
* converge.
*/
FEASIBILITY_RESTORATION_FAILED(-5),
FEASIBILITY_RESTORATION_FAILED(-6),
/** The solver encountered nonfinite initial cost, constraints, or derivatives and gave up. */
NONFINITE_INITIAL_GUESS(-6),
NONFINITE_INITIAL_GUESS(-7),
/** The solver encountered diverging primal iterates xₖ and/or sₖ and gave up. */
DIVERGING_ITERATES(-7),
DIVERGING_ITERATES(-8),
/** The solver returned its solution so far after exceeding the maximum number of iterations. */
MAX_ITERATIONS_EXCEEDED(-8),
MAX_ITERATIONS_EXCEEDED(-9),
/**
* The solver returned its solution so far after exceeding the maximum elapsed wall clock time.
*/
TIMEOUT(-9);
TIMEOUT(-10);
/** ExitStatus value. */
public final int value;
@@ -55,11 +57,12 @@ public enum ExitStatus {
case -2 -> ExitStatus.LOCALLY_INFEASIBLE;
case -3 -> ExitStatus.GLOBALLY_INFEASIBLE;
case -4 -> ExitStatus.FACTORIZATION_FAILED;
case -5 -> ExitStatus.FEASIBILITY_RESTORATION_FAILED;
case -6 -> ExitStatus.NONFINITE_INITIAL_GUESS;
case -7 -> ExitStatus.DIVERGING_ITERATES;
case -8 -> ExitStatus.MAX_ITERATIONS_EXCEEDED;
case -9 -> ExitStatus.TIMEOUT;
case -5 -> ExitStatus.LINE_SEARCH_FAILED;
case -6 -> ExitStatus.FEASIBILITY_RESTORATION_FAILED;
case -7 -> ExitStatus.NONFINITE_INITIAL_GUESS;
case -8 -> ExitStatus.DIVERGING_ITERATES;
case -9 -> ExitStatus.MAX_ITERATIONS_EXCEEDED;
case -10 -> ExitStatus.TIMEOUT;
default -> null;
};
}

View File

@@ -25,20 +25,23 @@ enum class ExitStatus : int8_t {
GLOBALLY_INFEASIBLE = -3,
/// The linear system factorization failed.
FACTORIZATION_FAILED = -4,
/// The backtracking line search failed, and the problem isn't locally
/// infeasible.
LINE_SEARCH_FAILED = -5,
/// The solver failed to reach the desired tolerance, and feasibility
/// restoration failed to converge.
FEASIBILITY_RESTORATION_FAILED = -5,
FEASIBILITY_RESTORATION_FAILED = -6,
/// The solver encountered nonfinite initial cost, constraints, or derivatives
/// and gave up.
NONFINITE_INITIAL_GUESS = -6,
NONFINITE_INITIAL_GUESS = -7,
/// The solver encountered diverging primal iterates xₖ and/or sₖ and gave up.
DIVERGING_ITERATES = -7,
DIVERGING_ITERATES = -8,
/// The solver returned its solution so far after exceeding the maximum number
/// of iterations.
MAX_ITERATIONS_EXCEEDED = -8,
MAX_ITERATIONS_EXCEEDED = -9,
/// The solver returned its solution so far after exceeding the maximum
/// elapsed wall clock time.
TIMEOUT = -9,
TIMEOUT = -10,
};
} // namespace slp
@@ -80,11 +83,12 @@ struct fmt::formatter<slp::ExitStatus> {
return m_underlying.format("globally infeasible", ctx);
case FACTORIZATION_FAILED:
return m_underlying.format("factorization failed", ctx);
case LINE_SEARCH_FAILED:
return m_underlying.format("line search failed", ctx);
case FEASIBILITY_RESTORATION_FAILED:
return m_underlying.format("feasibility restoration failed", ctx);
case NONFINITE_INITIAL_GUESS:
return m_underlying.format(
"nonfinite initial cost, constraints, or derivatives", ctx);
return m_underlying.format("nonfinite initial guess", ctx);
case DIVERGING_ITERATES:
return m_underlying.format("diverging iterates", ctx);
case MAX_ITERATIONS_EXCEEDED:

View File

@@ -204,7 +204,7 @@ ExitStatus newton(
α *= α_reduction_factor;
if (α < α_min) {
return ExitStatus::LOCALLY_INFEASIBLE;
return ExitStatus::LINE_SEARCH_FAILED;
}
continue;
}
@@ -236,7 +236,7 @@ ExitStatus newton(
break;
}
return ExitStatus::LOCALLY_INFEASIBLE;
return ExitStatus::LINE_SEARCH_FAILED;
}
}