Ocean
Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize > Class Template Reference

This class implements an optimization for universal dense problems with one model (optimization problem). More...

Inheritance diagram for Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >:

Data Structures

class  UniversalOptimizationProvider
 This class implements a dense universal optimization provider for universal models and measurement/data values. More...
 

Public Types

typedef StaticBuffer< Scalar, tModelSize > Model
 Definition of a model. More...
 
typedef StaticBuffer< Scalar, tExternalModelSize > ExternalModel
 Definition of an external model. More...
 
typedef StaticBuffer< Scalar, tResultDimension > Result
 Definition of a model result. More...
 
typedef Callback< void, const ExternalModel &, const size_t, Result & > ValueCallback
 Definition of a callback function for dense value calculation. More...
 
typedef Callback< bool, const ExternalModel &, const size_t, Result & > ErrorCallback
 Definition of a callback function for dense error calculation. More...
 
typedef Callback< void, Model &, ExternalModel & > ModelTransformationCallback
 Definition of a dense model transformation function. More...
 
typedef Callback< void, Model & > ModelAdjustmentCallback
 Definition of a dense model adjustment function. More...
 

Static Public Member Functions

static bool optimizeUniversalModel (const Model &model, const size_t numberElements, const ValueCallback &valueCallback, const ErrorCallback &errorCallback, const ModelTransformationCallback &modelTransformationCallback, const ModelAdjustmentCallback &modelAdjustmentCallback, Model &optimizedModel, const unsigned int iterations=5u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
 Optimizes a universal model by minimizing the error the model produces. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Ocean::Geometry::NonLinearOptimization
template<typename T >
static bool denseOptimization (T &provider, const unsigned int iterations=5u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem. More...
 
template<typename T , Estimator::EstimatorType tEstimator>
static bool denseOptimization (T &provider, const unsigned int iterations=5u, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem. More...
 
template<typename T >
static bool sparseOptimization (T &provider, const unsigned int iterations=5u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem. More...
 
template<typename T , Estimator::EstimatorType tEstimator>
static bool sparseOptimization (T &provider, const unsigned int iterations=5u, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem. More...
 
template<typename T >
static bool advancedDenseOptimization (T &advancedDenseProvider, const unsigned int iterations, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem using an advanced optimization provider. More...
 
template<typename T >
static bool advancedSparseOptimization (T &advancedSparseProvider, const unsigned int iterations, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem using an advanced optimization provider. More...
 
template<Estimator::EstimatorType tEstimator>
static Scalar sqrErrors2robustErrors2 (const Scalars &sqrErrors, const size_t modelParameters, Vector2 *weightedErrors, Vector2 *weightVectors, const SquareMatrix2 *transposedInvertedCovariances)
 Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<Estimator::EstimatorType tEstimator, size_t tDimension>
static Scalar sqrErrors2robustErrors (const Scalars &sqrErrors, const size_t modelParameters, StaticBuffer< Scalar, tDimension > *weightedErrors, StaticBuffer< Scalar, tDimension > *weightVectors, const Matrix *transposedInvertedCovariances)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<Estimator::EstimatorType tEstimator>
static Scalar sqrErrors2robustErrors_i (const Scalars &sqrErrors, const size_t modelParameters, const size_t dimension, Scalar *weightedErrors_i, Scalar *weightVectors_i, const Matrix *transposedInvertedCovariances_i)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
static Scalar sqrErrors2robustErrors2 (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, Vector2 *weightedErrors, Vector2 *weightVectors, const SquareMatrix2 *transposedInvertedCovariances)
 Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<size_t tDimension>
static Scalar sqrErrors2robustErrors (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, StaticBuffer< Scalar, tDimension > *weightedErrors, StaticBuffer< Scalar, tDimension > *weightVectors, const Matrix *transposedInvertedCovariances)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
static Scalar sqrErrors2robustErrors_i (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, const size_t dimension, Scalar *weightedErrors_i, Scalar *weightVectors_i, const Matrix *transposedInvertedCovariances_i)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 

Detailed Description

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
class Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >

This class implements an optimization for universal dense problems with one model (optimization problem).

The implementation allows to optimize arbitrary (universal) problems with arbitrary dimensions.

Template Parameters
tModelSizeSize of the model, the number of model parameters
tResultDimensionNumber of dimensions that result for each element (measurement) after the model has been applied
tExternalModelSizeSize of the external model, the number of model parameters

Member Typedef Documentation

◆ ErrorCallback

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
typedef Callback<bool, const ExternalModel&, const size_t, Result&> Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::ErrorCallback

Definition of a callback function for dense error calculation.

The first parameter provides the external model that is applied to determine the error.
The second parameter provides the index of the measurement elements that is used to determine the error.
The third parameter receives the determined error.
The return value provides True if both models provide valid information for the measurement element.

◆ ExternalModel

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
typedef StaticBuffer<Scalar, tExternalModelSize> Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::ExternalModel

Definition of an external model.

◆ Model

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
typedef StaticBuffer<Scalar, tModelSize> Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::Model

Definition of a model.

◆ ModelAdjustmentCallback

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
typedef Callback<void, Model&> Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::ModelAdjustmentCallback

Definition of a dense model adjustment function.

The adjustment function allows to modify the internal model (the modification should be tiny e.g., a normalization of a vector which has almost length 1) before the model will be accepted or rejected The first parameter provides the model to be adjusted

◆ ModelTransformationCallback

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
typedef Callback<void, Model&, ExternalModel&> Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::ModelTransformationCallback

Definition of a dense model transformation function.

The transformation function allows to use an external model function for value and error determination while the internal model is used for the internal optimization.
The first parameter provides the internal model.
The second parameter receives the external model.

◆ Result

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
typedef StaticBuffer<Scalar, tResultDimension> Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::Result

Definition of a model result.

◆ ValueCallback

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize = tModelSize>
typedef Callback<void, const ExternalModel&, const size_t, Result&> Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::ValueCallback

Definition of a callback function for dense value calculation.

The first parameter provides the external model that is applied to determine the value.
The second parameter provides the index of the measurement elements that is used to determine the value.
The third parameter receives the determined value.

Member Function Documentation

◆ optimizeUniversalModel()

template<unsigned int tModelSize, unsigned int tResultDimension, unsigned int tExternalModelSize>
bool Ocean::Geometry::NonLinearUniversalOptimizationDense< tModelSize, tResultDimension, tExternalModelSize >::optimizeUniversalModel ( const Model model,
const size_t  numberElements,
const ValueCallback valueCallback,
const ErrorCallback errorCallback,
const ModelTransformationCallback modelTransformationCallback,
const ModelAdjustmentCallback modelAdjustmentCallback,
Model optimizedModel,
const unsigned int  iterations = 5u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
Scalar initialError = nullptr,
Scalar finalError = nullptr,
Scalars intermediateErrors = nullptr 
)
static

Optimizes a universal model by minimizing the error the model produces.

Parameters
modelUniversal model that will be optimized
numberElementsNumber of elements (measurements) that are used to determine the optimized model
valueCallbackCallback function that is used to determine the value for an individual element (measurement) by application of the model
errorCallbackCallback function that is used to determine the error for an individual element (measurement)
modelTransformationCallbackOptional callback function allowing to transform the internal model into an extern model if intended
modelAdjustmentCallbackOptional callback function allowing to adjust the internal (already optimized) model before it will be checked on improvements
optimizedModelResulting optimized model
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorRobust error estimator to be used
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
intermediateErrorsOptional resulting intermediate (improving) errors
Returns
True, if the model could be optimized

The documentation for this class was generated from the following file: