-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' into topic/gar-optimizations
- Loading branch information
Showing
18 changed files
with
662 additions
and
19 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/// @file | ||
/// @copyright Copyright (C) 2025 INRIA | ||
#pragma once | ||
|
||
#include "./composite-costs.hpp" | ||
|
||
namespace aligator { | ||
|
||
/// @brief Log-barrier of an underlying cost function. | ||
template <typename Scalar> | ||
struct RelaxedLogBarrierCostTpl : CostAbstractTpl<Scalar> { | ||
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar); | ||
using CostDataAbstract = CostDataAbstractTpl<Scalar>; | ||
using Data = CompositeCostDataTpl<Scalar>; | ||
using StageFunction = StageFunctionTpl<Scalar>; | ||
using Base = CostAbstractTpl<Scalar>; | ||
using Manifold = ManifoldAbstractTpl<Scalar>; | ||
|
||
VectorXs barrier_weights_; | ||
xyz::polymorphic<StageFunction> residual_; | ||
Scalar threshold_; | ||
|
||
RelaxedLogBarrierCostTpl(xyz::polymorphic<Manifold> space, | ||
xyz::polymorphic<StageFunction> function, | ||
const ConstVectorRef &weight, | ||
const Scalar threshold); | ||
|
||
RelaxedLogBarrierCostTpl(xyz::polymorphic<Manifold> space, | ||
xyz::polymorphic<StageFunction> function, | ||
const Scalar weight, const Scalar threshold); | ||
|
||
void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, | ||
CostDataAbstract &data) const; | ||
|
||
void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u, | ||
CostDataAbstract &data) const; | ||
|
||
void computeHessians(const ConstVectorRef &, const ConstVectorRef &, | ||
CostDataAbstract &data) const; | ||
|
||
shared_ptr<CostDataAbstract> createData() const { | ||
return std::make_shared<Data>(this->ndx(), this->nu, | ||
residual_->createData()); | ||
} | ||
|
||
/// @brief Get a pointer to the underlying type of the residual, by attempting | ||
/// to cast. | ||
template <typename Derived> Derived *getResidual() { | ||
return dynamic_cast<Derived *>(&*residual_); | ||
} | ||
|
||
/// @copybrief getResidual(). | ||
template <typename Derived> const Derived *getResidual() const { | ||
return dynamic_cast<const Derived *>(&*residual_); | ||
} | ||
}; | ||
|
||
extern template struct RelaxedLogBarrierCostTpl<context::Scalar>; | ||
|
||
} // namespace aligator | ||
|
||
#include "./relaxed-log-barrier.hxx" |
Oops, something went wrong.