crown  1.0.0
include/crown/CrownCompositeAnnealing.hpp
Go to the documentation of this file.
00001 /*
00002  Copyright 2015 Nicolas Melot
00003 
00004  This file is part of Pelib.
00005 
00006  Pelib is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  Pelib is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with Pelib. If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 #include <crown/CrownComposite.hpp>
00021 #include <crown/CrownMapping.hpp>
00022 #include <crown/CrownScaling.hpp>
00023 
00024 #ifndef CROWN_COMPOSITE_ANNEALING
00025 #define CROWN_COMPOSITE_ANNEALING
00026 
00027 namespace pelib
00028 {
00029 namespace crown
00030 {
00031         class CrownCompositeAnnealing : public CrownComposite
00032         {
00033                 public:
00034                         CrownCompositeAnnealing(float init_temperature = default_init_temperature, float cooling_factor = default_cooling_factor, float final_temperature = default_final_temperature, float max_transformations = default_max_transformations, float max_new_states = default_max_new_states, float distance = default_distance, const CrownScheduler *coreScheduler = NULL, const CrownMapping *map = NULL, const CrownScaling *scale = NULL, bool showOutput = false, bool showError = false);
00035                         CrownCompositeAnnealing(const Algebra &param, float init_temperature = default_init_temperature, float cooling_factor = default_cooling_factor, float final_temperature = default_final_temperature, float max_transformations = default_max_transformations, float max_new_states = default_max_new_states, float distance = default_distance, const CrownScheduler *coreScheduler = NULL, const CrownMapping *map = NULL, const CrownScaling *scale = NULL, bool showOutput = false, bool showError = false);
00036                         CrownCompositeAnnealing(const Taskgraph &tg, const Platform &pt, const Algebra &param, float init_temperature = default_init_temperature, float cooling_factor = default_cooling_factor, float final_temperature = default_final_temperature, float max_transformations = default_max_transformations, float max_new_states = default_max_new_states, float distance = default_distance, const CrownScheduler *coreScheduler = NULL, const CrownMapping *map = NULL, const CrownScaling *scale = NULL, bool showOutput = false, bool showError = false);
00037                         CrownCompositeAnnealing(const CrownCompositeAnnealing&);
00038 
00039                         Schedule schedule(const Taskgraph &tg, const Platform &pt, std::map<const string, double>&) const;
00040                         Schedule schedule(const Taskgraph &tg, const Platform &pt, const Algebra &param, std::map<const string, double>&) const;
00041                         Algebra solve(const Algebra &tg, const Algebra &pt, const pelib::Algebra &param, std::map<const std::basic_string<char>, double> &statistics) const;
00042                         virtual float complexity(const Algebra &problem) const;
00043                         virtual float complexity(const Taskgraph&, const Platform&, const Algebra&) const;
00044                         std::string getShortDescription() const;
00045                         virtual CrownCompositeAnnealing* clone() const;
00046 
00047                         static const float default_init_temperature;
00048                         static const float default_cooling_factor;
00049                         static const float default_final_temperature;
00050                         static const float default_max_transformations;
00051                         static const float default_max_new_states;
00052                         static const float default_distance;
00053 
00054                         // TODO: break into external classes    
00055                         static float energy(const Algebra &rec);
00056                 protected:
00057                         Algebra neighbor(const Algebra &solution, float tasks = 1, float cores = 1) const;
00058                         float init_temperature, cooling_factor, final_temperature, max_transformations, max_new_states, distance;
00059                         const CrownMapping *mapping;
00060                         const CrownScaling *scaling;
00061                 private:
00062                         void initialize(const CrownMapping *mapping = NULL, const CrownScaling *scaling = NULL);
00063         };
00064 }
00065 }
00066 #endif