37 #ifndef OMPL_GEOMETRIC_GENETIC_SEARCH_
38 #define OMPL_GEOMETRIC_GENETIC_SEARCH_
40 #include "ompl/base/SpaceInformation.h"
41 #include "ompl/base/goals/GoalRegion.h"
42 #include "ompl/geometric/HillClimbing.h"
72 const std::vector<base::State*> &hint = std::vector<base::State*>());
89 checkValidity_ = valid;
96 return checkValidity_;
126 poolMutation_ = size;
132 return poolMutation_;
150 maxDistance_ = distance;
170 return checkValidity_ ? si_->isValid(state) :
true;
180 struct IndividualSort
182 bool operator()(
const Individual& a,
const Individual& b)
184 if (a.valid == b.valid)
185 return a.distance < b.distance;
191 base::SpaceInformationPtr si_;
192 base::StateSamplerPtr sampler_;
193 std::vector<Individual> pool_;
194 unsigned int poolSize_;
195 unsigned int poolMutation_;
196 unsigned int poolRandom_;
197 unsigned int generations_;
void setTryImprove(bool flag)
Set the flag that determines whether improvements using hill climbing should be attempted for solutio...
void setValidityCheck(bool valid)
Set the state validity flag; if this is false, states are not checked for validity.
void setPoolRandomSize(unsigned int size)
Set the number of individuals to randomly sample at each generation.
void setMaxImproveSteps(unsigned int steps)
Set the number of steps to perform.
void setRange(double distance)
Set the range (distance) to be used when sampling around a state.
bool solve(double solveTime, const base::GoalRegion &goal, base::State *result, const std::vector< base::State * > &hint=std::vector< base::State * >())
Find a state that fits the request.
void setPoolMutationSize(unsigned int size)
Set the number of individuals to mutate at each generation.
void setMaxImproveSteps(unsigned int maxSteps)
Set the number of steps to perform when using hill climbing to improve an individual in the populatio...
unsigned int getPoolMutationSize(void) const
Get the number of individuals that are mutated at each generation.
Definition of an abstract state.
unsigned int getMaxImproveSteps(void) const
Get the number of steps to perform.
void clear(void)
Clear the pool of samples.
void setPoolSize(unsigned int size)
Set the number of individuals in the population.
unsigned int getMaxImproveSteps(void) const
Get the number of steps to perform when using hill climbing to improve an individual in the populatio...
GeneticSearch(const base::SpaceInformationPtr &si)
Construct an instance of a genetic algorithm for inverse kinematics given the space information to se...
double getRange(void) const
Get the range GeneticSearch is using.
Definition of a goal region.
unsigned int getPoolSize(void) const
Get the number number of individuals in the population.
unsigned int getPoolRandomSize(void) const
Get the number of individuals to randomly sample at each generation.
bool getTryImprove(void) const
Returns true if improvements using hill climbing should be attempted for solutions generated by the g...
Genetic Algorithm for searching valid states.
bool getValidityCheck(void) const
Get the state validity flag; if this is false, states are not checked for validity.
void setValidityCheck(bool valid)
Set the state validity flag; if this is false, states are not checked for validity.