PropositionalDecomposition.h
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 #ifndef OMPL_CONTROL_PLANNERS_LTL_PROPOSITIONALDECOMPOSITION_
38 #define OMPL_CONTROL_PLANNERS_LTL_PROPOSITIONALDECOMPOSITION_
39 
40 #include "ompl/base/State.h"
41 #include "ompl/control/planners/syclop/Decomposition.h"
42 #include "ompl/control/planners/ltl/World.h"
43 #include "ompl/util/ClassForward.h"
44 #include "ompl/util/RandomNumbers.h"
45 #include "ompl/base/StateSampler.h"
46 #include <vector>
47 
48 namespace ompl
49 {
50  namespace control
51  {
53 
54  OMPL_CLASS_FORWARD(PropositionalDecomposition);
56 
63  class PropositionalDecomposition : public Decomposition
64  {
65  public:
69 
71  ~PropositionalDecomposition() override;
72 
74  virtual World worldAtRegion(int rid) = 0;
75 
76  /* \todo section off the below methods with a general description of
77  "wrapper methods that simply call the underlying decomposition */
78 
81  int getNumRegions() const override;
82 
84  virtual int getNumProps() const = 0;
85 
87  double getRegionVolume(int rid) override;
88 
91  int locateRegion(const base::State *s) const override;
92 
93  void project(const base::State *s, std::vector<double> &coord) const override;
94 
95  void getNeighbors(int rid, std::vector<int> &neighbors) const override;
96 
97  void sampleFromRegion(int rid, RNG &rng, std::vector<double> &coord) const override;
98 
99  void sampleFullState(const base::StateSamplerPtr &sampler, const std::vector<double> &coord,
100  base::State *s) const override;
101 
102  protected:
103  DecompositionPtr decomp_;
104  };
105  }
106 }
107 #endif
double getRegionVolume(int rid) override
Returns the volume of a given region.
virtual int getNumProps() const =0
Returns the number of propositions in this propositional decomposition.
int getNumRegions() const override
Returns the number of regions in this propositional decomposition's underlying decomposition.
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.
~PropositionalDecomposition() override
Clears all memory belonging to this propositional decomposition.
void getNeighbors(int rid, std::vector< int > &neighbors) const override
Stores a given region's neighbors into a given vector.
PropositionalDecomposition(const DecompositionPtr &decomp)
Creates a propositional decomposition wrapped around a given decomposition with a given number of pro...
A shared pointer wrapper for ompl::control::Decomposition.
void sampleFromRegion(int rid, RNG &rng, std::vector< double > &coord) const override
Samples a projected coordinate from a given region.
int locateRegion(const base::State *s) const override
Returns the region of the underlying decomposition that contains a given State.
virtual World worldAtRegion(int rid)=0
Returns the World corresponding to 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.
Main namespace. Contains everything in this library.
Definition: AppBase.h:21