DREAM::Solution Class Reference

A deterministic schedule for DREAM::System. More...

#include <GeneticAlgorithm.h>

List of all members.

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::Systemsystem_ptr_
 Pointer to the system.

Friends

class GeneticOptimize
class ModelCheck
struct sort_solutions
std::ostream & operator<< (std::ostream &out, DREAM::Solution &solution)


Detailed Description

A deterministic schedule for DREAM::System.

Definition at line 67 of file GeneticAlgorithm.h.


Constructor & Destructor Documentation

DREAM::Solution::Solution ( DREAM::System system_ptr  ) 

Creates a solution corresponding to the System.

Parameters:
system_ptr is the pointer to the System to be used to generate the Solution.

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_.


Member Function Documentation

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.

Returns:
mostly true if the Solution is deterministic.

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.

Parameters:
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).
Returns:
the fitness.

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]

Generates random solution for the System.

Definition at line 140 of file GeneticAlgorithm.cpp.

void DREAM::Solution::generate_subpriorities (  )  [virtual]

Generates random solution for the System.

Definition at line 175 of file GeneticAlgorithm.cpp.

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.

Parameters:
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_.


Friends And Related Function Documentation

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.


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 18:30:04 2007 for DREAM by  doxygen 1.5.1