#include <GeneticAlgorithm.h>
Public Member Functions | |
Solution (DREAM::System *system_ptr) | |
Creates a solution corresponding to the System. | |
virtual | ~Solution () |
Destructor. | |
bool | deterministic () |
Returns true if the schedule corresponding to the Schedule is deterministic. | |
virtual double | fitness (bool verbose, bool deterministic, double *endtoend=NULL) |
Calculates how good the current solution is. | |
virtual void | generate_priorities () |
Generates random solution for the System. | |
virtual void | generate_subpriorities () |
Generates random solution for the System. | |
virtual void | regenerate_priorities () |
Regenerates random solution. | |
virtual void | regenerate_subpriorities () |
Regenerates random solution. | |
void | visitor (std::string &out) |
Produces nice output from the Solution. | |
Protected Attributes | |
bool | copy_ |
Flag which stores when the new task AVL tree copy is created. | |
double | fitness_ |
Stores the fitness of the Solution. | |
DREAM::TASK_AVLTREE | task_avltree_ |
Map storing all the Tasks in the System. | |
DREAM::System * | system_ptr_ |
Pointer to the system. | |
Friends | |
class | GeneticOptimize |
class | ModelCheck |
struct | sort_solutions |
std::ostream & | operator<< (std::ostream &out, DREAM::Solution &solution) |
Definition at line 67 of file GeneticAlgorithm.h.
DREAM::Solution::Solution | ( | DREAM::System * | system_ptr | ) |
Creates a solution corresponding to the System.
Definition at line 75 of file GeneticAlgorithm.cpp.
References system_ptr_, task_avltree_, and DREAM::System::visitor_task_avltree().
DREAM::Solution::~Solution | ( | ) | [virtual] |
Destructor.
Definition at line 82 of file GeneticAlgorithm.cpp.
References copy_, DREAM::AVLTree< key_type, item_type >::destroy(), and task_avltree_.
bool DREAM::Solution::deterministic | ( | ) |
Returns true if the schedule corresponding to the Schedule is deterministic.
The function is conservative - it might return false for some deterministic systems but not the other way.
Definition at line 88 of file GeneticAlgorithm.cpp.
References DREAM::AVLTree< key_type, item_type >::begin(), DREAM::AVLTree< key_type, item_type >::end(), and task_avltree_.
Referenced by DREAM::ModelCheck::trace_based_model_check().
double DREAM::Solution::fitness | ( | bool | verbose, | |
bool | deterministic, | |||
double * | endtoend = NULL | |||
) | [virtual] |
Calculates how good the current solution is.
verbose | specifies whether simulation messages will be supressed or not. | |
deterministic | specifies whether randomness is allowed. | |
endtoend | updates the pointer's target with the end-to-end execution time of the model (unless the pointer is NULL). |
Definition at line 107 of file GeneticAlgorithm.cpp.
References DREAM::AVLTree< key_type, item_type >::begin(), DREAM::AVLTree< key_type, item_type >::empty(), DREAM::AVLTree< key_type, item_type >::end(), fitness_, DREAM::Task::priority(), DREAM::System::reset(), DREAM::System::simulate(), DREAM::Task::subpriority(), system_ptr_, task_avltree_, DREAM::System::visitor_error_avltree(), and DREAM::System::visitor_update_task_avltree().
Referenced by main(), DREAM::GeneticOptimize::mutate(), DREAM::ModelCheck::random_testing(), regenerate_subpriorities(), and DREAM::ModelCheck::trace_based_model_check().
void DREAM::Solution::generate_priorities | ( | ) | [virtual] |
void DREAM::Solution::generate_subpriorities | ( | ) | [virtual] |
void DREAM::Solution::regenerate_priorities | ( | ) | [virtual] |
Regenerates random solution.
Definition at line 210 of file GeneticAlgorithm.cpp.
References DREAM::AVLTree< key_type, item_type >::begin(), DREAM::AVLTree< key_type, item_type >::end(), DREAM::AVLTree< key_type, item_type >::insert(), DREAM::random(), regenerate_subpriorities(), DREAM::System::scheduler_map(), and system_ptr_.
void DREAM::Solution::regenerate_subpriorities | ( | ) | [virtual] |
Regenerates random solution.
Definition at line 255 of file GeneticAlgorithm.cpp.
References fitness(), DREAM::random(), DREAM::AVLTree< key_type, item_type >::size(), and task_avltree_.
Referenced by regenerate_priorities().
void DREAM::Solution::visitor | ( | std::string & | out | ) |
Produces nice output from the Solution.
out | is the message to be output. |
Definition at line 269 of file GeneticAlgorithm.cpp.
References DREAM::AVLTree< key_type, item_type >::begin(), double_size, DREAM::AVLTree< key_type, item_type >::end(), fitness_, and task_avltree_.
friend class GeneticOptimize [friend] |
Definition at line 70 of file GeneticAlgorithm.h.
friend class ModelCheck [friend] |
Definition at line 71 of file GeneticAlgorithm.h.
friend struct sort_solutions [friend] |
Definition at line 73 of file GeneticAlgorithm.h.
std::ostream& operator<< | ( | std::ostream & | out, | |
DREAM::Solution & | solution | |||
) | [friend] |
Definition at line 56 of file GeneticAlgorithm.cpp.
bool DREAM::Solution::copy_ [protected] |
Flag which stores when the new task AVL tree copy is created.
Definition at line 127 of file GeneticAlgorithm.h.
Referenced by ~Solution().
double DREAM::Solution::fitness_ [protected] |
Stores the fitness of the Solution.
Definition at line 130 of file GeneticAlgorithm.h.
Referenced by fitness(), DREAM::sort_solutions::operator()(), DREAM::operator<<(), and visitor().
DREAM::TASK_AVLTREE DREAM::Solution::task_avltree_ [protected] |
Map storing all the Tasks in the System.
Definition at line 133 of file GeneticAlgorithm.h.
Referenced by deterministic(), fitness(), DREAM::GeneticOptimize::mutate(), DREAM::operator<<(), regenerate_subpriorities(), Solution(), visitor(), and ~Solution().
DREAM::System* DREAM::Solution::system_ptr_ [protected] |
Pointer to the system.
Definition at line 136 of file GeneticAlgorithm.h.
Referenced by fitness(), regenerate_priorities(), and Solution().