Skip to content

Latest commit

 

History

History
145 lines (85 loc) · 2.7 KB

README.md

File metadata and controls

145 lines (85 loc) · 2.7 KB

Solvers

The project implements few solvers to solve equations of the form

f(x, L) = s

where

s = vector of observations (signal)

L = matrix of fixed coeffients (library)

x = vector of unknown coefficients that needs to be solved (weights)

Implemented solvers

LS solvers

Assumes that f is linear (xL = s). Solves x using using least squares method.

GD solvers

Solves f(x,L) = s using Gradient descent as optimization method. Function f is given by user.

GN solvers

Solves f(x,L) = s using Gauss-Newton as optimization method. Function f is given by user.

EA solvers

Solves f(x,L) = s using evolutionary algorithm as optimization method. Function f is given by user.

NN solvers

Solves f(x,L) = s by constraining fit so that all x values are non-negative.

Robust solvers

Solves f(x,L) = s using robust fit that can handle considerable amount of outliers.

Dependencies

Required

  • armadillo
  • boost

Optional

  • Python 2.7 + matplotlib (plotting)
  • doxygen (document generation)

Installation

To install all dependencies, run

$ ./scripts/install_libraries.sh

Build

Release version:

$ ./scripts/make_build.sh

Debug version:

$ ./scripts/make_build.sh -d

Testing

In build/tests directory run

$ ctest --verbose

Document generation

To generate documentation you need to have doxygen installed. In docs folder run

doxygen doxygen-config 

This will produce generated_docs folder which will contain autogenerated code documentation.

Usage

Solver interface

Every solver uses solver interface. For supported methods, see Solver class documentation.

Basic usage

Initialize solver you want use, e.g. Gauss-Newton solver, with wanted parameters.

auto solver = GNSolver(L);

Then solve x using solve method by passing signal as argument.

auto solution = solver.solve(s);

Combination solver

Some of the functionalities can be combined together. We can make e.g. robust RANSAC solver that uses gradient descent for optimization.

auto solver = GDSolver(L);
std::shared_ptr<GDSolver> solver_ptr(new GDSolver(solver));
auto ransac_solver = RansacSolver(solver_ptr, n_channels, accepted_error, n_accepted_points);

Setting model

All the solvers use linear model by default. Numerical solver can use different model specified by user. We can make e.g. Gauss-Newton solver that uses quadratic model.

arma::mat quadratic_model(arma::mat x, arma::mat L)
{
    return x * arma::pow(L, 2);
}

auto gn_solver = GNSolver(L);
gn_solver.set_model(quadratic_model);

More information

For more information, see examples in samples folder.

Notes

Code tested with Ubuntu 18.04.3 LTS / gcc 7.4.0