MRPT  1.9.9
CAStarExample Class Reference

Detailed Description

To use the template, a class must be derived from CAStarAlgorithm<Solution class>="">.

In this case, the Solution Class is CCoinDistribution.

Definition at line 65 of file vision_stereo_rectify/test.cpp.

Inheritance diagram for CAStarExample:
Inheritance graph

Public Member Functions

 CAStarExample (size_t goal)
 When a class derives from CAStarAlgorithm, its constructor should include all the data that define the specific problem. More...
 
virtual bool isSolutionEnded (const CCoinDistribution &s)
 The following five methods must be implemented to use the algorithm: More...
 
virtual bool isSolutionValid (const CCoinDistribution &s)
 Client code must implement this method. More...
 
virtual void generateChildren (const CCoinDistribution &s, vector< CCoinDistribution > &sols)
 Client code must implement this method. More...
 
virtual double getHeuristic (const CCoinDistribution &s)
 Client code must implement this method. More...
 
virtual double getCost (const CCoinDistribution &s)
 Client code must implement this method. More...
 
int getOptimalSolution (const CCoinDistribution &initialSol, CCoinDistribution &finalSol, double upperLevel=HUGE_VAL, double maxComputationTime=HUGE_VAL)
 Finds the optimal solution for a problem, using the A* algorithm. More...
 

Private Attributes

const size_t N
 Problem goal. More...
 

Constructor & Destructor Documentation

◆ CAStarExample()

CAStarExample::CAStarExample ( size_t  goal)
inline

When a class derives from CAStarAlgorithm, its constructor should include all the data that define the specific problem.

Definition at line 78 of file vision_stereo_rectify/test.cpp.

Member Function Documentation

◆ generateChildren()

virtual void CAStarExample::generateChildren ( const CCoinDistribution sol,
vector< CCoinDistribution > &  sols 
)
inlinevirtual

Client code must implement this method.

Given a partial solution, returns all its children solution, regardless of their validity or completeness.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 90 of file vision_stereo_rectify/test.cpp.

◆ getCost()

virtual double CAStarExample::getCost ( const CCoinDistribution sol)
inlinevirtual

Client code must implement this method.

Given a (possibly partial) solution, calculates its cost so far. This cost must not decrease with each step. That is, a solution cannot have a smaller cost than the previous one from which it was generated.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 108 of file vision_stereo_rectify/test.cpp.

◆ getHeuristic()

virtual double CAStarExample::getHeuristic ( const CCoinDistribution sol)
inlinevirtual

Client code must implement this method.

Given a partial solution, estimates the cost of the remaining (unknown) part. This cost must always be greater or equal to zero, and not greater than the actual cost. Thus, must be 0 if the solution is complete.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 102 of file vision_stereo_rectify/test.cpp.

◆ getOptimalSolution()

int mrpt::graphs::CAStarAlgorithm< CCoinDistribution >::getOptimalSolution ( const CCoinDistribution initialSol,
CCoinDistribution finalSol,
double  upperLevel = HUGE_VAL,
double  maxComputationTime = HUGE_VAL 
)
inlineinherited

Finds the optimal solution for a problem, using the A* algorithm.

Returns whether an optimal solution was actually found. Returns 0 if no solution was found, 1 if an optimal solution was found and 2 if a (possibly suboptimal) solution was found but the time lapse ended.

Definition at line 92 of file CAStarAlgorithm.h.

References mrpt::graphs::CAStarAlgorithm< T >::generateChildren(), mrpt::graphs::CAStarAlgorithm< T >::getTotalCost(), mrpt::graphs::CAStarAlgorithm< T >::isSolutionEnded(), mrpt::graphs::CAStarAlgorithm< T >::isSolutionValid(), mrpt::system::CTicTac::Tac(), and mrpt::system::CTicTac::Tic().

◆ isSolutionEnded()

virtual bool CAStarExample::isSolutionEnded ( const CCoinDistribution s)
inlinevirtual

The following five methods must be implemented to use the algorithm:

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 82 of file vision_stereo_rectify/test.cpp.

◆ isSolutionValid()

virtual bool CAStarExample::isSolutionValid ( const CCoinDistribution sol)
inlinevirtual

Client code must implement this method.

Returns true if the given solution is acceptable, that is, doesn't violate the problem logic.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 86 of file vision_stereo_rectify/test.cpp.

Member Data Documentation

◆ N

const size_t CAStarExample::N
private

Problem goal.

Definition at line 71 of file vision_stereo_rectify/test.cpp.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020