Skip to content

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

cpp 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

cpp using shapeworks::GradientDescentOptimizer::VectorType = VectorFunction::VectorType;

Numerical vector type.

using PointType

cpp using shapeworks::GradientDescentOptimizer::PointType = ParticleSystem::PointType;

Point type.

Public Functions Documentation

function start_optimization

cpp inline void start_optimization()

Start the optimization.

function start_adaptive_gauss_seidel_optimization

cpp void start_adaptive_gauss_seidel_optimization()

function set_early_stopping_config

cpp void set_early_stopping_config( const EarlyStoppingConfig & config )

function initialize_early_stopping_score_function

cpp void initialize_early_stopping_score_function( const ParticleSystem * p )

function augmented_lagrangian_constraints

cpp void augmented_lagrangian_constraints( VectorType & gradient, const PointType & pt, const size_t & dom, const double & maximum_update_allowed, size_t index )

function stop_optimization

cpp inline void stop_optimization()

Sets a flag that aborts the start_optimization method after the current iteration.

Stop the optimization

function abort_processing

cpp inline void abort_processing()

function get_number_of_iterations

cpp inline unsigned int get_number_of_iterations() const

Get the number of iterations performed by the solver.

function set_number_of_iterations

cpp inline void set_number_of_iterations( unsigned int val )

Set the number of iterations performed by the solver.

function set_verbosity

cpp inline void set_verbosity( unsigned int val )

Set the verbosity level.

function get_verbosity

cpp inline unsigned int get_verbosity() const

Get the verbosity level.

function get_time_step

cpp 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

cpp inline void set_time_step( double val )

Set the time step parameter for the update.

function get_maximum_number_of_iterations

cpp inline unsigned int get_maximum_number_of_iterations() const

Get the maximum number of iterations allowed.

function set_maximum_number_of_iterations

cpp inline void set_maximum_number_of_iterations( unsigned int val )

Set the maximum number of iterations allowed.

function get_tolerance

cpp inline double get_tolerance() const

Get the precision/tolerance of the solution.

function set_tolerance

cpp inline void set_tolerance( double val )

Set the precision/tolerance of the solution.

function get_particle_system

cpp inline ParticleSystem * get_particle_system()

Get the ParticleSystem modified by this optimizer.

function get_particle_system

cpp inline const ParticleSystem * get_particle_system() const

Get the ParticleSystem modified by this optimizer (const version)

function set_particle_system

cpp inline void set_particle_system( ParticleSystem * val )

Set the ParticleSystem modified by this optimizer.

function get_gradient_function

cpp inline std::shared_ptr< VectorFunction > get_gradient_function()

Get the gradient function used by this optimizer.

function get_gradient_function

cpp inline std::shared_ptr< const VectorFunction > get_gradient_function() const

Get the gradient function used by this optimizer (const version)

function set_gradient_function

cpp inline void set_gradient_function( std::shared_ptr< VectorFunction > val )

Set the gradient function used by this optimizer.

function set_initialization_mode

cpp inline void set_initialization_mode( bool b )

Determines if this is an initialization (true) or an optimization (false)

function set_check_iterations

cpp inline void set_check_iterations( size_t si )

Sets the number of iterations when we check for convergence.

function set_initialization_start_scaling_factor

cpp inline void set_initialization_start_scaling_factor( double si )

Sets the scaling factor at the beginning of the initialization.

function set_iteration_callback

cpp inline void set_iteration_callback( std::function< void()> callback )

Set a callback to be called after each iteration.

function get_iteration_callback

cpp inline std::function< void()> get_iteration_callback() const

Get the current iteration callback.

function GradientDescentOptimizer

cpp GradientDescentOptimizer()

Constructor.

function ~GradientDescentOptimizer

cpp ~GradientDescentOptimizer() =default

Destructor.

Public Attributes Documentation

variable Dimension

cpp static constexpr unsigned int Dimension = 3;


Updated on 2026-03-31 at 16:02:10 +0000