EstimateDiameter.hpp
Go to the documentation of this file.
00001 // ========================================================================================
00002 //  ApproxMVBB
00003 //  Copyright (C) 2014 by Gabriel Nützi <nuetzig (at) imes (d0t) mavt (d0t) ethz (døt) ch>
00004 //
00005 //  This Source Code Form is subject to the terms of the Mozilla Public
00006 //  License, v. 2.0. If a copy of the MPL was not distributed with this
00007 //  file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008 // ========================================================================================
00009 #ifndef ApproxMVBB_Diameter_EstimateDiameter_hpp
00010 #define ApproxMVBB_Diameter_EstimateDiameter_hpp
00011 
00012 #include "ApproxMVBB/Diameter/TypeSegment.hpp"
00013 #include "ApproxMVBB/RandomGenerators.hpp"
00014 
00015 #include <random>
00016 
00017 namespace ApproxMVBB{
00018 
00023 class APPROXMVBB_EXPORT DiameterEstimator{
00024     public:
00025 
00026     DiameterEstimator(std::size_t seed = RandomGenerators::defaultSeed) : m_gen(seed) {}
00027 
00038     double estimateDiameter(Diameter::TypeSegment *theDiam,
00039                           double const**theList,
00040                           const int first,
00041                           const int last,
00042                           const int dim,
00043                           double epsilon);
00044 
00045     private:
00046 
00047     double estimateDiameterInOneList(Diameter::TypeSegment *theDiam,
00048                                      double const**theList,
00049                                      const int first,
00050                                      const int last,
00051                                      const int dim,
00052                                      double _epsilon_ );
00053 
00054 
00057     int _verbose_when_reducing_ = 0;
00058     inline void _VerboseWhenReducing(){ _verbose_when_reducing_ = 1; }
00059     inline void _NoVerboseWhenReducing(){ _verbose_when_reducing_ = 0;}
00060     inline int _GetVerboseWhenReducing(){ return _verbose_when_reducing_ ;}
00061 
00062 
00064     int _reduction_mode_in_iterative_ = 1;
00065     inline void _SetReductionModeInIterative( int m )
00066     {
00067       switch ( m ) {
00068       case 0 :
00069       case 1 :
00070         _reduction_mode_in_iterative_ = m;
00071         break;
00072       case 2 :
00073       default :
00074         break;
00075       }
00076     }
00077     inline int _GetReductionModeInIterative(){return _reduction_mode_in_iterative_ ;}
00078 
00080     int _reduction_mode_of_diameter_ = 1;
00081     inline void _SetReductionModeOfDiameter( int m )
00082     {
00083       switch ( m ) {
00084       case 0 :
00085       case 1 :
00086       case 2 :
00087         _reduction_mode_of_diameter_ = m;
00088         break;
00089       default :
00090         break;
00091       }
00092     }
00093     int _GetReductionModeOfDiameter(){return _reduction_mode_of_diameter_; }
00094 
00095     /* 'reduction' of double normals
00096      */
00097     int _reduction_mode_of_dbleNorm_ = 1;
00098     inline void _SetReductionModeOfDbleNorm( int m )
00099     {
00100       switch ( m ) {
00101       case 0 :
00102       case 1 :
00103       case 2 :
00104         _reduction_mode_of_dbleNorm_ = m;
00105         break;
00106       default :
00107         break;
00108       }
00109     }
00110     inline int _GetReductionModeOfDbleNorm(){return _reduction_mode_of_dbleNorm_ ;}
00111 
00112     /* reduction by processing couple of double normals
00113      */
00114     int _try_to_reduce_Q_ = 1;
00115 
00116     inline void _DoTryToReduceQ() { _try_to_reduce_Q_ = 1;}
00117     inline void _DoNotTryToReduceQ(){ _try_to_reduce_Q_ = 0;}
00118     inline int _GetTryToReduceQ(){return _try_to_reduce_Q_ ; }
00119 
00120 
00121     int _Q_scan_ = 0;
00122     inline void _SetQscanToForward(){ _Q_scan_ = 1;}
00123     inline void _SetQscanToBackward(){ _Q_scan_ = 0;}
00124     inline int _GetQscan(){return _Q_scan_ ;}
00125 
00126 
00127     int _tight_bounds_ = 0;
00128     inline void _DoTryToGetTightBounds(){ _tight_bounds_ = 1;}
00129     inline void _DoNotTryToGetTightBounds(){ _tight_bounds_ = 0;}
00130     inline int _GetTightBounds(){ return _tight_bounds_ ; }
00133     RandomGenerators::DefaultRandomGen m_gen; 
00134     
00136     int getRandomInt( unsigned int min, unsigned int max ){
00137       if ( min <= max ){
00138         return static_cast<int>(RandomGenerators::DefaultUniformUIntDistribution<unsigned int>{min,max}(m_gen));
00139       }else{
00140         return static_cast<int>(RandomGenerators::DefaultUniformUIntDistribution<unsigned int>{max,min}(m_gen));
00141       }
00142     }
00143 
00144 };
00145 }
00146 
00147 #endif


asr_approx_mvbb
Author(s): Gassner Nikolai
autogenerated on Sat Jun 8 2019 20:21:49