The Model class encapsulates a Mesh and a Record object.
More...
#include <Model.hpp>
|
| | Model (Mesh &mesh_, Record &record_) |
| | Constructs a new Model object.
|
| |
| bool | should_continue_optimization () |
| | Determines whether the optimization algorithm should continue running.
|
| |
| void | determine_trial_step_size () |
| | This code determines the step size used in an optimization algorithm. The step size is used to calculate how far to move in each iteration of the optimization algorithm to minimize an energy function.
|
| |
| std::string | to_string_current_step () |
| | Returns a string representation of the current step's iteration number, trial step size, and optimal step size. The function concatenates the values of model.iteration, model.oa.trialStepSize, and model.stepSize to the following format: "step: , trial StepSize = , StepSize = ".
|
| |
| void | update_ncg_direction () |
| | Updates the direction for nonlinear conjugate gradient (NCG) optimization.
|
| |
| void | reset_ncg_direction () |
| | Reset the direction for nonlinear conjugate gradient (NCG) optimization.
|
| |
| double | linear_search_for_stepsize_to_minimize_energy () |
| | Performs a linear search to find the optimal step size that minimizes energy using either nonlinear conjugate gradient method or simple line search.
|
| |
| bool | simulated_annealing_next_step (bool forceAttempt=false) |
| | Use a Metropolis thermal trial move to sample beyond local gradient descent.
|
| |
| void | enforce_boundary_conditions_after_coordinate_update () |
| | Synchronize boundary/ghost coordinates after direct coordinate updates.
|
| |
| void | update_vertex_using_NCG () |
| | Update vertex coordinates using a non-linear conjugate gradient method.
|
| |
The Model class encapsulates a Mesh and a Record object.
◆ Model()
Constructs a new Model object.
- Parameters
-
| mesh_ | The mesh object to be encapsulated. |
| record_ | The record object to be encapsulated. |
◆ determine_trial_step_size()
| void Model::determine_trial_step_size |
( |
| ) |
|
This code determines the step size used in an optimization algorithm. The step size is used to calculate how far to move in each iteration of the optimization algorithm to minimize an energy function.
- Returns
- double trialStepSize
◆ enforce_boundary_conditions_after_coordinate_update()
| void Model::enforce_boundary_conditions_after_coordinate_update |
( |
| ) |
|
Synchronize boundary/ghost coordinates after direct coordinate updates.
◆ linear_search_for_stepsize_to_minimize_energy()
| double Model::linear_search_for_stepsize_to_minimize_energy |
( |
| ) |
|
Performs a linear search to find the optimal step size that minimizes energy using either nonlinear conjugate gradient method or simple line search.
- Returns
- double The optimal step size. Returns -1 if no efficient step size is found with the simple line search method.
◆ reset_ncg_direction()
| void Model::reset_ncg_direction |
( |
| ) |
|
Reset the direction for nonlinear conjugate gradient (NCG) optimization.
◆ should_continue_optimization()
| bool Model::should_continue_optimization |
( |
| ) |
|
Determines whether the optimization algorithm should continue running.
The function returns true if the model has not yet been optimized and the maximum number of iterations has not been reached. Otherwise, the function returns false and the optimization algorithm stops.
- Note
- The implementation of this function can be changed to customize the optimization.
- Returns
- true if the optimization algorithm should continue running, false otherwise.
◆ simulated_annealing_next_step()
| bool Model::simulated_annealing_next_step |
( |
bool |
forceAttempt = false | ) |
|
Use a Metropolis thermal trial move to sample beyond local gradient descent.
- Returns
- true if a thermal trial was attempted on this iteration.
◆ to_string_current_step()
| std::string Model::to_string_current_step |
( |
| ) |
|
Returns a string representation of the current step's iteration number, trial step size, and optimal step size. The function concatenates the values of model.iteration, model.oa.trialStepSize, and model.stepSize to the following format: "step: , trial StepSize = , StepSize = ".
- Returns
- std::string A string representation of the current step's information.
◆ update_ncg_direction()
| void Model::update_ncg_direction |
( |
| ) |
|
Updates the direction for nonlinear conjugate gradient (NCG) optimization.
This function calculates the dot product of the previous and current forces to determine the NCG factor. It then updates the NCG direction either as a combination of the current force and the previous NCG direction, or just the current force depending on whether NCG optimization is being used. The NCG direction is updated in the input vector ncgDirections.
◆ update_vertex_using_NCG()
| void Model::update_vertex_using_NCG |
( |
| ) |
|
Update vertex coordinates using a non-linear conjugate gradient method.
◆ coolingStep
| int Model::coolingStep = 35 |
◆ currentCoolingStep
| int Model::currentCoolingStep = 0 |
◆ currentHeatingStep
| int Model::currentHeatingStep = 0 |
◆ heatingStep
| int Model::heatingStep = 15 |
◆ highTemperature
| double Model::highTemperature = 0.0 |
◆ isHeating
| bool Model::isHeating = true |
◆ iteration
The current iteration count of the optimization algorithm.
◆ mesh
◆ ncgDirection0
| std::vector<Force> Model::ncgDirection0 |
vector to store the initial direction for nonlinear conjugate gradient optimization
◆ oa
The state for the optimization algorithm.
◆ record
◆ stepSize
◆ thermalFluctuationAttemptCount
| int Model::thermalFluctuationAttemptCount = 0 |
Number of attempted thermal trial moves.
◆ thermalFluctuationRecords
Diagnostics for thermal trial moves.
◆ thermalRng
| std::mt19937 Model::thermalRng |
Reproducible random generator for thermal fluctuation trial moves.
The documentation for this class was generated from the following file: