tiny-solver-rs
Warning! This project is still under development.
Inspired by ceres-solver, tiny-solver, and minisam.
This is a general optimizer written in Rust, including bindings for Python. If you're familiar with ceres-solver or factor-graph optimizers, you'll find it very easy to use.
Installation
rust
Current Features
- Automatic Derivatives using num-dual
- Sparse QR, Sparse Cholesky using faer
- GaussNewtonOptimizer
- LevenbergMarquardtOptimizer
- Multithreading jacobian
- loss functions (Huber, CauchyLoss, ArctanLoss)
- Define factor in python
TODO
- information matrix
Benchmark
dataset | tiny-solver | gtsam | minisam |
---|---|---|---|
m3500 | 161.1ms | 130.7ms | 123.6 ms |
It's not extremely optimized, but it's easy to install and use.
Usage
Rust
// define your own Cost/Factor struct
// impl residual function
// and the jacobian will be auto generated
use nalgebra as na;
Python (Currently not maintaining)
# define custom cost function in python
# the trade off is the jacobian for the problem cannot be done in parallel
# because of gil
= + 2 * + 4 *
= *
return
# initialize problem (factor graph)
=
# factor defined in python
=
# prior factor import from rust
=
# initial values
=
# optimizer
=
=
# result
Example
Basic example
M3500 dataset
# run rust version
# run python version