/*
 * genetic.h
 *
 *  Created on: Nov 23, 2009
 *      Author: brian
 */

#ifndef GENETIC_H_
#define GENETIC_H_


#endif /* GENETIC_H_ */

#ifndef CONSTANTS_H
#include "constants.h"
#endif


double fitness(int chr[], int len, int adjTable[][N_VERTICES]);
void randChr(int chr[], int size);
void printChr(char str[], int chr[], int size);
int randInt(int n);
double randDouble(double d);
void copyChr(int src[], int dest[], int len);
int countColors(int chr[]);
void prescaleFitness(double rawfitness[], int popsize);
double scaleHigh(double prescaledFitness[], double highFitness[], int popsize);
double scaleLow(double prescaledFitness[], double lowFitness[], int popsize);
int propSel(double scaledFitness[], double scaledFitnessSum, int popsize);
int loadAdjTable(char filename[], int size, int adjTable[][N_VERTICES]);
void onePoint(int p1[], int p2[], int c1[], int c2[], int len);
void twoPoint(int p1[], int p2[], int c1[], int c2[], int len);
void uniform(int p1[], int p2[], int c1[], int c2[], int len);
void mutate(int chromosome[], int size, double p_mutate);

