solver
1.0
|
Universal algorithms like Floyd-Warshall, Golden Search, etc. More...
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <vector>
#include <utility>
Go to the source code of this file.
Typedefs | |
template<class T > | |
using | DistanceMatrix = std::vector< std::vector< T >> |
Definition of the matrix data type. More... | |
Functions | |
template<class T , class C = std::greater<T>> | |
DistanceMatrix< T > | floyd (DistanceMatrix< T > m, const C &cmp=std::greater< T >()) |
It calculates all-to-all shortest paths and returns the matrix with their lengths. More... | |
template<class T > | |
std::pair< double, double > | goldenSearch (const T &unimodalFce) |
It finds the minimal function value of a unimodal convex function. More... | |
Universal algorithms like Floyd-Warshall, Golden Search, etc.
Definition in file Algorithms.h.
using DistanceMatrix = std::vector<std::vector<T>> |
Definition of the matrix data type.
T | A numerical type. |
Definition at line 39 of file Algorithms.h.
DistanceMatrix<T> floyd | ( | DistanceMatrix< T > | m, |
const C & | cmp = std::greater<T>() |
||
) |
It calculates all-to-all shortest paths and returns the matrix with their lengths.
m | Distance matrix of the graph without negative cycles. |
cmp | Operator of the comparison, typically '>'. |
T | A numerical type. |
C | A comparison function of distances. |
Definition at line 50 of file Algorithms.h.
std::pair<double, double> goldenSearch | ( | const T & | unimodalFce | ) |
It finds the minimal function value of a unimodal convex function.
unimodalFce | A convex unimodal function depending on one variable. |
T | A class encapsulating the convex function, T::tolerance(), T::functionValue() methods have to be defined. |
Definition at line 72 of file Algorithms.h.