KrisLibrary  1.0.0
CSet.h
1 #ifndef PLANNING_CSET_H
2 #define PLANNING_CSET_H
3 
4 #include <KrisLibrary/math/vector.h>
5 #include <functional>
6 
7 namespace Optimization {
8  class NonlinearProgram;
9 } //namespace Math
10 using namespace Math;
11 typedef Vector Config;
12 
20 class CSet
21 {
22 public:
23  #if __cplusplus > 199711L || _MSC_VER >= 1900
24  typedef std::function<bool(const Config&)> CPredicate;
25  typedef bool (*PREDICATE_FUNCTION_PTR) (const Config&);
26  #else
27  typedef bool (*CPredicate) (const Config&);
28  #endif //C++11
29 
30  CSet();
31  CSet(CPredicate f);
32  #if __cplusplus > 199711L || _MSC_VER >= 1900
33  CSet(PREDICATE_FUNCTION_PTR f);
34  #endif
35  virtual ~CSet () {}
37  virtual int NumDimensions() const { return -1; }
39  virtual bool Contains(const Config& x);
42  virtual bool Project(Config& x) { return Contains(x); }
43 
45  virtual bool IsSampleable() const { return false; }
46 
48  virtual void Sample(Config& x) {}
49 
52  virtual Optimization::NonlinearProgram* Numeric() { return NULL; }
53 
55  virtual bool IsConvex() const { return false; }
56 
59  virtual Real ObstacleDistance(const Config& x) { return -Inf; }
60 
61  CPredicate test;
62 };
63 
64 #endif
Namespace for classes and functions in the Optimization package.
Definition: CSet.h:7
virtual int NumDimensions() const
Returns the number of dimensions this accepts (-1) for all dimensions.
Definition: CSet.h:37
Vector Config
an alias for Vector
Definition: RobotKinematics3D.h:14
virtual bool IsSampleable() const
If true, the Sample() function is implemented.
Definition: CSet.h:45
virtual bool IsConvex() const
If true, the feasible set is convex with respect to the CSpace&#39;s interpolation function.
Definition: CSet.h:55
virtual Real ObstacleDistance(const Config &x)
Definition: CSet.h:59
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12
virtual Optimization::NonlinearProgram * Numeric()
Definition: CSet.h:52
virtual bool Project(Config &x)
Definition: CSet.h:42
A structure defining a nonlinear program.
Definition: NonlinearProgram.h:22
virtual void Sample(Config &x)
If IsSampleable is true, draws a config at random from the set.
Definition: CSet.h:48
A subset of a CSpace, which establishes a constraint for a configuration must meet. Mathematically, this is a set S which imposes the constraint [q in S].
Definition: CSet.h:20