-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[upstream_utils] Upgrade Sleipnir (#7512)
It now uses SQP for problems without inequality constraints, which is faster. main: ``` [ RUN ] Ellipse2dTest.DistanceToPoint 0.203 ms [ OK ] Ellipse2dTest.DistanceToPoint (0 ms) [ RUN ] Ellipse2dTest.FindNearestPoint 0.019 ms [ OK ] Ellipse2dTest.FindNearestPoint (0 ms) ``` upgrade: ``` [ RUN ] Ellipse2dTest.DistanceToPoint 0.197 ms [ OK ] Ellipse2dTest.DistanceToPoint (0 ms) [ RUN ] Ellipse2dTest.FindNearestPoint 0.015 ms [ OK ] Ellipse2dTest.FindNearestPoint (0 ms) ```
- Loading branch information
Showing
10 changed files
with
965 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
wpimath/src/main/native/thirdparty/sleipnir/include/sleipnir/optimization/solver/SQP.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Sleipnir contributors | ||
|
||
#pragma once | ||
|
||
#include <span> | ||
|
||
#include <Eigen/Core> | ||
|
||
#include "sleipnir/autodiff/Variable.hpp" | ||
#include "sleipnir/optimization/SolverConfig.hpp" | ||
#include "sleipnir/optimization/SolverIterationInfo.hpp" | ||
#include "sleipnir/optimization/SolverStatus.hpp" | ||
#include "sleipnir/util/FunctionRef.hpp" | ||
#include "sleipnir/util/SymbolExports.hpp" | ||
|
||
namespace sleipnir { | ||
|
||
/** | ||
Finds the optimal solution to a nonlinear program using Sequential Quadratic | ||
Programming (SQP). | ||
A nonlinear program has the form: | ||
@verbatim | ||
min_x f(x) | ||
subject to cₑ(x) = 0 | ||
@endverbatim | ||
where f(x) is the cost function and cₑ(x) are the equality constraints. | ||
@param[in] decisionVariables The list of decision variables. | ||
@param[in] equalityConstraints The list of equality constraints. | ||
@param[in] f The cost function. | ||
@param[in] callback The user callback. | ||
@param[in] config Configuration options for the solver. | ||
@param[in,out] x The initial guess and output location for the decision | ||
variables. | ||
@param[out] status The solver status. | ||
*/ | ||
SLEIPNIR_DLLEXPORT void SQP( | ||
std::span<Variable> decisionVariables, | ||
std::span<Variable> equalityConstraints, Variable& f, | ||
function_ref<bool(const SolverIterationInfo& info)> callback, | ||
const SolverConfig& config, Eigen::VectorXd& x, SolverStatus* status); | ||
|
||
} // namespace sleipnir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.