Wrapped per-variable thresholds for iSAM2

release/4.3a0
Stephen Williams 2012-07-30 21:19:24 +00:00
parent 305ab998fc
commit fd4f11d21e
2 changed files with 28 additions and 2 deletions

23
gtsam.h
View File

@ -1247,6 +1247,26 @@ class ISAM2DoglegParams {
void setVerbose(bool verbose);
};
class ISAM2ThresholdMapValue {
ISAM2ThresholdMapValue(char c, Vector thresholds);
ISAM2ThresholdMapValue(const gtsam::ISAM2ThresholdMapValue& other);
};
class ISAM2ThresholdMap {
ISAM2ThresholdMap();
ISAM2ThresholdMap(const gtsam::ISAM2ThresholdMap& other);
// Note: no print function
// common STL methods
size_t size() const;
bool empty() const;
void clear();
// structure specific methods
void insert(const gtsam::ISAM2ThresholdMapValue& value) const;
};
class ISAM2Params {
ISAM2Params();
@ -1256,8 +1276,7 @@ class ISAM2Params {
void setOptimizationParams(const gtsam::ISAM2GaussNewtonParams& params);
void setOptimizationParams(const gtsam::ISAM2DoglegParams& params);
void setRelinearizeThreshold(double relinearizeThreshold);
// TODO: wrap this
//void setRelinearizeThreshold(const FastMap<char,Vector>& relinearizeThreshold);
void setRelinearizeThreshold(const gtsam::ISAM2ThresholdMap& relinearizeThreshold);
int getRelinearizeSkip() const;
void setRelinearizeSkip(int relinearizeSkip);
bool isEnableRelinearization() const;

View File

@ -98,6 +98,8 @@ struct ISAM2DoglegParams {
* @addtogroup ISAM2
* Parameters for the ISAM2 algorithm. Default parameter values are listed below.
*/
typedef FastMap<char,Vector> ISAM2ThresholdMap;
typedef ISAM2ThresholdMap::value_type ISAM2ThresholdMapValue;
struct ISAM2Params {
typedef boost::variant<ISAM2GaussNewtonParams, ISAM2DoglegParams> OptimizationParams; ///< Either ISAM2GaussNewtonParams or ISAM2DoglegParams
typedef boost::variant<double, FastMap<char,Vector> > RelinearizationThreshold; ///< Either a constant relinearization threshold or a per-variable-type set of thresholds
@ -189,7 +191,12 @@ struct ISAM2Params {
if(relinearizeThreshold.type() == typeid(double))
std::cout << "relinearizeThreshold: " << boost::get<double>(relinearizeThreshold) << "\n";
else
{
std::cout << "relinearizeThreshold: " << "{mapped}" << "\n";
BOOST_FOREACH(const ISAM2ThresholdMapValue& value, boost::get<ISAM2ThresholdMap>(relinearizeThreshold)) {
std::cout << " '" << value.first << "' -> [" << value.second.transpose() << " ]\n";
}
}
std::cout << "relinearizeSkip: " << relinearizeSkip << "\n";
std::cout << "enableRelinearization: " << enableRelinearization << "\n";
std::cout << "evaluateNonlinearError: " << evaluateNonlinearError << "\n";