compute actual cost difference for deciding if LM step was successful; this will be compared to model cost change
| 156 | // compute actual cost difference for deciding if LM step was successful; this |
| 157 | // will be compared to model cost change |
| 158 | double compute_cost_decrease( |
| 159 | const ResidualInfo& ri_before, const ResidualInfo& ri_after, |
| 160 | const SolverOptions::OptimizedCost& optimized_cost) { |
| 161 | switch (optimized_cost) { |
| 162 | case SolverOptions::OptimizedCost::ERROR: |
| 163 | return ri_before.all.error - ri_after.all.error; |
| 164 | case SolverOptions::OptimizedCost::ERROR_VALID: |
| 165 | return ri_before.valid.error - ri_after.valid.error; |
| 166 | case SolverOptions::OptimizedCost::ERROR_VALID_AVG: |
| 167 | return ri_before.valid.error_avg() - ri_after.valid.error_avg(); |
| 168 | default: |
| 169 | LOG(FATAL) << "unreachable"; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | // check termination based on change in cost value |
| 174 | bool function_tolerance_reached(const IterationSummary& it, |
no test coverage detected