ocra-recipes
Doxygen documentation for the ocra-recipes repository
IFunctionProperties.h
Go to the documentation of this file.
1 
12 #ifndef _OCRABASE_IFUNCTION_PROPERTIES_H_
13 #define _OCRABASE_IFUNCTION_PROPERTIES_H_
14 
15 #ifdef WIN32
16 # pragma once
17 #endif
18 
19 #include <string>
20 #include <vector>
21 
27 namespace ocra
28 {
31  {
37  CONTINUITY_CINF = 0xfff-1,
39  };
40 
43  {
44  LINEARITY_CONSTANT, //< \f$ f(x)=a \f$, \f$ a \in R^m \f$
45  LINEARITY_LINEAR, //< \f$ f(x)=Ax+b \f$, \f$ A \in R^{m \times n} \f$, \f$ b \in R^m \f$
46  LINEARITY_QUADRATIC, //< \f$ f_i(x)=x^T P_i x + q_i^T x + r_i \f$, \f$ P_i \in S^n \f$, \f$ q_i \in R^n \f$, \f$ r_i \in R \f$
47  LINEARITY_LINEAR_FRACTIONAL, //< \f$ f_i(x)=\frac{a_i^T x + b_i}{c_i^T x + d_i} \f$, \f$ a_i, c_i \in R^n \f$, \f$ b_i, d_i \in R \f$, \f$ c_i^T x + d_i>0 \f$
49  };
50 
53  {
54  CONVEXITY_CONVEX, //< \f$ D_f \f$ is convex and \f$ f(tx+(1-u)y \leq tf(x)+(1-u)f(y) \f$, with \f$ u \in \left[0,1\right] \f$
55  CONVEXITY_STRICTLY_CONVEX, //< \f$ D_f \f$ is convex and \f$ f(tx+(1-u)y < tf(x)+(1-u)f(y) \f$, with \f$ u \in \left[0,1\right] \f$
56  CONVEXITY_CONCAVE, //< \f$ -f \f$ is convex
57  CONVEXITY_STRICTLY_CONCAVE, //< \f$ -f \f$ is stricly convex
58  CONVEXITY_CONVEX_AND_CONCAVE, //< \f$ f \f$ is linear
59  CONVEXITY_LOG_CONVEX, //< \f$ f>0 \f$ and \f$ \log f \f$ is convex
60  CONVEXITY_LOG_CONCAVE, //< \f$ f>0 \f$ and \f$ \log f \f$ is concave
61  CONVEXITY_QUASICONVEX, //< \f$ D_f \f$ is convex and all \f$ S_{\alpha} = {x \in D_f | f(x) \leq \alpha} \f$ are convex
62  CONVEXITY_QUASICONCAVE, //< \f$ -f \f$ is quasiconvex
63  CONVEXITY_QUASILINEAR, //< \f$ f \f$ is quasiconvex and quasiconcave
65  };
66 
67 
75  {
76  protected:
87  eFunctionConvexity convexity = CONVEXITY_UNDEFINED, int continuity = CONTINUITY_UNKNOWN,
88  bool explicitlyTimeDependant=false, bool separableTimeDependancy = true);
89 
90  private:
94  IFunctionProperties& operator= (const IFunctionProperties&);
96 
97  public:
98 
101  eFunctionLinearity getType(void) const;
103  int getContinuityProperty(void) const;
104  const std::string& getProperty(int i) const;
105  int getNumberOfProperties(void) const;
106  bool hasProperty(const std::string& functionProperty) const;
107  bool isExplicitlyTimeDependant(void) const;
109 
113  bool hasSeparableTimeDependancy(void) const;
114 
115 
116 
117  protected:
119  void changeType(eFunctionLinearity newType);
120 
123 
128  void changeContinuityProperty(int newProperty);
129 
133  void addProperty(const std::string& functionProperty);
134 
140  void removeProperty(const std::string& functionProperty);
141 
143  void changeExplicitTimeDependancy(bool b);
144 
148  void changeSeparableTimeDependancy(bool b);
149 
150 
151 
152  private:
153  eFunctionLinearity _type; //< linearity
154  eFunctionConvexity _convexityProperty; //< convexity
155  int _continuityProperty; //< continuity
156  std::vector<std::string> _properties; //< for additional properties aside from continuity, convexity and linearity
157  bool _timeDependant; //< explicit time dependancy
158  bool _separableTimeDependancy; //< true if f can be written g(x)+h(t)
159  };
160 }
161 
162 #endif //_OCRABASE_IFUNCTION_PROPERTIES_H_
163 
164 // cmake:sourcegroup=Function
void addProperty(const std::string &functionProperty)
eFunctionConvexity getConvexityProperty(void) const
const std::string & getProperty(int i) const
void removeProperty(const std::string &functionProperty)
int getContinuityProperty(void) const
void changeType(eFunctionLinearity newType)
IFunctionProperties(eFunctionLinearity linearity=LINEARITY_UNDEFINED, eFunctionConvexity convexity=CONVEXITY_UNDEFINED, int continuity=CONTINUITY_UNKNOWN, bool explicitlyTimeDependant=false, bool separableTimeDependancy=true)
IFunctionProperties Constructor.
bool hasProperty(const std::string &functionProperty) const
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
int getNumberOfProperties(void) const
bool hasSeparableTimeDependancy(void) const
eFunctionLinearity getType(void) const
bool isExplicitlyTimeDependant(void) const
void changeConvexityProperty(eFunctionConvexity newProperty)
void changeContinuityProperty(int newProperty)