shapeworks::GradientDescentOptimizer
Optimizes particle system positions using gradient descent. More...
#include <GradientDescentOptimizer.h>
Public Types
| Name | |
|---|---|
| using VectorFunction::VectorType | VectorType Numerical vector type. |
| using ParticleSystem::PointType | PointType Point type. |
Public Functions
| Name | |
|---|---|
| void | start_optimization() Start the optimization. |
| void | start_adaptive_gauss_seidel_optimization() |
| void | set_early_stopping_config(const EarlyStoppingConfig & config) |
| void | initialize_early_stopping_score_function(const ParticleSystem * p) |
| void | augmented_lagrangian_constraints(VectorType & gradient, const PointType & pt, const size_t & dom, const double & maximum_update_allowed, size_t index) |
| void | stop_optimization() Sets a flag that aborts the start_optimization method after the current iteration. |
| void | abort_processing() |
| unsigned int | get_number_of_iterations() const Get the number of iterations performed by the solver. |
| void | set_number_of_iterations(unsigned int val) Set the number of iterations performed by the solver. |
| void | set_verbosity(unsigned int val) Set the verbosity level. |
| unsigned int | get_verbosity() const Get the verbosity level. |
| double | get_time_step() const Each update is scaled by this value. |
| void | set_time_step(double val) Set the time step parameter for the update. |
| unsigned int | get_maximum_number_of_iterations() const Get the maximum number of iterations allowed. |
| void | set_maximum_number_of_iterations(unsigned int val) Set the maximum number of iterations allowed. |
| double | get_tolerance() const Get the precision/tolerance of the solution. |
| void | set_tolerance(double val) Set the precision/tolerance of the solution. |
| ParticleSystem * | get_particle_system() Get the ParticleSystem modified by this optimizer. |
| const ParticleSystem * | get_particle_system() const Get the ParticleSystem modified by this optimizer (const version) |
| void | set_particle_system(ParticleSystem * val) Set the ParticleSystem modified by this optimizer. |
| std::shared_ptr< VectorFunction > | get_gradient_function() Get the gradient function used by this optimizer. |
| std::shared_ptr< const VectorFunction > | get_gradient_function() const Get the gradient function used by this optimizer (const version) |
| void | set_gradient_function(std::shared_ptr< VectorFunction > val) Set the gradient function used by this optimizer. |
| void | set_initialization_mode(bool b) Determines if this is an initialization (true) or an optimization (false) |
| void | set_check_iterations(size_t si) Sets the number of iterations when we check for convergence. |
| void | set_initialization_start_scaling_factor(double si) Sets the scaling factor at the beginning of the initialization. |
| void | set_iteration_callback(std::function< void()> callback) Set a callback to be called after each iteration. |
| std::function< void()> | get_iteration_callback() const Get the current iteration callback. |
| GradientDescentOptimizer() Constructor. |
|
| ~GradientDescentOptimizer() =default Destructor. |
Public Attributes
| Name | |
|---|---|
| constexpr unsigned int | Dimension |
Detailed Description
class shapeworks::GradientDescentOptimizer;
Optimizes particle system positions using gradient descent.
This class optimizes a list of particle system positions with respect to a specified energy function using a simple gradient descent strategy. A function which computes the gradient of the function with respect to particle position must be specified. The optimization performs Jacobi updates (each particle position is changed as soon as its new position is computed).
Public Types Documentation
using VectorType
using shapeworks::GradientDescentOptimizer::VectorType = VectorFunction::VectorType;
Numerical vector type.
using PointType
using shapeworks::GradientDescentOptimizer::PointType = ParticleSystem::PointType;
Point type.
Public Functions Documentation
function start_optimization
inline void start_optimization()
Start the optimization.
function start_adaptive_gauss_seidel_optimization
void start_adaptive_gauss_seidel_optimization()
function set_early_stopping_config
void set_early_stopping_config(
const EarlyStoppingConfig & config
)
function initialize_early_stopping_score_function
void initialize_early_stopping_score_function(
const ParticleSystem * p
)
function augmented_lagrangian_constraints
void augmented_lagrangian_constraints(
VectorType & gradient,
const PointType & pt,
const size_t & dom,
const double & maximum_update_allowed,
size_t index
)
function stop_optimization
inline void stop_optimization()
Sets a flag that aborts the start_optimization method after the current iteration.
Stop the optimization
function abort_processing
inline void abort_processing()
function get_number_of_iterations
inline unsigned int get_number_of_iterations() const
Get the number of iterations performed by the solver.
function set_number_of_iterations
inline void set_number_of_iterations(
unsigned int val
)
Set the number of iterations performed by the solver.
function set_verbosity
inline void set_verbosity(
unsigned int val
)
Set the verbosity level.
function get_verbosity
inline unsigned int get_verbosity() const
Get the verbosity level.
function get_time_step
inline double get_time_step() const
Each update is scaled by this value.
Get the time step parameter for the update
function set_time_step
inline void set_time_step(
double val
)
Set the time step parameter for the update.
function get_maximum_number_of_iterations
inline unsigned int get_maximum_number_of_iterations() const
Get the maximum number of iterations allowed.
function set_maximum_number_of_iterations
inline void set_maximum_number_of_iterations(
unsigned int val
)
Set the maximum number of iterations allowed.
function get_tolerance
inline double get_tolerance() const
Get the precision/tolerance of the solution.
function set_tolerance
inline void set_tolerance(
double val
)
Set the precision/tolerance of the solution.
function get_particle_system
inline ParticleSystem * get_particle_system()
Get the ParticleSystem modified by this optimizer.
function get_particle_system
inline const ParticleSystem * get_particle_system() const
Get the ParticleSystem modified by this optimizer (const version)
function set_particle_system
inline void set_particle_system(
ParticleSystem * val
)
Set the ParticleSystem modified by this optimizer.
function get_gradient_function
inline std::shared_ptr< VectorFunction > get_gradient_function()
Get the gradient function used by this optimizer.
function get_gradient_function
inline std::shared_ptr< const VectorFunction > get_gradient_function() const
Get the gradient function used by this optimizer (const version)
function set_gradient_function
inline void set_gradient_function(
std::shared_ptr< VectorFunction > val
)
Set the gradient function used by this optimizer.
function set_initialization_mode
inline void set_initialization_mode(
bool b
)
Determines if this is an initialization (true) or an optimization (false)
function set_check_iterations
inline void set_check_iterations(
size_t si
)
Sets the number of iterations when we check for convergence.
function set_initialization_start_scaling_factor
inline void set_initialization_start_scaling_factor(
double si
)
Sets the scaling factor at the beginning of the initialization.
function set_iteration_callback
inline void set_iteration_callback(
std::function< void()> callback
)
Set a callback to be called after each iteration.
function get_iteration_callback
inline std::function< void()> get_iteration_callback() const
Get the current iteration callback.
function GradientDescentOptimizer
GradientDescentOptimizer()
Constructor.
function ~GradientDescentOptimizer
~GradientDescentOptimizer() =default
Destructor.
Public Attributes Documentation
variable Dimension
static constexpr unsigned int Dimension = 3;
Updated on 2025-12-17 at 23:05:25 +0000