Column-oriented GPU-accelerated Database Management System
CoGaDB
/home/sebastian/gpudbms/trunk/hype-library/include/core/algorithm.hpp
Go to the documentation of this file.
00001 /***********************************************************************************************************
00002 Copyright (c) 2012, Sebastian Breß, Otto-von-Guericke University of Magdeburg, Germany. All rights reserved.
00003 
00004 This program and accompanying materials are made available under the terms of the 
00005 GNU LESSER GENERAL PUBLIC LICENSE - Version 3, http://www.gnu.org/licenses/lgpl-3.0.txt
00006 ***********************************************************************************************************/
00007 #pragma once
00008 
00009 #include <config/global_definitions.hpp>
00010 
00011 #include <memory>
00012 #include <vector>
00013 #include <core/specification.hpp>
00014 #include <core/statistical_method.hpp>
00015 #include <core/recomputation_heuristic.hpp>
00016 #include <core/time_measurement.hpp>
00017 #include <core/algorithm_statistics.hpp>
00018 #include <core/loadchange_estimator.hpp>
00022 namespace hype{
00026         namespace core{
00027 
00028 //forward declaration
00029 class Operation;
00030 
00049                 class Algorithm{
00050 
00051                         public:
00057                         Algorithm(const std::string& name_of_algorithm, 
00058                                                  const std::string& name_of_statistical_method, 
00059                                                  const std::string& name_of_recomputation_strategy,
00060                                                  Operation& operation,
00061                                                  DeviceSpecification comp_dev);
00062                                                  
00065                         ~Algorithm();
00066 
00067                         bool setStatisticalMethod(std::tr1::shared_ptr<StatisticalMethod_Internal> ptr_statistical_method);
00068 
00069                         bool setRecomputationHeuristic(std::tr1::shared_ptr<RecomputationHeuristic_Internal> ptr_recomp_heuristic);
00070 
00071                         const std::string getName() const; 
00072 
00073                         const EstimatedTime getEstimatedExecutionTime(const Tuple& input_values);
00074         
00075                         unsigned int getNumberOfDecisionsforThisAlgorithm() const throw();              
00076                         unsigned int getNumberOfTerminatedExecutions() const throw();
00078                         double getTotalExecutionTime() const throw();
00079 
00080                         bool addMeasurementPair(const MeasurementPair& mp);
00081 
00082                         AlgorithmStatistics& getAlgorithmStatistics(){
00083                                 return statistics_;
00084                         }
00085                         
00090                         bool inTrainingPhase() const throw();
00095                         bool inRetrainingPhase() const throw();
00096                         uint64_t getTimeOfLastExecution() const throw();
00097                         void setTimeOfLastExecution(uint64_t new_timestamp) throw();
00098                         void incrementNumberofDecisionsforThisAlgorithm() throw();
00099         
00100                         void retrain();
00101                         const LoadChangeEstimator& getLoadChangeEstimator() const throw();
00102                         const DeviceSpecification getDeviceSpecification() const throw(); 
00103 
00104                         private:
00105                         std::string name_;
00106                         std::tr1::shared_ptr<StatisticalMethod_Internal> ptr_statistical_method_;
00107                         std::tr1::shared_ptr<RecomputationHeuristic_Internal> ptr_recomputation_heristic_;
00108                         AlgorithmStatistics statistics_;
00109                         Operation& operation_;
00110                         uint64_t logical_timestamp_of_last_execution_;
00111                         bool is_in_retraining_phase_;
00112                         unsigned int retraining_length_;
00113                         LoadChangeEstimator load_change_estimator_;
00114                         DeviceSpecification comp_dev_;
00115                         
00116                 };
00117 
00118         typedef std::tr1::shared_ptr<Algorithm> AlgorithmPtr;
00119 
00120         }; //end namespace core
00121 }; //end namespace hype
00122 
00123 
00124 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines