#ifndef GENETIC_H #define GENETIC_H #include using namespace std; /** * Class containing one gene's representation */ class Gene{ public: /** * the index of the task */ int task_index; /** * the index of the processor where the task is asigned */ int proc_index; /** * the topological level of the task */ int level; public: /** * Default constructor. */ Gene(); /** * Constructor * * @param task the index of the task * @param proc the index of the processor * @param lev the topological level of the task */ Gene(int task,int proc,int lev); /** * Copy operator */ Gene& operator=(const Gene& clone); /** * Method printing the gene's configuration */ void print(); }; /** * The implicit (default) gene */ static Gene null_gene = Gene(-1,-1,-1); /** * Class containing the chromosome's representation */ class Chromosome{ public: /** * the list of genes */ vector genes; /** * the list of floating nodes */ vector f_nodes; /** * the chromosome's makespan */ double makespan; /** * the chromosome's fitness */ double fitness; /** * load balancing evaluation */ double evalT1; /** * idle time evaluation */ double evalT2; /** * makespan evalutaion considering the whole population */ double evalT3; /** * currently load balance */ double loadBalance; public: /** * constructor */ Chromosome(); /** * Copy operator */ Chromosome& operator=(const Chromosome& clone); /** * Iterator operator */ Gene& operator[](int poz); /** * Method that adds a gene to the genes list * * @param g the new gene */ void append(Gene &g); /** * Method that initializes the population */ void init(); /** * Method that inserts a gene to the genes list in the specified position * * @param g the new gene * @param poz the position in the list */ void insert(Gene g,int poz); /** * Method that removes a gene from the genes list * * @param poz the gene's position * @return the removed gene */ Gene remove(int poz); /** * Method that returns the size of the genes list * * @return the size */ int size(); /** * Method that prints the chromosome's configuration */ void print() const; }; #endif