Benchmark a set of planners on a problem instance. More...
#include <Benchmark.h>
Classes | |
struct | CompleteExperiment |
This structure holds experimental data for a set of planners. More... | |
struct | PlannerExperiment |
The data collected after running a planner multiple times. More... | |
struct | Status |
This structure contains information about the activity of a benchmark instance. If the instance is running, it is possible to find out information such as which planner is currently being tested or how much. More... | |
Public Types | |
typedef boost::function2< void, const base::PlannerPtr &, RunProperties & > | PostSetupEvent |
Signature of function that can be called after a planner execution is completed. | |
typedef boost::function1< void, const base::PlannerPtr & > | PreSetupEvent |
Signature of function that can be called before a planner execution is started. | |
typedef std::map< std::string, std::string > | RunProperties |
The data collected from a run of a planner is stored as key-value pairs. | |
Public Member Functions | |
void | addPlanner (const base::PlannerPtr &planner) |
Set the planner to use. If the planner is not set, an attempt is made to use the planner allocator. If no planner allocator is available either, a default planner is set. | |
void | addPlannerAllocator (const base::PlannerAllocator &pa) |
Set the planner allocator to use. This is only used if no planner has been set. This is optional -- a default planner will be used if no planner is otherwise specified. | |
virtual void | benchmark (double maxTime, double maxMem, unsigned int runCount, bool displayProgress=false) |
Benchmark the added planners on the defined problem. Repeated calls clear previously gathered data. | |
Benchmark (control::SimpleSetup &setup, const std::string &name=std::string()) | |
Constructor needs the SimpleSetup instance needed for planning. Optionally, the experiment name (name) can be specified. | |
Benchmark (geometric::SimpleSetup &setup, const std::string &name=std::string()) | |
Constructor needs the SimpleSetup instance needed for planning. Optionally, the experiment name (name) can be specified. | |
void | clearPlanners (void) |
Clear the set of planners to be benchmarked. | |
const std::string & | getExperimentName (void) const |
Get the name of the experiment. | |
const CompleteExperiment & | getRecordedExperimentData (void) const |
Return all the experiment data that would be written to the results file. The data should not be changed, but it could be useful to quickly extract cartain statistics. | |
const Status & | getStatus (void) const |
Get the status of the benchmarking code. This function can be called in a separate thread to check how much progress has been made. | |
bool | saveResultsToFile (void) const |
Save the results of the benchmark to a file. The name of the file is the current date and time. | |
bool | saveResultsToFile (const char *filename) const |
Save the results of the benchmark to a file. | |
virtual bool | saveResultsToStream (std::ostream &out=std::cout) const |
Save the results of the benchmark to a stream. | |
void | setExperimentName (const std::string &name) |
Set the name of the experiment. | |
void | setPostRunEvent (const PostSetupEvent &event) |
Set the event to be called after the run of a planner. | |
void | setPreRunEvent (const PreSetupEvent &event) |
Set the event to be called before the run of a planner. | |
virtual | ~Benchmark (void) |
Protected Member Functions | |
std::string | getResultsFilename (void) const |
Propose a name for a file in which results should be saved, based on the date and hostname of the experiment. | |
Protected Attributes | |
control::SimpleSetup * | csetup_ |
The instance of the problem to benchmark (if planning with controls). | |
CompleteExperiment | exp_ |
The collected experimental data (for all planners). | |
geometric::SimpleSetup * | gsetup_ |
The instance of the problem to benchmark (if geometric planning). | |
msg::Interface | msg_ |
Interface for console output. | |
std::vector< base::PlannerPtr > | planners_ |
The set of planners to be tested. | |
PostSetupEvent | postRun_ |
Event to be called after the run of a planner. | |
PreSetupEvent | preRun_ |
Event to be called before the run of a planner. | |
Status | status_ |
The current status of this benchmarking instance. |
Benchmark a set of planners on a problem instance.
Definition at line 44 of file Benchmark.h.
typedef boost::function2<void, const base::PlannerPtr&, RunProperties&> ompl::Benchmark::PostSetupEvent |
Signature of function that can be called after a planner execution is completed.
Definition at line 78 of file Benchmark.h.
typedef boost::function1<void, const base::PlannerPtr&> ompl::Benchmark::PreSetupEvent |
Signature of function that can be called before a planner execution is started.
Definition at line 75 of file Benchmark.h.
typedef std::map<std::string, std::string> ompl::Benchmark::RunProperties |
The data collected from a run of a planner is stored as key-value pairs.
Definition at line 72 of file Benchmark.h.
ompl::Benchmark::Benchmark | ( | geometric::SimpleSetup & | setup, | |
const std::string & | name = std::string() | |||
) | [inline] |
Constructor needs the SimpleSetup instance needed for planning. Optionally, the experiment name (name) can be specified.
Definition at line 125 of file Benchmark.h.
ompl::Benchmark::Benchmark | ( | control::SimpleSetup & | setup, | |
const std::string & | name = std::string() | |||
) | [inline] |
Constructor needs the SimpleSetup instance needed for planning. Optionally, the experiment name (name) can be specified.
Definition at line 131 of file Benchmark.h.
virtual ompl::Benchmark::~Benchmark | ( | void | ) | [inline, virtual] |
Definition at line 136 of file Benchmark.h.
void ompl::Benchmark::addPlanner | ( | const base::PlannerPtr & | planner | ) | [inline] |
Set the planner to use. If the planner is not set, an attempt is made to use the planner allocator. If no planner allocator is available either, a default planner is set.
Definition at line 156 of file Benchmark.h.
void ompl::Benchmark::addPlannerAllocator | ( | const base::PlannerAllocator & | pa | ) | [inline] |
Set the planner allocator to use. This is only used if no planner has been set. This is optional -- a default planner will be used if no planner is otherwise specified.
Definition at line 167 of file Benchmark.h.
virtual void ompl::Benchmark::benchmark | ( | double | maxTime, | |
double | maxMem, | |||
unsigned int | runCount, | |||
bool | displayProgress = false | |||
) | [virtual] |
Benchmark the added planners on the defined problem. Repeated calls clear previously gathered data.
maxTime | the maximum amount of time a planner is allowed to run (seconds) | |
maxMem | the maximum amount of memory a planner is allowed to use (MB) | |
runCount | the number of times to run each planner | |
displayProgress | flag indicating whether progress is to be displayed or not |
void ompl::Benchmark::clearPlanners | ( | void | ) | [inline] |
Clear the set of planners to be benchmarked.
Definition at line 173 of file Benchmark.h.
const std::string& ompl::Benchmark::getExperimentName | ( | void | ) | const [inline] |
Get the name of the experiment.
Definition at line 147 of file Benchmark.h.
const CompleteExperiment& ompl::Benchmark::getRecordedExperimentData | ( | void | ) | const [inline] |
Return all the experiment data that would be written to the results file. The data should not be changed, but it could be useful to quickly extract cartain statistics.
Definition at line 217 of file Benchmark.h.
std::string ompl::Benchmark::getResultsFilename | ( | void | ) | const [protected] |
Propose a name for a file in which results should be saved, based on the date and hostname of the experiment.
const Status& ompl::Benchmark::getStatus | ( | void | ) | const [inline] |
Get the status of the benchmarking code. This function can be called in a separate thread to check how much progress has been made.
Definition at line 208 of file Benchmark.h.
bool ompl::Benchmark::saveResultsToFile | ( | void | ) | const |
Save the results of the benchmark to a file. The name of the file is the current date and time.
bool ompl::Benchmark::saveResultsToFile | ( | const char * | filename | ) | const |
Save the results of the benchmark to a file.
virtual bool ompl::Benchmark::saveResultsToStream | ( | std::ostream & | out = std::cout |
) | const [virtual] |
Save the results of the benchmark to a stream.
void ompl::Benchmark::setExperimentName | ( | const std::string & | name | ) | [inline] |
Set the name of the experiment.
Definition at line 141 of file Benchmark.h.
void ompl::Benchmark::setPostRunEvent | ( | const PostSetupEvent & | event | ) | [inline] |
Set the event to be called after the run of a planner.
Definition at line 185 of file Benchmark.h.
void ompl::Benchmark::setPreRunEvent | ( | const PreSetupEvent & | event | ) | [inline] |
Set the event to be called before the run of a planner.
Definition at line 179 of file Benchmark.h.
control::SimpleSetup* ompl::Benchmark::csetup_ [protected] |
The instance of the problem to benchmark (if planning with controls).
Definition at line 240 of file Benchmark.h.
CompleteExperiment ompl::Benchmark::exp_ [protected] |
The collected experimental data (for all planners).
Definition at line 246 of file Benchmark.h.
geometric::SimpleSetup* ompl::Benchmark::gsetup_ [protected] |
The instance of the problem to benchmark (if geometric planning).
Definition at line 237 of file Benchmark.h.
msg::Interface ompl::Benchmark::msg_ [protected] |
Interface for console output.
Definition at line 258 of file Benchmark.h.
std::vector<base::PlannerPtr> ompl::Benchmark::planners_ [protected] |
The set of planners to be tested.
Definition at line 243 of file Benchmark.h.
PostSetupEvent ompl::Benchmark::postRun_ [protected] |
Event to be called after the run of a planner.
Definition at line 255 of file Benchmark.h.
PreSetupEvent ompl::Benchmark::preRun_ [protected] |
Event to be called before the run of a planner.
Definition at line 252 of file Benchmark.h.
Status ompl::Benchmark::status_ [protected] |
The current status of this benchmarking instance.
Definition at line 249 of file Benchmark.h.