improved equals method for NonlinearOptimizerParams

release/4.3a0
Varun Agrawal 2023-10-23 18:24:41 -04:00
parent cb226633c5
commit 48b270efc5
1 changed files with 16 additions and 8 deletions

View File

@ -115,14 +115,22 @@ public:
virtual void print(const std::string& str = "") const; virtual void print(const std::string& str = "") const;
bool equals(const NonlinearOptimizerParams& other, double tol = 1e-9) const { bool equals(const NonlinearOptimizerParams& other, double tol = 1e-9) const {
return maxIterations == other.getMaxIterations() // Check for equality of shared ptrs
&& std::abs(relativeErrorTol - other.getRelativeErrorTol()) <= tol bool iterative_params_equal = false;
&& std::abs(absoluteErrorTol - other.getAbsoluteErrorTol()) <= tol if (iterativeParams == other.iterativeParams) {
&& std::abs(errorTol - other.getErrorTol()) <= tol iterative_params_equal = true;
&& verbosityTranslator(verbosity) == other.getVerbosity(); }
// && orderingType.equals(other.getOrderingType()_; if (iterativeParams && other.iterativeParams) {
// && linearSolverType == other.getLinearSolverType(); iterative_params_equal = iterativeParams->equals(*other.iterativeParams);
// TODO: check ordering, iterativeParams, and iterationsHook }
return maxIterations == other.getMaxIterations() &&
std::abs(relativeErrorTol - other.getRelativeErrorTol()) <= tol &&
std::abs(absoluteErrorTol - other.getAbsoluteErrorTol()) <= tol &&
std::abs(errorTol - other.getErrorTol()) <= tol &&
verbosityTranslator(verbosity) == other.getVerbosity() &&
orderingType == other.orderingType && ordering == other.ordering &&
linearSolverType == other.linearSolverType && iterative_params_equal;
} }
inline bool isMultifrontal() const { inline bool isMultifrontal() const {