Loading...
Searching...
No Matches
PropositionalDecomposition.cpp
1/*********************************************************************
2* Software License Agreement (BSD License)
3*
4* Copyright (c) 2012, Rice University
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions
9* are met:
10*
11* * Redistributions of source code must retain the above copyright
12* notice, this list of conditions and the following disclaimer.
13* * Redistributions in binary form must reproduce the above
14* copyright notice, this list of conditions and the following
15* disclaimer in the documentation and/or other materials provided
16* with the distribution.
17* * Neither the name of the Rice University nor the names of its
18* contributors may be used to endorse or promote products derived
19* from this software without specific prior written permission.
20*
21* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32* POSSIBILITY OF SUCH DAMAGE.
33*********************************************************************/
34
35/* Author: Matt Maly */
36
37#include "ompl/control/planners/ltl/PropositionalDecomposition.h"
38#include "ompl/base/State.h"
39#include "ompl/control/planners/syclop/Decomposition.h"
40#include "ompl/control/planners/ltl/World.h"
41#include "ompl/util/ClassForward.h"
42#include "ompl/util/RandomNumbers.h"
43#include "ompl/base/StateSampler.h"
44#include <vector>
45
47 : Decomposition(decomp->getDimension(), decomp->getBounds()), decomp_(decomp)
48{
49}
50
52
54{
55 return decomp_->getNumRegions();
56}
57
59{
60 return decomp_->getRegionVolume(rid);
61}
62
64{
65 return decomp_->locateRegion(s);
66}
67
68void ompl::control::PropositionalDecomposition::project(const base::State *s, std::vector<double> &coord) const
69{
70 return decomp_->project(s, coord);
71}
72
73void ompl::control::PropositionalDecomposition::getNeighbors(int rid, std::vector<int> &neighbors) const
74{
75 decomp_->getNeighbors(rid, neighbors);
76}
77
78void ompl::control::PropositionalDecomposition::sampleFromRegion(int rid, RNG &rng, std::vector<double> &coord) const
79{
80 decomp_->sampleFromRegion(rid, rng, coord);
81}
82
83void ompl::control::PropositionalDecomposition::sampleFullState(const base::StateSamplerPtr &sampler,
84 const std::vector<double> &coord, base::State *s) const
85{
86 decomp_->sampleFullState(sampler, coord, s);
87}
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition of an abstract state.
Definition State.h:50
A shared pointer wrapper for ompl::control::Decomposition.
A Decomposition is a partition of a bounded Euclidean space into a fixed number of regions which are ...
void sampleFullState(const base::StateSamplerPtr &sampler, const std::vector< double > &coord, base::State *s) const override
Samples a State using a projected coordinate and a StateSampler.
void getNeighbors(int rid, std::vector< int > &neighbors) const override
Stores a given region's neighbors into a given vector.
double getRegionVolume(int rid) override
Returns the volume of a given region.
int getNumRegions() const override
Returns the number of regions in this propositional decomposition's underlying decomposition.
void sampleFromRegion(int rid, RNG &rng, std::vector< double > &coord) const override
Samples a projected coordinate from a given region.
void project(const base::State *s, std::vector< double > &coord) const override
Project a given State to a set of coordinates in R^k, where k is the dimension of this Decomposition.
int locateRegion(const base::State *s) const override
Returns the region of the underlying decomposition that contains a given State.
~PropositionalDecomposition() override
Clears all memory belonging to this propositional decomposition.
PropositionalDecomposition(const DecompositionPtr &decomp)
Creates a propositional decomposition wrapped around a given decomposition with a given number of pro...