/*
Selah Lynch poptest.cc Aug 2004

test file for class Population
 */
#include <mpi.h>
#include <fstream.h>
#include <stdio.h>
#include <stdlib.h>
#include "population.h"


void ReadPoints(double** &, int&);

void check(bool, char*);

int main(int cnt, char **args){
  int myrank, ROOT=0;
  MPI_Init(&cnt,&args);
  MPI_Comm_rank(MPI_COMM_WORLD, &myrank);

  if(cnt==2) srand(atoi(args[1]));


  if(myrank==ROOT){
    Problem prob("points.data");

    Population pop(10,prob);
    pop.SetFitness();
    pop.Display();
    cout<<endl;

    pop.BreedAndReplace(atoi(args[1]));
    pop.SetFitness();
    pop.Display();
    cout<<endl;
 

  }


  MPI_Finalize();
  return 0;
}






void check(bool b, char* mess){

  if(!b) {
    printf("\n\nERROR[poptest] - %s \n\n\n", mess);
    exit(0);
  }
}
