OptimisationTools.cc 1016 Bytes
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1
#include "OptimisationTools.h"
2
#include <QPointF>
Valentin Platzgummer's avatar
Valentin Platzgummer committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

namespace OptimisationTools {
    namespace  {

    } // end anonymous namespace

    /*!
     * \fn bool dijkstraAlgorithm(int startIndex, int endIndex, const QList<T> elements, QList<T> &elementPath, double(*distance)(const T &t1, const T &t2))
     * Calculates the shortest path between the elements stored in \a elements.
     * The \l {Dijkstra Algorithm} is used to find the shorest path.
     * Stores the result inside \a elementPath when sucessfull.
     * The function handle \a distance is used to calculate the distance between two elements. The distance must be positive.
     * Returns \c true if successful, \c false else.
     *
     * \sa QList
     */
19
    template <class T>
20
    bool dijkstraAlgorithm(const QList<T> &elements, int startIndex, int endIndex, QList<T> &elementPath, std::function<double(const T &, const T &)> distance); // don't seperate parameters with new lines or documentation will break
Valentin Platzgummer's avatar
Valentin Platzgummer committed
21 22

} // end OptimisationTools namespace