Benchmark.cpp
85 runThread(planner, memStart + maxMem, time::seconds(maxTime), time::seconds(timeBetweenUpdates));
207 void ompl::tools::Benchmark::addExperimentParameter(const std::string &name, const std::string &type,
213 const std::map<std::string, std::string> &ompl::tools::Benchmark::getExperimentParameters() const
235 if (planner && planner->getSpaceInformation().get() != (gsetup_ != nullptr ? gsetup_->getSpaceInformation().get() :
243 planners_.push_back(pa(gsetup_ != nullptr ? gsetup_->getSpaceInformation() : csetup_->getSpaceInformation()));
273 const ompl::tools::Benchmark::CompleteExperiment &ompl::tools::Benchmark::getRecordedExperimentData() const
399 out << planner.progressPropertyNames.size() << " progress properties for each run" << std::endl;
521 std::cout << "Each planner will be executed " << req.runCount << " times for at most " << req.maxTime
541 OMPL_INFORM("Executing planner-switch event for planner %s ...", status_.activePlanner.c_str());
549 es << "There was an error executing the planner-switch event for planner " << status_.activePlanner
568 std::sort(exp_.planners[i].progressPropertyNames.begin(), exp_.planners[i].progressPropertyNames.end());
577 req.runCount ? (double)(100 * (req.runCount * i + j)) / (double)(planners_.size() * req.runCount) :
625 es << "There was an error executing the pre-run event for run " << status_.activeRun << " of planner "
643 run["status ENUM"] = std::to_string((int)static_cast<base::PlannerStatus::StatusType>(rp.getStatus()));
709 run["solution segments INTEGER"] = std::to_string(csetup_->getSolutionPath().getControlCount());
714 base::PlannerData pd(gsetup_ ? gsetup_->getSpaceInformation() : csetup_->getSpaceInformation());
void setPreRunEvent(const PreSetupEvent &event)
Set the event to be called before the run of a planner.
Definition: Benchmark.cpp:257
void setPlannerSwitchEvent(const PreSetupEvent &event)
Set the event to be called before any runs of a particular planner (when the planner is switched)
Definition: Benchmark.cpp:251
std::function< bool()> PlannerTerminationConditionFn
Signature for functions that decide whether termination conditions have been met for a planner,...
Definition: PlannerTerminationCondition.h:120
Definition: Time.h:151
std::function< void(const base::PlannerPtr &, RunProperties &)> PostSetupEvent
Signature of function that can be called after a planner execution is completed.
Definition: Benchmark.h:178
MemUsage_t getProcessMemoryUsage()
Get the amount of memory the current process is using. This should work on major platforms (Windows,...
const std::string & getExperimentName() const
Get the name of the experiment.
Definition: Benchmark.cpp:228
void noOutputHandler()
This function instructs ompl that no messages should be outputted. Equivalent to useOutputHandler(nul...
Definition: Console.cpp:95
std::map< std::string, PlannerProgressProperty > PlannerProgressProperties
A dictionary which maps the name of a progress property to the function to be used for querying that ...
Definition: Planner.h:417
Generic class to handle output from a piece of code.
Definition: Console.h:102
void useOutputHandler(OutputHandler *oh)
Specify the instance of the OutputHandler to use. By default, this is OutputHandlerSTD.
Definition: Console.cpp:108
Create the set of classes typically needed to solve a geometric problem.
Definition: SimpleSetup.h:126
CompleteExperiment exp_
The collected experimental data (for all planners)
Definition: Benchmark.h:378
unsigned int numEdges() const
Retrieve the number of edges in this structure.
Definition: PlannerData.cpp:205
This structure holds experimental data for a set of planners.
Definition: Benchmark.h:207
const std::map< std::string, std::string > & getExperimentParameters() const
Get all optional benchmark parameters. The map key is 'name type'
Definition: Benchmark.cpp:213
bool simplify
flag indicating whether simplification should be applied to path; true by default
Definition: Benchmark.h:285
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique,...
Definition: PlannerData.h:238
const CompleteExperiment & getRecordedExperimentData() const
Return all the experiment data that would be written to the results file. The data should not be chan...
Definition: Benchmark.cpp:273
void addPlannerAllocator(const base::PlannerAllocator &pa)
Add a planner allocator to use.
Definition: Benchmark.cpp:241
std::function< void(const base::PlannerPtr &)> PreSetupEvent
Signature of function that can be called before a planner execution is started.
Definition: Benchmark.h:175
unsigned int runCount
the number of times to run each planner; 100 by default If set to 0, then run each planner as many ti...
Definition: Benchmark.h:271
void setExperimentName(const std::string &name)
Set the name of the experiment.
Definition: Benchmark.cpp:223
bool saveConsoleOutput
flag indicating whether console output is saved (in an automatically generated filename); true by def...
Definition: Benchmark.h:282
unsigned int numVertices() const
Retrieve the number of vertices in this structure.
Definition: PlannerData.cpp:200
Create the set of classes typically needed to solve a control problem.
Definition: SimpleSetup.h:126
void addExperimentParameter(const std::string &name, const std::string &type, const std::string &value)
Add an optional parameter's information to the benchmark output. Useful for aggregating results over ...
Definition: Benchmark.cpp:207
bool displayProgress
flag indicating whether progress is to be displayed or not; true by default
Definition: Benchmark.h:278
bool saveResultsToFile() const
Save the results of the benchmark to a file. The name of the file is the current date and time.
Definition: Benchmark.cpp:299
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:112
std::function< PlannerPtr(const SpaceInformationPtr &)> PlannerAllocator
Definition of a function that can allocate a planner.
Definition: Planner.h:501
Implementation of OutputHandler that saves messages in a file.
Definition: Console.h:125
static std::uint_fast32_t getSeed()
Get the seed used to generate the seeds of each RNG instance. Passing the returned value to setSeed()...
Definition: RandomNumbers.cpp:209
std::chrono::system_clock::duration duration
Representation of a time duration.
Definition: Time.h:119
std::size_t numExperimentParameters() const
Return the number of optional benchmark parameters.
Definition: Benchmark.cpp:218
std::map< std::string, std::string > properties
Any extra properties (key-value pairs) the planner can set.
Definition: PlannerData.h:474
virtual void benchmark(const Request &req)
Benchmark the added planners on the defined problem. Repeated calls clear previously gathered data.
Definition: Benchmark.cpp:432
std::string getCPUInfo()
Get information about the CPU of the machine in use.
Benchmark(geometric::SimpleSetup &setup, const std::string &name=std::string())
Constructor needs the SimpleSetup instance needed for planning. Optionally, the experiment name (name...
Definition: Benchmark.cpp:195
The data collected from a run of a planner is stored as key-value pairs.
Definition: Benchmark.h:168
double maxMem
the maximum amount of memory a planner is allowed to use (MB); 4096.0 by default
Definition: Benchmark.h:267
std::string as_string(const point &p)
Return string representation of point in time.
Definition: Time.h:142
void setPostRunEvent(const PostSetupEvent &event)
Set the event to be called after the run of a planner.
Definition: Benchmark.cpp:263
const Status & getStatus() const
Get the status of the benchmarking code. This function can be called in a separate thread to check ho...
Definition: Benchmark.cpp:268
OutputHandler * getOutputHandler()
Get the instance of the OutputHandler currently used. This is nullptr in case there is no output hand...
Definition: Console.cpp:115
std::string toString(float val)
convert float to string using classic "C" locale semantics
Definition: String.cpp:82
This structure contains information about the activity of a benchmark instance. If the instance is ru...
Definition: Benchmark.h:151
duration seconds(double sec)
Return the time duration representing a given number of seconds.
Definition: Time.h:128
virtual bool saveResultsToStream(std::ostream &out=std::cout) const
Save the results of the benchmark to a stream.
Definition: Benchmark.cpp:305
double timeBetweenUpdates
When collecting time-varying data from a planner during its execution, the planner's progress will be...
Definition: Benchmark.h:275
Main namespace. Contains everything in this library.
Definition: MultiLevelPlanarManipulatorDemo.cpp:65
double maxTime
the maximum amount of time a planner is allowed to run (seconds); 5.0 by default
Definition: Benchmark.h:264