New upstream version 1.4.2+ds1

parent a6d3fd57
......@@ -2,55 +2,44 @@ language: cpp
matrix:
include:
- os: linux
dist: trusty
sudo: required
compiler: gcc
addons:
apt:
packages:
- libboost-serialization1.55-dev
- libboost-filesystem1.55-dev
- libboost-system1.55-dev
- libboost-program-options1.55-dev
- libboost-test1.55-dev
- libode-dev
- libeigen3-dev
cache:
apt: true
- os: osx
osx_image: xcode9.1
compiler: clang
- os: linux
sudo: required
services:
- docker
env: DOCKERFILE="debian-stretch" PYTHON=/usr/bin/python
- os: linux
sudo: required
services:
- docker
env: DOCKERFILE="ubuntu-xenial" PYTHON=/usr/bin/python
- os: linux
sudo: required
services:
- docker
env: DOCKERFILE="ubuntu-bionic" PYTHON=/usr/bin/python3
- os: linux
dist: xenial
sudo: required
compiler: gcc
addons:
apt:
packages:
- libboost-serialization-dev
- libboost-filesystem-dev
- libboost-system-dev
- libboost-program-options-dev
- libboost-test-dev
- libode-dev
- libeigen3-dev
- os: osx
osx_image: xcode10.1
compiler: clang
addons:
homebrew:
packages:
- eigen
- flann
update: true
- os: linux
sudo: required
services:
- docker
env: DOCKERFILE="debian-stretch" PYTHON=/usr/bin/python
- os: linux
sudo: required
services:
- docker
env: DOCKERFILE="ubuntu-bionic" PYTHON=/usr/bin/python3
install:
before_install:
- if [ -n "$DOCKERFILE" ]; then
docker build -t "$DOCKERFILE" -f "scripts/docker/$DOCKERFILE" .;
fi
- if [ -z "$DOCKERFILE" -a "$TRAVIS_OS_NAME" = "osx" ]; then
brew update;
brew install eigen;
fi
- if [ -z "$DOCKERFILE" -a "$TRAVIS_OS_NAME" = "linux" ]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test;
sudo apt-get -y update;
sudo apt-get -y install g++-5;
export CXX=g++-5;
fi
script:
- if [ -n "$DOCKERFILE" ]; then
......
......@@ -95,9 +95,8 @@ find_path(PYTHON_INCLUDE_DIRS "Python.h"
execute_process(COMMAND "${PYTHON_EXEC}" "-c"
"from distutils.sysconfig import get_python_lib; print(get_python_lib())"
OUTPUT_VARIABLE PYTHON_SITE_MODULES_
OUTPUT_VARIABLE PYTHON_SITE_MODULES
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^${PYTHON_PREFIX2}/" "" PYTHON_SITE_MODULES "${PYTHON_SITE_MODULES_}")
function(find_python_module module)
string(TOUPPER ${module} module_upper)
......
......@@ -19,11 +19,19 @@ if (CASTXML)
endif()
endif()
# workaround for problem between Xcode and castxml on Mojave
if (APPLE AND CMAKE_CXX_COMPILER MATCHES "/Applications/Xcode.app/Contents/Developer/Toolchains/.*")
set(CASTXMLCOMPILER_PATH "/usr/bin/clang++")
else()
set(CASTXMLCOMPILER_PATH "${CMAKE_CXX_COMPILER}")
endif()
set(CASTXMLCONFIG "[xml_generator]
xml_generator=castxml
xml_generator_path=${CASTXML}
compiler=${CASTXMLCOMPILER}
compiler_path=${CMAKE_CXX_COMPILER}
compiler_path=${CASTXMLCOMPILER_PATH}
")
set(_candidate_include_path
......
# set the version in a way CMake can use
set(OMPL_MAJOR_VERSION 1)
set(OMPL_MINOR_VERSION 4)
set(OMPL_PATCH_VERSION 0)
set(OMPL_PATCH_VERSION 2)
set(OMPL_VERSION "${OMPL_MAJOR_VERSION}.${OMPL_MINOR_VERSION}.${OMPL_PATCH_VERSION}")
# increment this when we have ABI changes
......
......@@ -41,6 +41,7 @@
#include <ompl/geometric/planners/prm/PRM.h>
#include <ompl/geometric/planners/stride/STRIDE.h>
#include <ompl/tools/benchmark/Benchmark.h>
#include <ompl/util/String.h>
#include <boost/math/constants/constants.hpp>
#include <boost/format.hpp>
......@@ -74,14 +75,14 @@ void addPlanner(ompl::tools::Benchmark& benchmark, const ompl::base::PlannerPtr&
{
ompl::base::ParamSet& params = planner->params();
if (params.hasParam(std::string("range")))
params.setParam(std::string("range"), std::to_string(range));
params.setParam(std::string("range"), ompl::toString(range));
benchmark.addPlanner(planner);
}
int main(int argc, char **argv)
{
if(argc > 1)
ndim = boost::lexical_cast<size_t>(argv[1]);
ndim = std::stoul(argv[1]);
double range = edgeWidth * 0.5;
auto space(std::make_shared<ompl::base::RealVectorStateSpace>(ndim));
......
......@@ -44,7 +44,7 @@ int main(int argc, char **argv)
exit(0);
}
auto numLinks = boost::lexical_cast<unsigned int>(std::string(argv[1]));
auto numLinks = std::stoul(argv[1]);
Environment env = createHornEnvironment(numLinks, log((double)numLinks) / (double)numLinks);
auto chain(std::make_shared<KinematicChainSpace>(numLinks, 1. / (double)numLinks, &env));
ompl::geometric::SimpleSetup ss(chain);
......
......@@ -357,7 +357,8 @@ public:
// increases, the state cost decreases.
ob::Cost stateCost(const ob::State* s) const override
{
return ob::Cost(1 / si_->getStateValidityChecker()->clearance(s));
return ob::Cost(1 / (si_->getStateValidityChecker()->clearance(s) +
std::numeric_limits<double>::min()));
}
};
......
......@@ -36,6 +36,7 @@
# Author: Luis G. Torres, Mark Moll
import sys
try:
from ompl import util as ou
from ompl import base as ob
......@@ -44,7 +45,6 @@ except ImportError:
# if the ompl module is not in the PYTHONPATH assume it is installed in a
# subdirectory of the parent directory called "py-bindings."
from os.path import abspath, dirname, join
import sys
sys.path.insert(0, join(dirname(dirname(abspath(__file__))), 'py-bindings'))
from ompl import util as ou
from ompl import base as ob
......@@ -113,7 +113,8 @@ class ClearanceObjective(ob.StateCostIntegralObjective):
# reciprocal of its clearance, so that as state clearance
# increases, the state cost decreases.
def stateCost(self, s):
return ob.Cost(1 / self.si_.getStateValidityChecker().clearance(s))
return ob.Cost(1 / (self.si_.getStateValidityChecker().clearance(s) +
sys.float_info.min))
## Return an optimization objective which attempts to steer the robot
# away from obstacles.
......
......@@ -347,14 +347,14 @@ public:
std::shared_ptr<_T> createPlanner()
{
auto &&planner = std::make_shared<_T>(csi);
return planner;
return std::move(planner);
}
template <typename _T>
std::shared_ptr<_T> createPlannerIntermediate()
{
auto &&planner = std::make_shared<_T>(csi, true);
return planner;
return std::move(planner);
}
template <typename _T>
......@@ -370,7 +370,7 @@ public:
else
planner->setRange(c_opt.range);
return planner;
return std::move(planner);
}
template <typename _T>
......@@ -386,7 +386,7 @@ public:
else
planner->setRange(c_opt.range);
return planner;
return std::move(planner);
}
template <typename _T>
......@@ -398,7 +398,7 @@ public:
if (isProj)
planner->setProjectionEvaluator(projection);
return planner;
return std::move(planner);
}
ob::PlannerPtr getPlanner(enum PLANNER_TYPE planner, const std::string &projection = "")
......
......@@ -43,7 +43,7 @@
<li><a href="installation.html">Installation</a></li>
<li><a href="tutorials.html">Tutorials</a></li>
<li><a href="group__demos.html">Demos</a></li>
<li><a href="gui.html">OMPL.app GUI</a></li><li><a href="webapp.html">OMPL web app</a></li>
<li><a href="python.html">Python Bindings</a></li>
<li><a href="planners.html">Available Planners</a></li>
<li><a href="benchmark.html">Benchmarking Planners</a></li>
......@@ -78,8 +78,8 @@
<li><a href="https://github.com/ompl/omplapp">omplapp on GitHub</a></li>
<li class="divider"></li>
<li class="dropdown-header">Continuous Integration</li>
<li><a href="https://travis-ci.org/ompl/ompl">ompl on Travis CI (Linux)</a></li>
<li><a href="https://travis-ci.org/ompl/omplapp">omplapp on Travis CI (Linux)</a></li>
<li><a href="https://travis-ci.org/ompl/ompl">ompl on Travis CI (Linux/macOS)</a></li>
<li><a href="https://travis-ci.org/ompl/omplapp">omplapp on Travis CI (Linux/macOS)</a></li>
<li><a href="https://ci.appveyor.com/project/mamoll/ompl">ompl on AppVeyor CI (Windows)</a></li>
<li><a href="https://ci.appveyor.com/project/mamoll/omplapp">omplapp on AppVeyor CI (Windows)</a></li>
</ul>
......
......@@ -78,8 +78,8 @@
<li><a href="https://github.com/ompl/omplapp">omplapp on GitHub</a></li>
<li class="divider"></li>
<li class="dropdown-header">Continuous Integration</li>
<li><a href="https://travis-ci.org/ompl/ompl">ompl on Travis CI (Linux)</a></li>
<li><a href="https://travis-ci.org/ompl/omplapp">omplapp on Travis CI (Linux)</a></li>
<li><a href="https://travis-ci.org/ompl/ompl">ompl on Travis CI (Linux/macOS)</a></li>
<li><a href="https://travis-ci.org/ompl/omplapp">omplapp on Travis CI (Linux/macOS)</a></li>
<li><a href="https://ci.appveyor.com/project/mamoll/ompl">ompl on AppVeyor CI (Windows)</a></li>
<li><a href="https://ci.appveyor.com/project/mamoll/omplapp">omplapp on AppVeyor CI (Windows)</a></li>
</ul>
......
......@@ -30,7 +30,7 @@ When developing your own code that relies on OMPL, you have several options:
4. Click Advanced Settings to open the Properties window for your project.
5. Go to C/C++ Build -> Settings in the left pane.
6. Under the Tool Settings tab, choose Cross G++ Compiler -> Includes. To the "Include paths" section, add the location of the OMPL source tree. For example, on a Linux system with default installation path, you should use "/usr/local/include". Click Apply.
7. Again under the Tool Settings tab, choose Cross G++ Linker -> Libraries. To the "Libraries" section, add "ompl" (and, if needed, "ompl_app_base" and "ompl_app") . To the "Library search path" section, add the location of the OMPL library files. For example, on a Linux system with default installation path, you should use "/usr/local/lib". Click Apply.
7. Again under the Tool Settings tab, choose Cross G++ Linker -> Libraries. To the "Libraries" section, add "ompl" (and, if needed, any Boost libraries, "ompl_app_base" and "ompl_app") . To the "Library search path" section, add the location of the OMPL library files. For example, on a Linux system with default installation path, you should use "/usr/local/lib". Click Apply.
8. Click OK to leave the Properties window. Click Finish.
- __IDE's such as MS Visual Studio and Xcode:__ consult your IDE's manual.
......
......@@ -34,7 +34,7 @@
<li><code>./install-ompl-ubuntu.sh --python</code> will install OMPL with Python bindings</li>
<li><code>./install-ompl-ubuntu.sh --app</code> will install OMPL.app with Python bindings</li>
</ul>
The script downloads and installs OMPL and all dependencies via <code>apt-get</code> &amp; <code>pip</code> and from source. It will ask for your password to install things. The script has been tested on vanilla installs of Ubuntu 14.04 (Trusty), 15.10 (Wily), 16.04 (Xenial), and 17.10 (Artful).
The script downloads and installs OMPL and all dependencies via <code>apt-get</code> &amp; <code>pip</code> and from source. It will ask for your password to install things. The script has been tested on vanilla installs of Ubuntu 14.04 (Trusty), 15.10 (Wily), 16.04 (Xenial), 17.10 (Artful), and 18.04 (Bionic).
</div>
<div role="tabpanel" class="tab-pane" id="ubuntubinary">
Simply type:
......@@ -90,11 +90,16 @@ cmake ../..</pre></li>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="osxmacports">
Install <a href="http://www.macports.org">MacPorts</a> and type:<pre class="fragment">sudo port sync \; install ompl</pre>
If you want to build OMPL from source, you can install just the OMPL dependencies like so:
<pre class="fragment">sudo port install `port -q info --depends ompl | sed 's/,//g'`</pre>
</div>
<div role="tabpanel" class="tab-pane" id="osxhomebrew">
Install <a href="http://brew.sh">Homebrew</a> and type:
<pre class="fragment">brew install ompl</pre>
Note that the <a href="http://braumeister.org/formula/ompl">Homebrew formula</a> does not include Python bindings.
Note that the <a href="http://braumeister.org/formula/ompl">Homebrew formula</a> does not include Python bindings. You could install all the dependencies for OMPL and the python bindings and build OMPL from source:
<pre class="fragment">brew install eigen castxml numpy boost-python3 pypy3 flann</pre>
Make sure to use Homebrew's python3 in that case by calling <code>cmake</code> like so:
<pre class="fragment">cmake -DPYTHON_EXEC=/usr/local/bin/python3 ...</pre>
</div>
</div>
</div>
......
......@@ -5,11 +5,11 @@ The OMPL Planner Arena code allows you to easily create plots from a benchmark d
## Dependencies
- R 3.1.0 or higher
\note The R packages on Ubuntu (and likely other Linux distributions) are too old. See the [CRAN Ubuntu page](https://cran.r-project.org/bin/linux/ubuntu/README.html) for details on how to get packages for the latest version of R.
\note The R packages on Ubuntu 14.04 (and likely other Linux distributions) are too old. See the [CRAN Ubuntu page](https://cran.r-project.org/bin/linux/ubuntu/README.html) for details on how to get packages for the latest version of R.
- On Ubuntu you need to install libv8-dev.
- The following R packages: shiny, shinyjs, V8, dplyr, dbply, tidyr, ggplot2, Hmisc, RSQLite, and markdown. These packages can be installed like so:
- The following R packages: shinyjs, V8, tidyverse, Hmisc, RSQLite, and markdown. These packages can be installed like so:
sudo R -e "install.packages(c('shiny', 'shinyjs', 'V8', 'dplyr', 'dbplyr', 'tidyr', 'ggplot2', 'Hmisc', 'RSQLite', 'markdown'), repos='http://cran.r-project.org')"
R -e "install.packages(c('shinyjs', 'V8', 'tidyverse', 'Hmisc', 'RSQLite', 'markdown'), repos='http://cran.r-project.org')"
## Running
......
# Release Notes {#releaseNotes}
# OMPL 1.4.2 (January 18, 2019)
- Misc. small bug fixes.
# OMPL 1.4.1 (December 5, 2018)
- Made PlannerArena work with latest versions of R packages.
- Misc. bug and documentation fixes.
# OMPL 1.4.0 (June 25, 2018)
- There is a new framework for planning with constraints that unifies and generalizes prior proposed algorithms such as CBiRRT2, AtlasRRT and TangentBundle-RRT. The framework decouples the methodology used for computing configurations that satisfy constraints from the high-level planning strategy. This allows the user to use any sampling-based planning algorithm in OMPL with arbitrary geometric constraints. See the [overview](constrainedPlanning.html), [tutorial](constrainedPlanningTutorial.html) and various [demos](group__demos.html) in `ompl/demos/constraint`.
- Eigen3 is now a required dependency.
- Various BIT* improvements.
- PRM and RRTConnect can now return approximate solutions if an exact solution cannot be found. (This feature was already supported by several other planning algorithms in previous versions of OMPL.)
- Add support for [Spot](https://spot.lrde.epita.fr), a library that can be used to create finite automata from LTL specifications. This can be used by ompl::control::LTLPlanner. See the [LTL with triangulation demo](LTLWithTriangulation_8cpp_source.html).
- Added support for [Spot](https://spot.lrde.epita.fr), a library that can be used to create finite automata from LTL specifications. This can be used by ompl::control::LTLPlanner. See the [LTL with triangulation demo](LTLWithTriangulation_8cpp_source.html).
- A new method has been added, ompl::geometric::PathSimplifier::perturbPath, which can locally optimize a path with respect to a user-specified optimization objective. Existing methods of ompl::geometric::PathSimplifier are now also cost-aware.
- ompl::geometric::PathHybridization can now also optimize paths with respect to a user-specified optimization objective.
- Fix for bugs in path simplification and interpolation that could cause path simplification to produce a path that was invalid or longer than the original path when using GoalRegions (as opposed to just one GoalState).
......
......@@ -22,7 +22,7 @@ install_common_dependencies()
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get -y update
sudo apt-get -y install g++-5 cmake pkg-config libboost1.55-serialization-dev libboost1.55-filesystem-dev libboost1.55-system-dev libboost1.55-program-options-dev libboost1.55-test-dev libeigen3-dev libode-dev
sudo apt-get -y install g++-5 cmake pkg-config libboost-serialization1.55-dev libboost-filesystem1.55-dev libboost-system1.55-dev libboost-program-options1.55-dev libboost-test1.55-dev libeigen3-dev libode-dev
export CXX=g++-5
fi
export MAKEFLAGS="-j `nproc`"
......@@ -34,15 +34,19 @@ install_python_binding_dependencies()
# install additional python dependencies via pip
sudo -H pip${PYTHONV} install -vU pygccxml pyplusplus
# install castxml
if [[ $ubuntu_version < 1610 ]]; then
wget -O - https://data.kitware.com/api/v1/file/57b5dea08d777f10f2696379/download | tar zxf - -C ${HOME}
export PATH=$HOME/castxml/bin:$PATH
else
sudo apt-get -y install castxml
fi
if [[ $ubuntu_version > 1410 ]]; then
sudo apt-get -y install libboost-python-dev castxml
sudo apt-get -y install libboost-python-dev
if [[ $ubuntu_version > 1710 ]]; then
sudo apt-get -y install libboost-numpy-dev python${PYTHONV}-numpy
fi
else
sudo apt-get -y install libboost1.55-python-dev
wget -O - https://midas3.kitware.com/midas/download/item/318227/castxml-linux.tar.gz | tar zxf - -C $HOME
export PATH=$HOME/castxml/bin:$PATH
sudo apt-get -y install libboost-python1.55-dev
fi
}
......@@ -82,8 +86,8 @@ install_ompl()
else
OMPL="omplapp"
fi
wget -O - https://bitbucket.org/ompl/ompl/downloads/$OMPL-1.4.0-Source.tar.gz | tar zxf -
cd $OMPL-1.4.0-Source
wget -O - https://bitbucket.org/ompl/ompl/downloads/$OMPL-1.4.2-Source.tar.gz | tar zxf -
cd $OMPL-1.4.2-Source
mkdir -p build/Release
cd build/Release
cmake ../.. -DPYTHON_EXEC=/usr/bin/python${PYTHONV}
......
......@@ -22,7 +22,7 @@ install_common_dependencies()
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get -y update
sudo apt-get -y install g++-5 cmake pkg-config libboost1.55-serialization-dev libboost1.55-filesystem-dev libboost1.55-system-dev libboost1.55-program-options-dev libboost1.55-test-dev libeigen3-dev libode-dev
sudo apt-get -y install g++-5 cmake pkg-config libboost-serialization1.55-dev libboost-filesystem1.55-dev libboost-system1.55-dev libboost-program-options1.55-dev libboost-test1.55-dev libeigen3-dev libode-dev
export CXX=g++-5
fi
export MAKEFLAGS="-j `nproc`"
......@@ -34,15 +34,19 @@ install_python_binding_dependencies()
# install additional python dependencies via pip
sudo -H pip${PYTHONV} install -vU pygccxml pyplusplus
# install castxml
if [[ $ubuntu_version < 1610 ]]; then
wget -O - https://data.kitware.com/api/v1/file/57b5dea08d777f10f2696379/download | tar zxf - -C ${HOME}
export PATH=$HOME/castxml/bin:$PATH
else
sudo apt-get -y install castxml
fi
if [[ $ubuntu_version > 1410 ]]; then
sudo apt-get -y install libboost-python-dev castxml
sudo apt-get -y install libboost-python-dev
if [[ $ubuntu_version > 1710 ]]; then
sudo apt-get -y install libboost-numpy-dev python${PYTHONV}-numpy
fi
else
sudo apt-get -y install libboost1.55-python-dev
wget -O - https://midas3.kitware.com/midas/download/item/318227/castxml-linux.tar.gz | tar zxf - -C $HOME
export PATH=$HOME/castxml/bin:$PATH
sudo apt-get -y install libboost-python1.55-dev
fi
}
......
......@@ -70,7 +70,7 @@ class ompl_base_generator_t(code_generator_t):
""")
# A C++ call like "foo.printProperties(std::cout)" will be replaced with
# something more pythonesque: "print(foo.properties())"
default_replacement['printProperties'] = ('def("properties", &__printProperties)', """
replacement['printProperties'] = ('def("properties", &__printProperties)', """
std::string __printProperties(%s* obj)
{
std::ostringstream s;
......@@ -183,7 +183,6 @@ class ompl_base_generator_t(code_generator_t):
pairStateDouble.include()
# this operator seems to cause problems with g++-6
pairStateDouble.operators('=').exclude()
self.ompl_ns.member_functions('maybeWrapBool').exclude()
# rename some templated types
self.ompl_ns.class_('SpecificParam< bool >').rename('SpecificParamBool')
self.ompl_ns.class_('SpecificParam< char >').rename('SpecificParamChar')
......@@ -257,6 +256,9 @@ class ompl_base_generator_t(code_generator_t):
self.ompl_ns.member_functions('getValueLocations').exclude()
# don't export map<std::string, ValueLocation>
self.ompl_ns.member_functions('getValueLocationsByName').exclude()
# exclude member function for which there are multiple signatures
self.ompl_ns.class_('Goal').member_function('isSatisfied', arg_types=['::ompl::base::State const *', 'double *']).exclude()
# don't expose double*
self.ompl_ns.class_('RealVectorStateSpace').class_(
'StateType').variable('values').exclude()
......
......@@ -58,6 +58,7 @@ src/ompl/base/ConstrainedSpaceInformation.h
src/ompl/base/spaces/constraint/ProjectedStateSpace.h
src/ompl/base/samplers/BridgeTestValidStateSampler.h
src/ompl/base/samplers/GaussianValidStateSampler.h
src/ompl/base/samplers/MinimumClearanceValidStateSampler.h
src/ompl/base/samplers/MaximizeClearanceValidStateSampler.h
src/ompl/base/samplers/ObstacleBasedValidStateSampler.h
src/ompl/base/samplers/UniformValidStateSampler.h
......
......@@ -128,11 +128,11 @@ class code_generator_t(object):
self.heartbeat = threading.Thread(target=Heartbeat(60))
self.heartbeat.daemon = True
self.heartbeat.start()
xml_generator_config = parser.load_xml_generator_configuration("/Users/mmoll/build/ompl/Release/castxml.cfg")
xml_generator_config = parser.load_xml_generator_configuration("/Users/mmoll/build/omplapp/1.4.2/castxml.cfg")
self.mb = module_builder.module_builder_t(
files=['bindings/' + name + '.h'],
# cache is not used with compilation_mode = parser.COMPILATION_MODE.ALL_AT_ONCE
#cache = '/Users/mmoll/build/ompl/Release/pyplusplus_'+name+'.cache',
#cache = '/Users/mmoll/build/omplapp/1.4.2/pyplusplus_'+name+'.cache',
xml_generator_config=xml_generator_config,
start_with_declarations=['ompl::' + name],
compilation_mode=parser.COMPILATION_MODE.ALL_AT_ONCE,
......
FROM ubuntu:xenial
RUN apt-get -y update && \
apt-get install -y \
build-essential \
cmake \
castxml \
pkg-config \
libboost-serialization-dev \
libboost-filesystem-dev \
libboost-system-dev \
libboost-program-options-dev \
libboost-python-dev \
libboost-test-dev \
libflann-dev \
python-dev \
libode-dev \
libeigen3-dev \
python-pip && \
pip -v install pygccxml pyplusplus
COPY . /root/ompl
# Local Variables:
# mode: dockerfile
# End:
......@@ -40,13 +40,15 @@ from os.path import exists
import os
import sqlite3
import sys
from optparse import OptionParser
import argparse
from pathlib import Path
from warnings import warn
plottingEnabled = True
try:
import matplotlib
matplotlib.use('pdf')
from matplotlib import __version__ as matplotlibversion
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.cm import viridis
import matplotlib.pyplot as plt
import numpy as np
from math import floor
......@@ -60,17 +62,18 @@ except ImportError:
def readLogValue(filevar, desired_token_index, expected_tokens):
start_pos = filevar.tell()
tokens = filevar.readline().split()
for token_index in expected_tokens:
if not tokens[token_index] == expected_tokens[token_index]:
# undo the read, if we failed to parse.
filevar.seek(start_pos)
return None
if expected_tokens:
for token_index in expected_tokens:
if not tokens[token_index] == expected_tokens[token_index]:
# undo the read, if we failed to parse.
filevar.seek(start_pos)
return None
return tokens[desired_token_index]
def readOptionalLogValue(filevar, desired_token_index, expected_tokens={}):
def readOptionalLogValue(filevar, desired_token_index, expected_tokens=None):
return readLogValue(filevar, desired_token_index, expected_tokens)
def readRequiredLogValue(name, filevar, desired_token_index, expected_tokens={}):
def readRequiredLogValue(name, filevar, desired_token_index, expected_tokens=None):
result = readLogValue(filevar, desired_token_index, expected_tokens)
if result is None:
raise Exception("Unable to read " + name)
......@@ -122,7 +125,7 @@ def readBenchmarkLog(dbname, filenames, moveitformat):
(id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(512),
totaltime REAL, timelimit REAL, memorylimit REAL, runcount INTEGER,
version VARCHAR(128), hostname VARCHAR(1024), cpuinfo TEXT,
date DATETIME, seed INTEGER, setup TEXT);
date DATETIME, seed VARCHAR(24), setup TEXT);
CREATE TABLE IF NOT EXISTS plannerConfigs
(id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(512) NOT NULL, settings TEXT);
......@@ -157,9 +160,9 @@ def readBenchmarkLog(dbname, filenames, moveitformat):
{-2: "experiment", -1: "properties"}) or 0)
expprops = {}
for _ in range(nrexpprops):
entry = logfile.readline().strip().split('=')
entry = logfile.readline().strip().split(' = ')
nameAndType = entry[0].split(' ')
expprops[nameAndType[0]] = (entry[1], nameAndType[1])
expprops[''.join(nameAndType[:-1]).replace('-', '_')] = (entry[1], nameAndType[-1])
# adding columns to experiments table
c.execute('PRAGMA table_info(experiments)')
......@@ -174,15 +177,15 @@ def readBenchmarkLog(dbname, filenames, moveitformat):
if moveitformat:
expsetup = readRequiredLogValue("goal name", logfile, -1, {0: "Goal", 1: "name"})
cpuinfo = None
rseed = 0
rseed = '0'
timelimit = float(readRequiredLogValue("time limit", logfile, 0, \
{-3 : "seconds", -2 : "per", -1 : "run"}))
memorylimit = 0
else:
expsetup = readRequiredMultilineValue(logfile)
cpuinfo = readOptionalMultilineValue(logfile)
rseed = int(readRequiredLogValue("random seed", logfile, 0, \
{-2 : "random", -1 : "seed"}))
rseed = readRequiredLogValue("random seed", logfile, 0, \
{-2 : "random", -1 : "seed"})
timelimit = float(readRequiredLogValue("time limit", logfile, 0, \
{-3 : "seconds", -2 : "per", -1 : "run"}))
memorylimit = float(readRequiredLogValue("memory limit", logfile, 0, \
......@@ -190,13 +193,13 @@ def readBenchmarkLog(dbname, filenames, moveitformat):
nrrunsOrNone = readOptionalLogValue(logfile, 0, \
{-3 : "runs", -2 : "per", -1 : "planner"})
nrruns = -1
if nrrunsOrNone != None:
if nrrunsOrNone is not None:
nrruns = int(nrrunsOrNone)
totaltime = float(readRequiredLogValue("total time", logfile, 0, \
{-3 : "collect", -2 : "the", -1 : "data"}))
numEnums = 0
numEnumsOrNone = readOptionalLogValue(logfile, 0, {-2 : "enum"})
if numEnumsOrNone != None:
if numEnumsOrNone is not None:
numEnums = int(numEnumsOrNone)
for _ in range(numEnums):
enum = logfile.readline()[:-1].split('|')
......@@ -207,12 +210,15 @@ def readBenchmarkLog(dbname, filenames, moveitformat):
(enum[0], j, enum[j + 1]))
# Creating entry in experiments table
experimentEntries = [None, expname, totaltime, timelimit, memorylimit, nrruns, version,
expColNames = ['name', 'totaltime', 'timelimit', 'memorylimit', 'runcount', 'version',
'hostname', 'cpuinfo', 'date', 'seed', 'setup']
experimentEntries = [expname, totaltime, timelimit, memorylimit, nrruns, version,
hostname, cpuinfo, date, rseed, expsetup]
for name in sorted(expprops.keys()): # sort to ensure correct order
experimentEntries.append(expprops[name][0])
c.execute('INSERT INTO experiments VALUES (' + ','.join(
'?' for i in experimentEntries) + ')', experimentEntries)
expProps = expprops.keys()
expColNames += expProps
experimentEntries += [expprops[name][0] for name in expProps]
c.execute('INSERT INTO experiments (' + ','.join(expColNames) + ') VALUES (' +
','.join('?'*len(experimentEntries)) + ')', experimentEntries)
experimentId = c.lastrowid
numPlanners = int(readRequiredLogValue("planner count", logfile, 0, {-1 : "planners"}))
......@@ -277,7 +283,7 @@ def readBenchmarkLog(dbname, filenames, moveitformat):
# read progress properties and add columns as necesary
numProgressProperties = int(nextLine.split()[0])
progressPropertyNames = ['runid']
for i in range(numProgressProperties):
for _ in range(numProgressProperties):
field = logfile.readline().split()
progressPropertyType = field[-1]
progressPropertyName = "_".join(field[:-1])
......@@ -320,7 +326,7 @@ def plotAttribute(cur, planners, attribute, typename):
for planner in planners:
cur.execute('SELECT %s FROM runs WHERE plannerid = %s AND %s IS NOT NULL' \
% (attribute, planner[0], attribute))
measurement = [t[0] for t in cur.fetchall() if t[0] != None]
measurement = [t[0] for t in cur.fetchall() if t[0] is not None]
if measurement:
cur.execute('SELECT count(*) FROM runs WHERE plannerid = %s AND %s IS NULL' \
% (planner[0], attribute))
......@@ -347,7 +353,7 @@ def plotAttribute(cur, planners, attribute, typename):
ind = range(measurements.shape[1])
for i in rows:
plt.bar(ind, measurements[i], width, bottom=heights[0], \
color=matplotlib.cm.hot(int(floor(i * 256 / numValues))), \
color=viridis(int(floor(i * 256 / numValues))), \
label=descriptions[i])
heights = heights + measurements[i]
xtickNames = plt.xticks([x+width/2. for x in ind], labels, rotation=30)
......@@ -365,10 +371,7 @@ def plotAttribute(cur, planners, attribute, typename):
xtickNames = plt.xticks([x + width / 2. for x in ind], labels, rotation=30)
ax.set_ylabel(attribute.replace('_', ' ') + ' (%)')
else:
if int(matplotlibversion.split('.')[0]) < 1:
plt.boxplot(measurements, notch=0, sym='k+', vert=1, whis=1.5)
else:
plt.boxplot(measurements, notch=0, sym='k+', vert=1, whis=1.5, bootstrap=1000)
plt.boxplot(measurements, notch=0, sym='k+', vert=1, whis=1.5, bootstrap=1000)
ax.set_ylabel(attribute.replace('_', ' '))
xtickNames = plt.setp(ax, xticklabels=labels)
plt.setp(xtickNames, rotation=25)
......@@ -432,8 +435,11 @@ each planner."""
else:
plt.clf()
def plotStatistics(dbname, fname):
def plotStatistics(dbname):
"""Create a PDF file with box plots for all attributes."""
warn('\n\n\tThis functionality is considered deprecated and might be removed '
'in a future version.\n\tConsider using Planner Arena, '
'http://plannerarena.org.\n')
print("Generating plots...")
conn = sqlite3.connect(dbname)
c = conn.cursor()
......@@ -444,95 +450,92 @@ def plotStatistics(dbname, fname):
c.execute('PRAGMA table_info(runs)')
colInfo = c.fetchall()[3:]
pp = PdfPages(fname)
for col in colInfo:
if col[2] == 'BOOLEAN' or col[2] == 'ENUM' or \
col[2] == 'INTEGER' or col[2] == 'REAL':
plotAttribute(c, planners, col[1], col[2])
with PdfPages(Path(dbname).with_suffix('.pdf')) as pp:
for col in colInfo:
if col[2] == 'BOOLEAN' or col[2] == 'ENUM' or \
col[2] == 'INTEGER' or col[2] == 'REAL':
plotAttribute(c, planners, col[1], col[2])
pp.savefig(plt.gcf())
c.execute('PRAGMA table_info(progress)')
colInfo = c.fetchall()[2:]
for col in colInfo: