NLToolbox
src/include/ReachHybridization.h
00001 /*
00002  * ReachHybridization.h
00003  *
00004  *  Created on: Jan 9, 2013
00005  *      Author: romain
00006  */
00007 
00008 #ifndef REACHHYBRIDIZATION_H_
00009 #define REACHHYBRIDIZATION_H_
00010 
00011 #include "utils.h"
00012 #include "ReachLinear.h"
00013 #include "Hpolyhedron.h"
00014 #include "ApproximationBuilder.h"
00015 
00016 namespace nltool {
00017 
00018 class ReachHybridization {
00019 public:
00020 
00021         struct HybridizationElement {
00022                 HybridizationElement(Hpolyhedron s, ReachLinear a, Hpolyhedron d) :
00023                                 set(s), approximation(a), domain(d), steps(0) {
00024                 }
00025                 Hpolyhedron set;
00026                 ReachLinear approximation;
00027                 Hpolyhedron domain;
00028                 int steps;
00029         };
00030 
00038         ReachHybridization(DynamicalSystem* nonLinearSystem, Hpolyhedron initialSet,
00039                         Number error, Number dt);
00040 
00044         virtual ~ReachHybridization();
00045 
00050         void reach(int nbstep = 1);
00051 
00052         // Getters and Setters
00053 
00054         Number getDiscretizationTime() const {
00055                 return discretizationTime;
00056         }
00057 
00058         void setDiscretizationTime(Number discretizationTime) {
00059                 this->discretizationTime = discretizationTime;
00060         }
00061 
00062         Number getErrorBound() const {
00063                 return errorBound;
00064         }
00065 
00066         void setErrorBound(Number errorBound) {
00067                 this->errorBound = errorBound;
00068         }
00069 
00070         std::vector<Hpolyhedron> getReachabilityResult() const {
00071                 return reachabilityResult;
00072         }
00073 
00074         std::vector<Hpolyhedron> getDomainsCreated() const {
00075                 return domainsCreated;
00076         }
00077 
00078         std::vector<std::vector<HybridizationElement> > getHybElementsResult() const {
00079                 return hybElementsResult;
00080         }
00081 
00082 private:
00083 
00084         void createApproximation(Hpolyhedron& initialSet,
00085                         std::vector<HybridizationElement>& result, bool requireSplitting =
00086                                         false);
00087 
00088         std::vector<HybridizationElement> currentState;
00089         DynamicalSystem* originalSystem;
00090 
00091         ApproximationBuilder approximationBuilder;
00092         Number errorBound;
00093         Number discretizationTime;
00094         Number curvatureDomainSize;
00095 
00096         std::vector<std::vector<HybridizationElement> > hybElementsResult;
00097         std::vector<Hpolyhedron> reachabilityResult;
00098         std::vector<Hpolyhedron> domainsCreated;
00099 };
00100 
00101 void checkErrorBound(Number errorBound, LinearSystem& approximation, DynamicalSystem& originalSystem,
00102                 Hpolyhedron domain);
00103 
00104 }  // namespace nltool
00105 
00106 #endif /* REACHHYBRIDIZATION_H_ */
 All Classes Namespaces Functions