NLToolbox
src/include/Box.h
00001 /*
00002  * Box.h
00003  *
00004  *  Created on: Nov 20, 2012
00005  *      Author: romain
00006  */
00007 
00008 #ifndef BOX_H_
00009 #define BOX_H_
00010 
00011 #include "Set.h"
00012 #include "utils.h"
00013 //#include "Hpolyhedron.h"
00014 #include "PolynomialSystem.h"
00015 
00016 namespace nltool {
00017 
00018 class Hpolyhedron;
00019 
00020 class Box: public Set {
00021 public:
00022 
00026         Box();
00027 
00033         Box(const stdVector& l, const stdVector& u);
00034 
00041         Box(unsigned dim, const Vertices& vertices);
00042 
00050         Box(unsigned dim, const Template& A, const Vector& b);
00051 
00056         Box(Hpolyhedron& poly);
00057 
00061         virtual ~Box();
00062 
00070         Number optimize(const Vector & direction, Vector & optPoint,
00071                         bool max = true);
00072 
00077         Vertices generateVertices();
00078 
00083         Vector centroid();
00084 
00090         std::vector<Polynom> computeUnitBoxMap();
00091 
00097         bool include(Hpolyhedron& poly);
00098 
00103         Number getMaxInterval();
00104 
00109         Number getMinInterval();
00110 
00111         /*
00112          * ##########################################
00113          * GETTTERS and SETTERS
00114          * ##########################################
00115          */
00116 
00117         stdVector getBl() const;
00118         stdVector getBu() const;
00119         void setBl(stdVector bl);
00120         void setBu(stdVector bu);
00121 
00122 private:
00123         stdVector bl;
00124         stdVector bu;
00125 };
00126 
00127 inline std::ostream& operator<<(std::ostream& out, Box box) {
00128         stdVector bl = box.getBl();
00129         stdVector bu = box.getBu();
00130         for (unsigned i = 0; i < box.getDimension(); i++) {
00131                 out << "[" << bl[i] << ", " << bu[i] << "]";
00132                 if (i < (box.getDimension() - 1))
00133                         out << " * ";
00134         }
00135         out << std::endl;
00136 
00137         return out;
00138 }
00139 
00140 } // namespace nltool
00141 
00142 #endif /* BOX_H_ */
 All Classes Namespaces Functions