Changes in progress
parent
fdc4cc586d
commit
5f94e477a4
|
@ -22,6 +22,44 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
/** Parameters for Levenberg-Marquardt optimization. Note that this parameters
|
||||||
|
* class inherits from NonlinearOptimizerParams, which specifies the parameters
|
||||||
|
* common to all nonlinear optimization algorithms. This class also contains
|
||||||
|
* all of those parameters.
|
||||||
|
*/
|
||||||
|
class DoglegParams : public SuccessiveLinearizationParams {
|
||||||
|
public:
|
||||||
|
/** See DoglegParams::dlVerbosity */
|
||||||
|
enum DLVerbosity {
|
||||||
|
SILENT,
|
||||||
|
VERBOSE
|
||||||
|
};
|
||||||
|
|
||||||
|
double deltaInitial; ///< The initial trust region radius (default: 1.0)
|
||||||
|
DLVerbosity dlVerbosity; ///< The verbosity level for Dogleg (default: SILENT), see also NonlinearOptimizerParams::verbosity
|
||||||
|
|
||||||
|
DoglegParams() :
|
||||||
|
deltaInitial(1.0), dlVerbosity(SILENT) {}
|
||||||
|
|
||||||
|
virtual ~DoglegParams() {}
|
||||||
|
|
||||||
|
virtual void print(const std::string& str = "") const {
|
||||||
|
SuccessiveLinearizationParams::print(str);
|
||||||
|
std::cout << " deltaInitial: " << deltaInitial << "\n";
|
||||||
|
std::cout.flush();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State for DoglegOptimizer
|
||||||
|
*/
|
||||||
|
class DoglegState : public SuccessiveLinearizationState {
|
||||||
|
public:
|
||||||
|
|
||||||
|
double delta;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class performs Dogleg nonlinear optimization
|
* This class performs Dogleg nonlinear optimization
|
||||||
*/
|
*/
|
||||||
|
@ -98,42 +136,4 @@ protected:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Parameters for Levenberg-Marquardt optimization. Note that this parameters
|
|
||||||
* class inherits from NonlinearOptimizerParams, which specifies the parameters
|
|
||||||
* common to all nonlinear optimization algorithms. This class also contains
|
|
||||||
* all of those parameters.
|
|
||||||
*/
|
|
||||||
class DoglegParams : public SuccessiveLinearizationParams {
|
|
||||||
public:
|
|
||||||
/** See DoglegParams::dlVerbosity */
|
|
||||||
enum DLVerbosity {
|
|
||||||
SILENT,
|
|
||||||
VERBOSE
|
|
||||||
};
|
|
||||||
|
|
||||||
double deltaInitial; ///< The initial trust region radius (default: 1.0)
|
|
||||||
DLVerbosity dlVerbosity; ///< The verbosity level for Dogleg (default: SILENT), see also NonlinearOptimizerParams::verbosity
|
|
||||||
|
|
||||||
DoglegParams() :
|
|
||||||
deltaInitial(1.0), dlVerbosity(SILENT) {}
|
|
||||||
|
|
||||||
virtual ~DoglegParams() {}
|
|
||||||
|
|
||||||
virtual void print(const std::string& str = "") const {
|
|
||||||
SuccessiveLinearizationParams::print(str);
|
|
||||||
std::cout << " deltaInitial: " << deltaInitial << "\n";
|
|
||||||
std::cout.flush();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* State for DoglegOptimizer
|
|
||||||
*/
|
|
||||||
class DoglegState : public SuccessiveLinearizationState {
|
|
||||||
public:
|
|
||||||
|
|
||||||
double delta;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,12 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
/** Parameters for Gauss-Newton optimization, inherits from
|
||||||
|
* NonlinearOptimizationParams.
|
||||||
|
*/
|
||||||
|
class GaussNewtonParams : public SuccessiveLinearizationParams {
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class performs Gauss-Newton nonlinear optimization
|
* This class performs Gauss-Newton nonlinear optimization
|
||||||
*/
|
*/
|
||||||
|
@ -98,10 +104,4 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Parameters for Gauss-Newton optimization, inherits from
|
|
||||||
* NonlinearOptimizationParams.
|
|
||||||
*/
|
|
||||||
class GaussNewtonParams : public SuccessiveLinearizationParams {
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,52 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
/** Parameters for Levenberg-Marquardt optimization. Note that this parameters
|
||||||
|
* class inherits from NonlinearOptimizerParams, which specifies the parameters
|
||||||
|
* common to all nonlinear optimization algorithms. This class also contains
|
||||||
|
* all of those parameters.
|
||||||
|
*/
|
||||||
|
class LevenbergMarquardtParams : public SuccessiveLinearizationParams {
|
||||||
|
public:
|
||||||
|
/** See LevenbergMarquardtParams::lmVerbosity */
|
||||||
|
enum LMVerbosity {
|
||||||
|
SILENT,
|
||||||
|
LAMBDA,
|
||||||
|
TRYLAMBDA,
|
||||||
|
TRYCONFIG,
|
||||||
|
TRYDELTA,
|
||||||
|
DAMPED
|
||||||
|
};
|
||||||
|
|
||||||
|
double lambdaInitial; ///< The initial Levenberg-Marquardt damping term (default: 1e-5)
|
||||||
|
double lambdaFactor; ///< The amount by which to multiply or divide lambda when adjusting lambda (default: 10.0)
|
||||||
|
double lambdaUpperBound; ///< The maximum lambda to try before assuming the optimization has failed (default: 1e5)
|
||||||
|
LMVerbosity lmVerbosity; ///< The verbosity level for Levenberg-Marquardt (default: SILENT), see also NonlinearOptimizerParams::verbosity
|
||||||
|
|
||||||
|
LevenbergMarquardtParams() :
|
||||||
|
lambdaInitial(1e-5), lambdaFactor(10.0), lambdaUpperBound(1e5), lmVerbosity(SILENT) {}
|
||||||
|
|
||||||
|
virtual ~LevenbergMarquardtParams() {}
|
||||||
|
|
||||||
|
virtual void print(const std::string& str = "") const {
|
||||||
|
SuccessiveLinearizationParams::print(str);
|
||||||
|
std::cout << " lambdaInitial: " << lambdaInitial << "\n";
|
||||||
|
std::cout << " lambdaFactor: " << lambdaFactor << "\n";
|
||||||
|
std::cout << " lambdaUpperBound: " << lambdaUpperBound << "\n";
|
||||||
|
std::cout.flush();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State for LevenbergMarquardtOptimizer
|
||||||
|
*/
|
||||||
|
class LevenbergMarquardtState : public NonlinearOptimizerState {
|
||||||
|
public:
|
||||||
|
|
||||||
|
double lambda;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class performs Levenberg-Marquardt nonlinear optimization
|
* This class performs Levenberg-Marquardt nonlinear optimization
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +90,8 @@ public:
|
||||||
*/
|
*/
|
||||||
LevenbergMarquardtOptimizer(const NonlinearFactorGraph& graph, const Values& initialValues,
|
LevenbergMarquardtOptimizer(const NonlinearFactorGraph& graph, const Values& initialValues,
|
||||||
const LevenbergMarquardtParams& params = LevenbergMarquardtParams()) :
|
const LevenbergMarquardtParams& params = LevenbergMarquardtParams()) :
|
||||||
NonlinearOptimizer(graph), params_(ensureHasOrdering(params)), state_(graph, initialValues), dimensions_(initialValues.dims(*params_.ordering)) {}
|
NonlinearOptimizer(graph), params_(ensureHasOrdering(params)),
|
||||||
|
state_(graph, initialValues), dimensions_(initialValues.dims(*params_.ordering)) {}
|
||||||
|
|
||||||
/** Standard constructor, requires a nonlinear factor graph, initial
|
/** Standard constructor, requires a nonlinear factor graph, initial
|
||||||
* variable assignments, and optimization parameters. For convenience this
|
* variable assignments, and optimization parameters. For convenience this
|
||||||
|
@ -100,50 +147,4 @@ protected:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Parameters for Levenberg-Marquardt optimization. Note that this parameters
|
|
||||||
* class inherits from NonlinearOptimizerParams, which specifies the parameters
|
|
||||||
* common to all nonlinear optimization algorithms. This class also contains
|
|
||||||
* all of those parameters.
|
|
||||||
*/
|
|
||||||
class LevenbergMarquardtParams : public SuccessiveLinearizationParams {
|
|
||||||
public:
|
|
||||||
/** See LevenbergMarquardtParams::lmVerbosity */
|
|
||||||
enum LMVerbosity {
|
|
||||||
SILENT,
|
|
||||||
LAMBDA,
|
|
||||||
TRYLAMBDA,
|
|
||||||
TRYCONFIG,
|
|
||||||
TRYDELTA,
|
|
||||||
DAMPED
|
|
||||||
};
|
|
||||||
|
|
||||||
double lambdaInitial; ///< The initial Levenberg-Marquardt damping term (default: 1e-5)
|
|
||||||
double lambdaFactor; ///< The amount by which to multiply or divide lambda when adjusting lambda (default: 10.0)
|
|
||||||
double lambdaUpperBound; ///< The maximum lambda to try before assuming the optimization has failed (default: 1e5)
|
|
||||||
LMVerbosity lmVerbosity; ///< The verbosity level for Levenberg-Marquardt (default: SILENT), see also NonlinearOptimizerParams::verbosity
|
|
||||||
|
|
||||||
LevenbergMarquardtParams() :
|
|
||||||
lambdaInitial(1e-5), lambdaFactor(10.0), lambdaUpperBound(1e5), lmVerbosity(SILENT) {}
|
|
||||||
|
|
||||||
virtual ~LevenbergMarquardtParams() {}
|
|
||||||
|
|
||||||
virtual void print(const std::string& str = "") const {
|
|
||||||
SuccessiveLinearizationParams::print(str);
|
|
||||||
std::cout << " lambdaInitial: " << lambdaInitial << "\n";
|
|
||||||
std::cout << " lambdaFactor: " << lambdaFactor << "\n";
|
|
||||||
std::cout << " lambdaUpperBound: " << lambdaUpperBound << "\n";
|
|
||||||
std::cout.flush();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* State for LevenbergMarquardtOptimizer
|
|
||||||
*/
|
|
||||||
class LevenbergMarquardtState : public NonlinearOptimizerState {
|
|
||||||
public:
|
|
||||||
|
|
||||||
double lambda;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue