mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Add Problem::SetParameterLowerBound and Problem::SetParameterUpperBound.
These two methods allow the user to associate upper and lower bounds with individual parameters inside parameter blocks. Change-Id: I68dc37f20b64408da510ba06b89a4f08df54ddad
This commit is contained in:
@@ -300,7 +300,7 @@ class Problem {
|
||||
// Hold the indicated parameter block constant during optimization.
|
||||
void SetParameterBlockConstant(double* values);
|
||||
|
||||
// Allow the indicated parameter to vary during optimization.
|
||||
// Allow the indicated parameter block to vary during optimization.
|
||||
void SetParameterBlockVariable(double* values);
|
||||
|
||||
// Set the local parameterization for one of the parameter blocks.
|
||||
@@ -317,6 +317,10 @@ class Problem {
|
||||
// associated then NULL is returned.
|
||||
const LocalParameterization* GetParameterization(double* values) const;
|
||||
|
||||
// Set the lower/upper bound for the parameter with position "index".
|
||||
void SetParameterLowerBound(double* values, int index, double lower_bound);
|
||||
void SetParameterUpperBound(double* values, int index, double upper_bound);
|
||||
|
||||
// Number of parameter blocks in the problem. Always equals
|
||||
// parameter_blocks().size() and parameter_block_sizes().size().
|
||||
int NumParameterBlocks() const;
|
||||
|
||||
@@ -183,6 +183,18 @@ const LocalParameterization* Problem::GetParameterization(
|
||||
return problem_impl_->GetParameterization(values);
|
||||
}
|
||||
|
||||
void Problem::SetParameterLowerBound(double* values,
|
||||
int index,
|
||||
double lower_bound) {
|
||||
problem_impl_->SetParameterLowerBound(values, index, lower_bound);
|
||||
}
|
||||
|
||||
void Problem::SetParameterUpperBound(double* values,
|
||||
int index,
|
||||
double upper_bound) {
|
||||
problem_impl_->SetParameterUpperBound(values, index, upper_bound);
|
||||
}
|
||||
|
||||
bool Problem::Evaluate(const EvaluateOptions& evaluate_options,
|
||||
double* cost,
|
||||
vector<double>* residuals,
|
||||
|
||||
@@ -541,6 +541,20 @@ const LocalParameterization* ProblemImpl::GetParameterization(
|
||||
->local_parameterization();
|
||||
}
|
||||
|
||||
void ProblemImpl::SetParameterLowerBound(double* values,
|
||||
int index,
|
||||
double lower_bound) {
|
||||
FindParameterBlockOrDie(parameter_block_map_, values)
|
||||
->SetLowerBound(index, lower_bound);
|
||||
}
|
||||
|
||||
void ProblemImpl::SetParameterUpperBound(double* values,
|
||||
int index,
|
||||
double upper_bound) {
|
||||
FindParameterBlockOrDie(parameter_block_map_, values)
|
||||
->SetUpperBound(index, upper_bound);
|
||||
}
|
||||
|
||||
bool ProblemImpl::Evaluate(const Problem::EvaluateOptions& evaluate_options,
|
||||
double* cost,
|
||||
vector<double>* residuals,
|
||||
|
||||
@@ -129,6 +129,9 @@ class ProblemImpl {
|
||||
LocalParameterization* local_parameterization);
|
||||
const LocalParameterization* GetParameterization(double* values) const;
|
||||
|
||||
void SetParameterLowerBound(double* values, int index, double lower_bound);
|
||||
void SetParameterUpperBound(double* values, int index, double upper_bound);
|
||||
|
||||
bool Evaluate(const Problem::EvaluateOptions& options,
|
||||
double* cost,
|
||||
vector<double>* residuals,
|
||||
|
||||
Reference in New Issue
Block a user