Skip to content
Snippets Groups Projects

Resolve "SolverCeres stop solving if can update"

Merged Joan Vallvé Navarro requested to merge 354-solverceres-stop-solving-if-can-update into devel
7 files
+ 72
15
Compare changes
  • Side-by-side
  • Inline
Files
7
/*
* iteration_callback.h
*
* Created on: Jun 15, 2020
* Author: joanvallve
*/
#ifndef INCLUDE_CORE_CERES_WRAPPER_ITERATION_UPDATE_CALLBACK_H_
#define INCLUDE_CORE_CERES_WRAPPER_ITERATION_UPDATE_CALLBACK_H_
#include "core/problem/problem.h"
#include "ceres/ceres.h"
namespace wolf {
class IterationUpdateCallback : public ceres::IterationCallback
{
public:
explicit IterationUpdateCallback(ProblemPtr _problem)
: problem_(_problem) {}
~IterationUpdateCallback() {}
ceres::CallbackReturnType operator()(const ceres::IterationSummary& summary) override
{
if (problem_->getStateBlockNotificationMapSize() != 0 or
problem_->getFactorNotificationMapSize() != 0)
{
WOLF_INFO("Stopping solver to update the problem!");
return ceres::SOLVER_TERMINATE_SUCCESSFULLY;
}
return ceres::SOLVER_CONTINUE;
}
private:
ProblemPtr problem_;
};
}
#endif /* INCLUDE_CORE_CERES_WRAPPER_ITERATION_UPDATE_CALLBACK_H_ */
Loading