Generic interface for optimization problem definitions. More...
#include <optimization_problem_interface.h>
Public Types | |
using | Ptr = std::shared_ptr< OptimizationProblemInterface > |
using | UPtr = std::unique_ptr< OptimizationProblemInterface > |
Public Member Functions | |
virtual void | clear () |
virtual | ~OptimizationProblemInterface () |
Specify the dimension of the optimization problem | |
| |
virtual int | getNonLsqObjectiveDimension ()=0 |
Get dimension of the objective (should be zero or one) More... | |
virtual int | getLsqObjectiveDimension ()=0 |
Total dimension of least-squares objective function terms. More... | |
virtual int | getObjectiveDimension ()=0 |
Get dimension of the objective (should be zero or one, includes Lsq objectives if present) More... | |
virtual int | getEqualityDimension ()=0 |
Total dimension of equality constraints. More... | |
virtual int | getInequalityDimension ()=0 |
Total dimension of general inequality constraints. More... | |
virtual int | getParameterDimension ()=0 |
Effictive dimension of the optimization parameter set (changeable, non-fixed part) More... | |
Generic interface to interact with the underlying parameter/variables representation | |
| |
virtual void | applyIncrement (const Eigen::Ref< const Eigen::VectorXd > &increment) |
Apply increment to the current parameter set. More... | |
virtual void | applyIncrement (int idx, double increment) |
Apply increment to the current parameter set (single element overload) More... | |
virtual double | getParameterValue (int idx)=0 |
Return specific value of the parameter vector. More... | |
virtual void | setParameterValue (int idx, double x)=0 |
Set specific value of the parameter vector. More... | |
virtual void | getParameterVector (Eigen::Ref< Eigen::VectorXd > x) |
Return deep copy of the complete parameter vector. More... | |
virtual void | setParameterVector (const Eigen::Ref< const Eigen::VectorXd > &x) |
Set complete parameter vector. More... | |
virtual void | backupParameters ()=0 |
Restore parameter set from the last backup and keep backup if desired. More... | |
virtual void | restoreBackupParameters (bool keep_backup)=0 |
Discard last backup (or all) More... | |
virtual void | discardBackupParameters (bool all=false)=0 |
Specify properties of the optimization problem | |
| |
virtual bool | isLeastSquaresProblem () const =0 |
Check if the underlying problem is defined in the least squares form. More... | |
Access bounds | |
| |
virtual double | getLowerBound (int idx)=0 |
Return specific lower bound value of a parameter. More... | |
virtual double | getUpperBound (int idx)=0 |
Return specific upper bound of a parameter. More... | |
virtual void | setLowerBound (int idx, double lb)=0 |
Set specific lower bound of a parameter. More... | |
virtual void | setUpperBound (int idx, double ub)=0 |
Set specific upper bound of a parameter. More... | |
virtual void | setBounds (const Eigen::Ref< const Eigen::VectorXd > &lb, const Eigen::Ref< const Eigen::VectorXd > &ub) |
Set lower and upper bound vector. More... | |
virtual void | getBounds (Eigen::Ref< Eigen::VectorXd > lb, Eigen::Ref< Eigen::VectorXd > ub) |
Get lower and upper bound vector. More... | |
Specify main equations of the optimization problem | |
| |
virtual void | computeValuesLsqObjective (Eigen::Ref< Eigen::VectorXd > values)=0 |
Compute the objective function values f(x) for the current parameter set. More... | |
virtual double | computeValueNonLsqObjective ()=0 |
virtual double | computeValueObjective () |
virtual void | computeValuesEquality (Eigen::Ref< Eigen::VectorXd > values)=0 |
Compute the equality constraint values ceq(x) for the current parameter set. More... | |
virtual void | computeValuesInequality (Eigen::Ref< Eigen::VectorXd > values)=0 |
Compute the inequality constraint values c(x) for the current parameter set. More... | |
virtual void | computeValues (double &non_lsq_obj_value, Eigen::Ref< Eigen::VectorXd > lsq_obj_values, Eigen::Ref< Eigen::VectorXd > eq_values, Eigen::Ref< Eigen::VectorXd > ineq_values) |
Methods for dealing with bounds | |
| |
virtual int | finiteCombinedBoundsDimension () |
Dimension of the set of finite bounds (combined such that each ub and lb component define a single dimension) More... | |
virtual int | finiteBoundsDimension () |
Dimension of the set of finite bounds (individual bounds ub and lb) More... | |
virtual void | computeValuesActiveInequality (Eigen::Ref< Eigen::VectorXd > values, double weight=1.0) |
Compute the values of the active inequality constraints (elementwise max(0, c(x))) More... | |
virtual void | computeDistanceFiniteCombinedBounds (Eigen::Ref< Eigen::VectorXd > values) |
Compute the distance to finite bound values (combined lower and upper) More... | |
virtual void | computeLowerAndUpperBoundDiff (Eigen::Ref< Eigen::VectorXd > lb_minus_x, Eigen::Ref< Eigen::VectorXd > ub_minus_x) |
Compute the distance between parameters and bounds. More... | |
virtual void | getParametersAndBoundsFinite (Eigen::Ref< Eigen::VectorXd > lb_finite_bounds, Eigen::Ref< Eigen::VectorXd > ub_finite_bounds, Eigen::Ref< Eigen::VectorXd > x_finite_bounds) |
Return bound and parameter vectors only for finite boudns. More... | |
virtual void | computeGradientObjective (Eigen::Ref< Eigen::VectorXd > gradient) |
virtual void | computeGradientNonLsqObjective (Eigen::Ref< Eigen::VectorXd > gradient) |
virtual void | computeDenseJacobianLsqObjective (Eigen::Ref< Eigen::MatrixXd > jacobian, const double *multipliers=nullptr) |
Compute the objective Jacobian Jf(x) for the current parameter set. More... | |
virtual int | computeSparseJacobianLsqObjectiveNNZ () |
virtual void | computeSparseJacobianLsqObjectiveStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col) |
virtual void | computeSparseJacobianLsqObjectiveValues (Eigen::Ref< Eigen::VectorXd > values, const double *multipliers=nullptr) |
virtual void | computeSparseJacobianLsqObjective (Eigen::SparseMatrix< double > &jacobian, const double *multipliers=nullptr) |
virtual void | computeDenseJacobianEqualities (Eigen::Ref< Eigen::MatrixXd > jacobian, const double *multipliers=nullptr) |
Compute the equality constraint Jacobian Jceq(x) for the current parameter set. More... | |
virtual int | computeSparseJacobianEqualitiesNNZ () |
virtual void | computeSparseJacobianEqualitiesStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col) |
virtual void | computeSparseJacobianEqualitiesValues (Eigen::Ref< Eigen::VectorXd > values, const double *multipliers=nullptr) |
virtual void | computeSparseJacobianEqualities (Eigen::SparseMatrix< double > &jacobian, const double *multipliers=nullptr) |
virtual void | computeDenseJacobianInequalities (Eigen::Ref< Eigen::MatrixXd > jacobian, const double *multipliers=nullptr) |
Compute the inequality constraint Jacobian Jc(x) for the current parameter set. More... | |
virtual int | computeSparseJacobianInequalitiesNNZ () |
virtual void | computeSparseJacobianInequalitiesStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col) |
virtual void | computeSparseJacobianInequalitiesValues (Eigen::Ref< Eigen::VectorXd > values, const double *multipliers=nullptr) |
virtual void | computeSparseJacobianInequalities (Eigen::SparseMatrix< double > &jacobian, const double *multipliers=nullptr) |
virtual void | computeDenseJacobianActiveInequalities (Eigen::Ref< Eigen::MatrixXd > jacobian, double weight=1.0) |
Compute the Jacobian Jc(x) with non-zeros for active constraints c(x)>= 0 and zeros for inactive ones. More... | |
virtual void | computeSparseJacobianActiveInequalitiesValues (Eigen::Ref< Eigen::VectorXd > values, double weight=1.0) |
virtual void | computeSparseJacobianActiveInequalities (Eigen::SparseMatrix< double > &jacobian, double weight=1.0) |
virtual void | computeDenseJacobianFiniteCombinedBounds (Eigen::Ref< Eigen::MatrixXd > jacobian, double weight=1.0) |
Compute the Jacobian for finite combined bounds. More... | |
virtual int | computeSparseJacobianFiniteCombinedBoundsNNZ () |
virtual void | computeSparseJacobianFiniteCombinedBoundsStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col) |
virtual void | computeSparseJacobianFiniteCombinedBoundsValues (Eigen::Ref< Eigen::VectorXd > values, double weight=1.0) |
virtual void | computeSparseJacobianFiniteCombinedBounds (Eigen::SparseMatrix< double > &jacobian, double weight=1.0) |
virtual void | computeDenseJacobianFiniteCombinedBoundsIdentity (Eigen::Ref< Eigen::MatrixXd > jacobian) |
Compute the Jacobian for finite combined bounds. More... | |
virtual void | computeDenseJacobians (Eigen::Ref< Eigen::VectorXd > gradient_non_lsq_obj, Eigen::Ref< Eigen::MatrixXd > jacobian_lsq_obj, Eigen::Ref< Eigen::MatrixXd > jacobian_eq, Eigen::Ref< Eigen::MatrixXd > jacobian_ineq, const double *multipliers_lsq_obj=nullptr, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr, bool active_ineq=false, double active_ineq_weight=1.0) |
Compute the objective and constraint Jacobians at once. More... | |
virtual void | computeSparseJacobiansNNZ (int &nnz_lsq_obj, int &nnz_eq, int &nnz_ineq) |
virtual void | computeSparseJacobiansStructure (Eigen::Ref< Eigen::VectorXi > i_row_obj, Eigen::Ref< Eigen::VectorXi > j_col_obj, Eigen::Ref< Eigen::VectorXi > i_row_eq, Eigen::Ref< Eigen::VectorXi > j_col_eq, Eigen::Ref< Eigen::VectorXi > i_row_ineq, Eigen::Ref< Eigen::VectorXi > j_col_ineq) |
virtual void | computeSparseJacobiansValues (Eigen::Ref< Eigen::VectorXd > values_obj, Eigen::Ref< Eigen::VectorXd > values_eq, Eigen::Ref< Eigen::VectorXd > values_ineq, const double *multipliers_obj=nullptr, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr, bool active_ineq=false, double active_ineq_weight=1.0) |
virtual void | computeSparseJacobians (Eigen::SparseMatrix< double > &jacobian_lsq_obj, Eigen::SparseMatrix< double > &jacobian_eq, Eigen::SparseMatrix< double > &jacobian_ineq, const double *multipliers_lsq_obj=nullptr, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr, bool active_ineq=false, double active_ineq_weight=1.0) |
virtual void | computeCombinedSparseJacobian (Eigen::SparseMatrix< double > &jacobian, bool objective_lsq, bool equality, bool inequality, bool finite_combined_bounds, bool active_ineq=false, double weight_eq=1.0, double weight_ineq=1.0, double weight_bounds=1.0, const Eigen::VectorXd *values=nullptr, const Eigen::VectorXi *col_nnz=nullptr) |
virtual int | computeCombinedSparseJacobiansNNZ (bool objective_lsq=true, bool equality=true, bool inequality=true) |
virtual void | computeCombinedSparseJacobiansStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col, bool objective_lsq=true, bool equality=true, bool inequality=true) |
virtual void | computeCombinedSparseJacobiansValues (Eigen::Ref< Eigen::VectorXd > values, bool objective_lsq=true, bool equality=true, bool inequality=true, const double *multipliers_obj=nullptr, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr) |
virtual void | computeGradientObjectiveAndCombinedSparseJacobiansValues (Eigen::Ref< Eigen::VectorXd > gradient, Eigen::Ref< Eigen::VectorXd > jac_values, bool equality=true, bool inequality=true, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr) |
virtual void | computeDenseHessianObjective (const Eigen::Ref< const Eigen::MatrixXd > &jacobian, Eigen::Ref< Eigen::MatrixXd > hessian, const double *multipliers=nullptr, bool jacob_scaled=true) |
Compute the objective Hessian Hf(x) for the current parameter set. More... | |
virtual void | computeDenseHessianObjective (Eigen::Ref< Eigen::MatrixXd > hessian, double multiplier=1.0) |
virtual int | computeSparseHessianObjectiveNNZ (bool lower_part_only=false) |
virtual void | computeSparseHessianObjectiveStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col, bool lower_part_only=false) |
virtual void | computeSparseHessianObjectiveValues (Eigen::Ref< Eigen::VectorXd > values, double multiplier=1.0, bool lower_part_only=false) |
virtual void | computeSparseHessianObjective (Eigen::SparseMatrix< double > &hessian, double multiplier=1.0) |
virtual void | computeSparseHessianObjectiveLL (Eigen::SparseMatrix< double, Eigen::ColMajor, long long > &H, const Eigen::VectorXi *col_nnz=nullptr, bool upper_part_only=false) |
virtual void | computeSparseHessianObjectiveNNZperCol (Eigen::Ref< Eigen::VectorXi > col_nnz, bool upper_part_only=false) |
virtual void | computeDenseHessianEqualities (Eigen::Ref< Eigen::MatrixXd > hessian, const double *multipliers=nullptr) |
virtual int | computeSparseHessianEqualitiesNNZ (bool lower_part_only=false) |
virtual void | computeSparseHessianEqualitiesStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col, bool lower_part_only=false) |
virtual void | computeSparseHessianEqualitiesValues (Eigen::Ref< Eigen::VectorXd > values, const double *multipliers=nullptr, bool lower_part_only=false) |
virtual void | computeSparseHessianEqualities (Eigen::SparseMatrix< double > &hessian, const double *multipliers=nullptr) |
virtual void | computeDenseHessianInequalities (Eigen::Ref< Eigen::MatrixXd > hessian, const double *multipliers=nullptr) |
virtual int | computeSparseHessianInequalitiesNNZ (bool lower_part_only=false) |
virtual void | computeSparseHessianInequalitiesStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col, bool lower_part_only=false) |
virtual void | computeSparseHessianInequalitiesValues (Eigen::Ref< Eigen::VectorXd > values, const double *multipliers=nullptr, bool lower_part_only=false) |
virtual void | computeSparseHessianInequalities (Eigen::SparseMatrix< double > &hessian, const double *multipliers=nullptr) |
virtual void | computeDenseHessians (Eigen::Ref< Eigen::MatrixXd > hessian_obj, Eigen::Ref< Eigen::MatrixXd > hessian_eq, Eigen::Ref< Eigen::MatrixXd > hessian_ineq, double multiplier_obj=1.0, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr) |
virtual void | computeSparseHessians (Eigen::SparseMatrix< double > &hessian_obj, Eigen::SparseMatrix< double > &hessian_eq, Eigen::SparseMatrix< double > &hessian_ineq, double multiplier_obj=1.0, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr) |
virtual void | computeSparseHessiansNNZ (int &nnz_obj, int &nnz_eq, int &nnz_ineq, bool lower_part_only=false) |
virtual void | computeSparseHessiansStructure (Eigen::Ref< Eigen::VectorXi > i_row_obj, Eigen::Ref< Eigen::VectorXi > j_col_obj, Eigen::Ref< Eigen::VectorXi > i_row_eq, Eigen::Ref< Eigen::VectorXi > j_col_eq, Eigen::Ref< Eigen::VectorXi > i_row_ineq, Eigen::Ref< Eigen::VectorXi > j_col_ineq, bool lower_part_only=false) |
virtual void | computeSparseHessiansValues (Eigen::Ref< Eigen::VectorXd > values_obj, Eigen::Ref< Eigen::VectorXd > values_eq, Eigen::Ref< Eigen::VectorXd > values_ineq, double multiplier_obj=1.0, const double *multipliers_eq=nullptr, const double *multipliers_ineq=nullptr, bool lower_part_only=false) |
virtual void | computeSparseHessianLagrangian (Eigen::SparseMatrix< double, Eigen::ColMajor, long long > &H, const double *multipliers_eq, const double *multipliers_ineq, const Eigen::VectorXi *col_nnz=nullptr, bool upper_part_only=false) |
Compute the hessian of the lagrangian L(x) = f(x) + lambda1 * c(x) + lambda2 * ceq(x) More... | |
virtual void | computeSparseHessianLagrangianNNZperCol (Eigen::Ref< Eigen::VectorXi > col_nnz, bool upper_part_only) |
Methods specialized for QP forms | |
bool | _warn_if_not_specialized = true |
virtual void | computeSparseJacobianTwoSideBoundedLinearForm (Eigen::SparseMatrix< double, Eigen::ColMajor, long long > &A, bool include_finite_bounds, const Eigen::VectorXi *col_nnz=nullptr) |
Compute the jacobian A for the linear form lbA <= A x <= lbB. More... | |
virtual void | computeSparseJacobianTwoSideBoundedLinearFormNNZPerColumn (Eigen::Ref< Eigen::VectorXi > col_nnz, bool include_finite_bounds) |
virtual int | computeSparseJacobianTwoSideBoundedLinearFormNNZ (bool include_finite_bounds) |
virtual void | computeSparseJacobianTwoSideBoundedLinearFormStructure (Eigen::Ref< Eigen::VectorXi > i_row, Eigen::Ref< Eigen::VectorXi > j_col, bool include_finite_bounds) |
virtual void | computeSparseJacobianTwoSideBoundedLinearFormValues (Eigen::Ref< Eigen::VectorXd > values, bool include_finite_bounds) |
virtual void | computeSparseJacobianTwoSideBoundedLinearFormAndHessianLagrangian (Eigen::SparseMatrix< double, Eigen::ColMajor, long long > &H, const double *multipliers_eq, const double *multipliers_ineq, Eigen::SparseMatrix< double, Eigen::ColMajor, long long > &A, bool include_finite_bounds, const Eigen::VectorXi *col_nnz_H=nullptr, const Eigen::VectorXi *col_nnz_A=nullptr, bool upper_part_only_H=false) |
Compute the Jacobian and Hessian of the lagrangian. More... | |
virtual void | computeBoundsForTwoSideBoundedLinearForm (Eigen::Ref< Eigen::VectorXd > lbA, Eigen::Ref< Eigen::VectorXd > ubA, bool include_finite_bounds) |
Compute lower and upper bounds lbA and ubA for the linear form lbA <= A x <= ubA. More... | |
virtual void | computeSparseJacobianTwoSideBoundedLinearFormAndHessianObjective (Eigen::SparseMatrix< double, Eigen::ColMajor, long long > &H, Eigen::SparseMatrix< double, Eigen::ColMajor, long long > &A, bool include_finite_bounds, const Eigen::VectorXi *col_nnz_H, const Eigen::VectorXi *col_nnz_A, bool upper_part_only_H) |
virtual bool | checkIfAllUnfixedParam (std::function< bool(double, int)> fun) |
Check if a function taking the parameter value and unfixed-idx is true for all unfixed parameter values. More... | |
Generic interface for optimization problem definitions.
This class can be used to generically define optimization problems with objectives, equality constraints, inequality constraints, box constraints and their current parameter state.
First order and second order derivatives can be provided but their actual usage depends on the SolverInterface back-end which solves the optimization problem. Some solvers may require the implementation of those methods.
Solvers determine a parameter increment in each of their iterations so this class provides a method applyIncrement() to modify the underlying optimization parameter set. In order to convinentially store and restore the current parameter set from the solver backend side, appropriate backup methods must be provided by subclasses.
Definition at line 92 of file optimization_problem_interface.h.
using corbo::OptimizationProblemInterface::Ptr = std::shared_ptr<OptimizationProblemInterface> |
Definition at line 117 of file optimization_problem_interface.h.
using corbo::OptimizationProblemInterface::UPtr = std::unique_ptr<OptimizationProblemInterface> |
Definition at line 118 of file optimization_problem_interface.h.
|
inlinevirtual |
Definition at line 120 of file optimization_problem_interface.h.
|
virtual |
Apply increment to the current parameter set.
Usually solvers determine a new step/increment in each iteration. This method applies the parameter update.
[in] | increment | Parameter update [parameterDimension() x 1] |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
Definition at line 78 of file optimization_problem_interface.cpp.
|
virtual |
Apply increment to the current parameter set (single element overload)
[in] | idx | Value index according vector size [parameterDimension() x 1] |
[in] | increment | Parameter update [parameterDimension() x 1] |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
Definition at line 85 of file optimization_problem_interface.cpp.
|
pure virtual |
Restore parameter set from the last backup and keep backup if desired.
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
virtual |
Check if a function taking the parameter value and unfixed-idx is true for all unfixed parameter values.
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 1689 of file optimization_problem_interface.cpp.
|
inlinevirtual |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 122 of file optimization_problem_interface.h.
|
virtual |
Compute lower and upper bounds lbA and ubA for the linear form lbA <= A x <= ubA.
Especially some QP solvers require either
lbA <= A x<= ubA
or
lbA <= A x <= ubA lb <= x <= ub
The first formulatin includes bounds and hence the bottom rows of A are the identity. However, in case lb and ub are infinity, A might have obsolete rows.
If parameter include_bounds
is true:
only finite bounds are considered and vectors lbA and ubA are of size [getEqualityDimension() + getInequalityDimension() + finiteCombinedBounds() x 1].
If parameter include_bounds
is false:
the vectors are of size [getEqualityDimension() + getInequalityDimension() x 1].
[out] | A | Combined jacobian (see description above) |
[in] | include_finite_bounds | Specify whether bounds should be included in A (check dimension of A as descirbed above) |
Definition at line 1163 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased, and corbo::HyperGraphOptimizationProblemVertexBased.
Definition at line 724 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased, and corbo::HyperGraphOptimizationProblemVertexBased.
Definition at line 835 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased, and corbo::HyperGraphOptimizationProblemVertexBased.
Definition at line 846 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased, and corbo::HyperGraphOptimizationProblemVertexBased.
Definition at line 894 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 1346 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 1423 of file optimization_problem_interface.cpp.
|
virtual |
Compute the objective Hessian Hf(x) for the current parameter set.
[in] | jacobian | Jacobian matrix which is used for the Hessian computation [objectiveDimension() x parameterDimension()] |
[out] | hessian | The resulting Hessian matrix [parameterDimension() x parameterDimension()]. Warning: The matrix must be pre-allocated, the resulting hessian is ADDED to the previous values in hessian, e.g. hessian += dense_hessian_objective. |
[in] | multipliers | Optionally provide a vector of multipliers to scale each cost function term [objectiveDimension() x 1] |
[in] | jacob_scaled | If multiplier is valid and selected, specify whether the jacobian is already scaled with multiplier . |
Definition at line 1207 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1213 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 1520 of file optimization_problem_interface.cpp.
|
virtual |
Compute the Jacobian Jc(x) with non-zeros for active constraints c(x)>= 0 and zeros for inactive ones.
[out] | jacobian | The resulting Jacobian matrix [inequalityDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[in] | weight | Optionally provide a weight factor |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 461 of file optimization_problem_interface.cpp.
|
virtual |
Compute the equality constraint Jacobian Jceq(x) for the current parameter set.
[out] | jacobian | The resulting Jacobian matrix [equalityDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[in] | multipliers | Optionally provide a vector of multipliers to scale each cost function term [equalityDimension() x 1] |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 315 of file optimization_problem_interface.cpp.
|
virtual |
Compute the Jacobian for finite combined bounds.
refer to computeDistanceFiniteCombinedBounds()
[out] | jacobian | The resulting Jacobian matrix [finiteCombinedBoundsDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[in] | weight | Optionally provide a weight factor |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 588 of file optimization_problem_interface.cpp.
|
virtual |
Compute the Jacobian for finite combined bounds.
refer to getParametersAndBoundsFinite() The resulting matrix is just the identity matrix with omitted rows for non-finite bounds.
[out] | jacobian | The resulting Jacobian matrix [finiteCombinedBoundsDimension() x parameterDimension()]. |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 704 of file optimization_problem_interface.cpp.
|
virtual |
Compute the inequality constraint Jacobian Jc(x) for the current parameter set.
[out] | jacobian | The resulting Jacobian matrix [inequalityDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[in] | multipliers | Optionally provide a vector of multipliers to scale each cost function term [inequalityDimension() x 1] |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 388 of file optimization_problem_interface.cpp.
|
virtual |
Compute the objective Jacobian Jf(x) for the current parameter set.
[out] | jacobian | The resulting Jacobian matrix [objectiveDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[in] | multipliers | Optionally provide a vector of multipliers to scale each cost function term [objectiveDimension() x 1] |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 239 of file optimization_problem_interface.cpp.
|
virtual |
Compute the objective and constraint Jacobians at once.
Use this method to speed up Jacobian computation if possible. The default implementation just calls the individual Jacobian computations.
[out] | jacobian_obj | The resulting objective Jacobian matrix [objectiveDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[out] | jacobian_eq | The resulting equality constraint Jacobian matrix [equalityDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[out] | jacobian_ineq | The resulting inequality constraint Jacobian matrix [inequalityDimension() x parameterDimension()]. Warning: the matrix must be pre-allocated with ZEROS! |
[in] | multipliers | Optionally provide a vector of multipliers to scale each cost function term [objectiveDimension() + equalityDimension() + inequalityDimension() x 1] |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 511 of file optimization_problem_interface.cpp.
|
virtual |
Compute the distance to finite bound values (combined lower and upper)
The distance is given as (lb-x) if (x<lb) and (x-ub) if (x>ub), otherwise 0.
[out] | values | The resulting value vector [finiteCombinedBoundsDimension() x 1]. Warning: the size must be pre-allocated! |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 154 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 225 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 211 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased, and corbo::HyperGraphOptimizationProblemVertexBased.
Definition at line 954 of file optimization_problem_interface.cpp.
|
virtual |
Compute the distance between parameters and bounds.
This method might be used for sqp bound computation in the form
lb-x < dx < ub-x
[out] | lb_minus_x | The resulting value vector [finiteCombinedBoundsDimension() x 1]; Warning: the size must be pre-allocated! |
[out] | ub_minus_x | The resulting value vector [finiteCombinedBoundsDimension() x 1]; Warning: the size must be pre-allocated! |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 179 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 1413 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1365 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1373 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1391 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 1490 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1442 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1450 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1468 of file optimization_problem_interface.cpp.
|
virtual |
Compute the hessian of the lagrangian L(x) = f(x) + lambda1 * c(x) + lambda2 * ceq(x)
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1587 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1654 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 1284 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1298 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1231 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1328 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1239 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1259 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 1545 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1555 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1564 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1576 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 500 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 479 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 377 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 333 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 340 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 356 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 669 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 616 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 622 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 641 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 450 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 406 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 413 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 429 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 303 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 257 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemVertexBased, and corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 264 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased, and corbo::HyperGraphOptimizationProblemVertexBased.
Definition at line 281 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 543 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 557 of file optimization_problem_interface.cpp.
|
virtual |
Definition at line 564 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 573 of file optimization_problem_interface.cpp.
|
virtual |
Compute the jacobian A for the linear form lbA <= A x <= lbB.
Especially some QP solvers require either
lbA <= A x<= ubA
or
lbA <= A x <= ubA lb <= x <= ub
The first formulatin includes bounds and hence the bottom rows of A are the identity. However, in case lb and ub are infinity, A might have obsolete rows.
If parameter include_bounds
is true:
only finite bounds are considered and matrix A is of size [getEqualityDimension() + getInequalityDimension() + finiteCombinedBounds() x parameterDimension()].
If parameter include_bounds
is false:
the size of matrix A is [getEqualityDimension() + getInequalityDimension() x parameterDimension()].
[out] | A | Combined jacobian (see description above) |
[in] | include_finite_bounds | Specify whether bounds should be included in A (check dimension of A as descirbed above) |
[in] | col_nnz | Estimate for number of nnz per column to speed up insertion |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 965 of file optimization_problem_interface.cpp.
|
virtual |
Compute the Jacobian and Hessian of the lagrangian.
This method combines computeSparseJacobianTwoSideBoundedLinearForm() and computeSparseHessianLagrangian() in order to speed up computation. Often, Hessian computations rely on first order derivatives and so we do not need to compute the Jacobian twice.
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1672 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1681 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1060 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1044 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1072 of file optimization_problem_interface.cpp.
|
virtual |
Reimplemented in corbo::HyperGraphOptimizationProblemEdgeBased.
Definition at line 1121 of file optimization_problem_interface.cpp.
|
pure virtual |
|
virtual |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 53 of file optimization_problem_interface.cpp.
|
inlinevirtual |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 296 of file optimization_problem_interface.h.
|
virtual |
Compute the values of the active inequality constraints (elementwise max(0, c(x)))
Return a vector [inequalityDimension() x 1] in which elements are set to max(0, c(x))
Weight scales the values to "weight*max(0, c(x))".
[out] | values | The resulting value vector [inequalityDimension() x 1]. Warning: the size must be pre-allocated! |
[in] | weight | Optionally provide a weight factor |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 140 of file optimization_problem_interface.cpp.
|
pure virtual |
Compute the equality constraint values ceq(x) for the current parameter set.
[out] | values | The resulting value vector [equalityDimension() x 1]. Warning: the size must be pre-allocated! |
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Compute the inequality constraint values c(x) for the current parameter set.
[out] | values | The resulting value vector [inequalityDimension() x 1]. Warning: the size must be pre-allocated! |
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Compute the objective function values f(x) for the current parameter set.
[out] | values | The resulting value vector [objectiveDimension() x 1]. Warning: the size must be pre-allocated! |
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
virtual |
Dimension of the set of finite bounds (individual bounds ub and lb)
This method retuns the total number of finite bounds, in particular: numFinite(lb) + numFinite(ub) with numFinite counting values within interval [-CORBO_INF_DBL, CORBO_INF_DBL]. If all bounds are finite, the (maximum) value is 2*parameterDimension().
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 128 of file optimization_problem_interface.cpp.
|
virtual |
Dimension of the set of finite bounds (combined such that each ub and lb component define a single dimension)
This method returns the number of parameters that exhibit either finite lower or finite upper bounds. In particular, it counts how often (is_finite(lb[i]) || is_finite(ub[i])) evaluates to true. The maximum value is parameterDimension().
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 116 of file optimization_problem_interface.cpp.
|
virtual |
Get lower and upper bound vector.
[out] | lb | Lower bounds [parameterDimension() x 1] (must be pre-allocated!) |
[out] | ub | Upper bounds [parameterDimension() x 1] (must be pre-allocated!) |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
Definition at line 103 of file optimization_problem_interface.cpp.
|
pure virtual |
Total dimension of equality constraints.
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Total dimension of general inequality constraints.
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Return specific lower bound value of a parameter.
[in] | idx | Value index according vector size [parameterDimension() x 1] |
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
pure virtual |
Total dimension of least-squares objective function terms.
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Get dimension of the objective (should be zero or one)
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Get dimension of the objective (should be zero or one, includes Lsq objectives if present)
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Effictive dimension of the optimization parameter set (changeable, non-fixed part)
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
virtual |
Return bound and parameter vectors only for finite boudns.
The values are returned if lb < inf or ub < inf. The Dimension of each vector is finiteCombinedBoundsDimension().
[out] | lb_finite_bounds | Lower bounds [finiteCombinedBoundsDimension() x 1], Warning: the size must be pre-allocated! |
[out] | ub_finite_bounds | Upper bounds [finiteCombinedBoundsDimension() x 1], Warning: the size must be pre-allocated! |
[out] | x_finite_bounds | related parameters [finiteCombinedBoundsDimension() x 1], Warning: the size must be pre-allocated! |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem.
Definition at line 188 of file optimization_problem_interface.cpp.
|
pure virtual |
Return specific value of the parameter vector.
[in] | idx | Value index according vector size [parameterDimension() x 1] |
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
virtual |
Return deep copy of the complete parameter vector.
[out] | x | Current parameter vector of size [parameterDimension() x 1] (must be pre-allocated!) |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
Definition at line 65 of file optimization_problem_interface.cpp.
|
pure virtual |
Return specific upper bound of a parameter.
[in] | idx | Value index according vector size [parameterDimension() x 1] |
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
pure virtual |
Check if the underlying problem is defined in the least squares form.
Least-squares problems are defined as and the function values and Jacobian are computed for
rather than for
. Specialiezed least-squares solvers require the optimization problem to be defined in this particular form.
In summary, the solver computes the squared l2-norm of the objective function value (scalar) if set to true.
Implemented in corbo::SimpleOptimizationProblem, corbo::SimpleOptimizationProblemWithCallbacks, and corbo::BaseHyperGraphOptimizationProblem.
|
pure virtual |
Discard last backup (or all)
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
virtual |
Set lower and upper bound vector.
[in] | lb | Lower bounds [parameterDimension() x 1] |
[in] | ub | Upper bounds [parameterDimension() x 1] |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
Definition at line 91 of file optimization_problem_interface.cpp.
|
pure virtual |
Set specific lower bound of a parameter.
[in] | idx | Value index according vector size [parameterDimension() x 1] |
[in] | lb | New lower bound to be set |
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
pure virtual |
Set specific value of the parameter vector.
[in] | idx | Value index according vector size [parameterDimension() x 1] |
[in] | x | New value to be set |
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
virtual |
Set complete parameter vector.
[in] | x | New parameter vector of size [parameterDimension() x 1] Push the current parameter set to some backup stack |
Reimplemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
Definition at line 72 of file optimization_problem_interface.cpp.
|
pure virtual |
Set specific upper bound of a parameter.
[in] | idx | Value index according vector size [parameterDimension() x 1] |
[in] | ub | New upper bound to be set |
Implemented in corbo::BaseHyperGraphOptimizationProblem, and corbo::SimpleOptimizationProblem.
|
protected |
Definition at line 672 of file optimization_problem_interface.h.