n-Dimensional Fast Methods  0.7
 All Classes Functions Variables Typedefs Pages
GradientDescent< grid_t > Class Template Reference

Implements gradient descent to be used together with nDGridMap and FMCell or derived types. More...

#include <gradientdescent.hpp>

Static Public Member Functions

static void apply (grid_t &grid, unsigned int &idx, Path &path, std::vector< double > &path_velocity, double step=1)
 Computes the path over grid from idx to a minimum and extracts the velocity in every point. More...
 

Private Types

typedef std::array< unsigned
int, ndims_
Coord
 Shorthand for coordinates.
 
typedef std::array< double,
ndims_
Point
 Shorhand for real points.
 
typedef std::vector< PointPath
 Shorthand for path type of real points.
 

Static Private Attributes

static constexpr size_t ndims_ = grid_t::getNDims()
 Shorthand for number of dimensions.
 

Detailed Description

template<class grid_t>
class GradientDescent< grid_t >

Copyright (C) 2014 Javier V. Gomez www.javiervgomez.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition at line 41 of file gradientdescent.hpp.

Member Function Documentation

template<class grid_t>
static void GradientDescent< grid_t >::apply ( grid_t &  grid,
unsigned int &  idx,
Path path,
std::vector< double > &  path_velocity,
double  step = 1 
)
inlinestatic

Simple gradient approximation is used: dimension 0: gx = f((x-1,y)+f(x+1,y))/2 dimension 1: gy = f((x,y-1)+f(x,y+1))/2 and so on.

No checks are done (points in the borders, points in obstacles...). IMPORTANT NOTE: both minimum and initial index cannot be in the border of the map. This situation is not checked. We recommend to set a 1 pixel black border around the map image.

Definition at line 67 of file gradientdescent.hpp.


The documentation for this class was generated from the following file: