Moved logging to start of iteration.
parent
302880fbe3
commit
a1d78150ad
|
|
@ -78,18 +78,6 @@ GaussianFactorGraph::shared_ptr LevenbergMarquardtOptimizer::linearize() const {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void LevenbergMarquardtOptimizer::iterate() {
|
void LevenbergMarquardtOptimizer::iterate() {
|
||||||
|
|
||||||
// Log current error/lambda to file
|
|
||||||
if (!params_.logFile.empty()) {
|
|
||||||
ofstream os(params_.logFile.c_str(), ios::app);
|
|
||||||
|
|
||||||
timeval rawtime;
|
|
||||||
gettimeofday(&rawtime, NULL);
|
|
||||||
double currentTime = rawtime.tv_sec + rawtime.tv_usec / 1000000.0;
|
|
||||||
|
|
||||||
os << state_.iterations << "," << currentTime-state_.startTime << ","
|
|
||||||
<< state_.error << "," << state_.lambda << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
gttic (LM_iterate);
|
gttic (LM_iterate);
|
||||||
|
|
||||||
// Linearize graph
|
// Linearize graph
|
||||||
|
|
@ -126,6 +114,18 @@ void LevenbergMarquardtOptimizer::iterate() {
|
||||||
|
|
||||||
// Try solving
|
// Try solving
|
||||||
try {
|
try {
|
||||||
|
// Log current error/lambda to file
|
||||||
|
if (!params_.logFile.empty()) {
|
||||||
|
ofstream os(params_.logFile.c_str(), ios::app);
|
||||||
|
|
||||||
|
timeval rawtime;
|
||||||
|
gettimeofday(&rawtime, NULL);
|
||||||
|
double currentTime = rawtime.tv_sec + rawtime.tv_usec / 1000000.0;
|
||||||
|
|
||||||
|
os << state_.iterations << "," << currentTime - state_.startTime << ","
|
||||||
|
<< state_.error << "," << state_.lambda << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Solve Damped Gaussian Factor Graph
|
// Solve Damped Gaussian Factor Graph
|
||||||
const VectorValues delta = solve(dampedSystem, state_.values, params_);
|
const VectorValues delta = solve(dampedSystem, state_.values, params_);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue