LCOV - code coverage report
Current view: top level - elsa/line_search - LineSearchMethod.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 1 1 100.0 %
Date: 2024-12-21 07:37:52 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <optional>
       4             : 
       5             : #include "elsaDefines.h"
       6             : #include "DataContainer.h"
       7             : #include "Cloneable.h"
       8             : #include "Functional.h"
       9             : #include <cstdint>
      10             : 
      11             : namespace elsa
      12             : {
      13             :     /**
      14             :      * @brief Base class representing a line search method for an optimization problem.
      15             :      *
      16             :      * @author
      17             :      * - Said Alghabra - initial code
      18             :      *
      19             :      * @tparam data_t data type for the domain and range of the problem, defaulting to real_t
      20             :      *
      21             :      */
      22             :     template <typename data_t = real_t>
      23             :     class LineSearchMethod : public Cloneable<LineSearchMethod<data_t>>
      24             :     {
      25             :     public:
      26             :         LineSearchMethod(const Functional<data_t>& problem, index_t max_iterations = 10);
      27             :         /// default destructor
      28         164 :         ~LineSearchMethod() override = default;
      29             : 
      30             :         /**
      31             :          * @brief Solve the line search problem (most likely iteratively)
      32             :          *
      33             :          * @param[in] iterations number of iterations to execute
      34             :          * @param[in] x0 optional initial solution, initial solution set to zero if not present
      35             :          *
      36             :          * @returns the current solution (after solving)
      37             :          */
      38             :         virtual data_t solve(DataContainer<data_t> xi, DataContainer<data_t> di) = 0;
      39             : 
      40             :         /// actual comparison method, abstract to force override in derived classes
      41             :         virtual bool isEqual(const LineSearchMethod<data_t>& other) const override = 0;
      42             : 
      43             :     protected:
      44             :         // the differentiable optimizaion problem
      45             :         std::unique_ptr<Functional<data_t>> _problem;
      46             : 
      47             :         // max number of iterations execute by the line search method
      48             :         index_t _max_iterations;
      49             :     };
      50             : } // namespace elsa

Generated by: LCOV version 1.14