Hybrid Query Processing Engine for Coprocessing in Database Systems
HyPE
|
00001 00002 #include <config/configuration.hpp> 00003 00004 #include <core/algorithm.hpp> 00005 #include <core/recomputation_heuristic.hpp> 00006 00007 00008 namespace hype{ 00009 namespace core{ 00010 00011 RecomputationHeuristic_Internal::RecomputationHeuristic_Internal(const std::string& name) : name_(name), length_of_training_phase_(Runtime_Configuration::instance().getTrainingLength()),is_initial_approximation_function_computed_(false),samplecounter_(1) {} 00012 00013 bool RecomputationHeuristic_Internal::recompute(Algorithm& algorithm){ 00014 if(is_initial_approximation_function_computed_){ 00015 return this->internal_recompute(algorithm); 00016 }else{ 00017 if(!quiet && verbose && debug) 00018 { 00019 std::cout << "[DEBUG]: initial Training phase of algortihm '" << algorithm.getName() 00020 << "' step " << samplecounter_ << "/" << length_of_training_phase_ << std::endl; 00021 } 00022 if(samplecounter_++>=length_of_training_phase_){ 00023 is_initial_approximation_function_computed_=true; 00024 return true; 00025 }else{ 00026 return false; 00027 } 00028 } 00029 } 00030 00031 const std::tr1::shared_ptr<RecomputationHeuristic_Internal> getNewRecomputationHeuristicbyName(std::string name_of_recomputation_heuristic){ 00032 //RecomputationHeuristicFactorySingleton::Instance().Register() 00033 //RecomputationHeuristicFactorySingleton::Instance() 00034 RecomputationHeuristic_Internal* ptr = RecomputationHeuristicFactorySingleton::Instance().CreateObject(name_of_recomputation_heuristic); //.( 1, createProductNull ); 00035 return std::tr1::shared_ptr<RecomputationHeuristic_Internal> (ptr); 00036 } 00037 00038 RecomputationHeuristicFactory& RecomputationHeuristicFactorySingleton::Instance() 00039 { 00040 static RecomputationHeuristicFactory factory; 00041 return factory; 00042 } 00043 }; //end namespace core 00044 }; //end namespace hype 00045