/*

  Copyright (C) 2004  Betti Österholz

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, June 1991, of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
#include <iostream>
#include <sstream>
#include <string>
#include <list>

#include "CCheck.h"
#include "CDoubleOut.h"

#include "Conc.h"
#include "Function.h"
#include "Area.h"
#include "Point.h"

#include "Color.h"
#include "Position.h"
#include "UnderFunction.h"
#include "UnderArea.h"

#include "PicturMatrix.h"
#include "Environment.h"
#include "Parameter.h"


void testEnvironment()
{
//CDoubleOut dout=CDoubleOut();
CCheck ch=CCheck();

Parameter para;
//for (int i=10;i<=26;i++)
//	{);}
para.setOperationsParameter(10,0.0);//insert point overlap
para.setOperationsParameter(11,0.0);//insert point not overlap
para.setOperationsParameter(12,0.03);//insert part object overlap
para.setOperationsParameter(13,0.025);//insert part object not overlap
para.setOperationsParameter(14,0.06);//delete part object
para.setOperationsParameter(15,0.02);//cange value
para.setOperationsParameter(16,0.005);//change variable
para.setOperationsParameter(17,0.005);//change value to variable
para.setOperationsParameter(18,0.005);//chang variable to value
para.setOperationsParameter(19,0.10);//make function
para.setOperationsParameter(20,0.11);//make area
para.setOperationsParameter(21,0.005);//deletes from 10 Area or Function Elements on a random
para.setOperationsParameter(22,0.01);//insert a function vector in a function vectorlist
para.setOperationsParameter(23,0.06);//insert a area vector in a area vectorlist
para.setOperationsParameter(24,0.01);//remove a random choosen list vector
para.setOperationsParameter(25,0.2);//move a random choosen element
para.setOperationsParameter(26,0.015);//flip the objects of a random choosen conc Object; flip if one is a conc
para.setOperationsParameter(27,0.01);//insert point from the original overlap
para.setOperationsParameter(28,0.01);//insert point from the original not overlap
para.setOperationsParameter(29,0.01);//delete not needed ListVector
para.setOperationsParameter(30,0.01);//insert a slanting variables
para.setOperationsParameter(31,0.30);//insert a slanting linie


para.setTerminalConditionParameter(0,6000000.0);//loops
para.setTerminalConditionParameter(1,1000000.0);//best Individual
para.setTerminalConditionParameter(11,300.0);//wigth: distance to original
para.setTerminalConditionParameter(12,1.0);//wigth: great
para.setTerminalConditionParameter(13,10.0);//wigth: timeNeeded

//parameters for the documentation(0=false; 1=true)
para.setDocumentParameter(0,0);//insert
para.setDocumentParameter(1,0);//operation
para.setDocumentParameter(2,0);//erase
para.setDocumentParameter(3,0);//distance
para.setDocumentParameter(4,1);//number of last individual
para.setDocumentParameter(5,0);//goodness

para.setDocumentParameter(6,1);//append best object to best object file
para.setDocumentParameter(7,1);//best and average goodness for number of last individual (if number of last individual is 0 returns nothing)
para.setDocumentParameter(8,1);//number of last individual, best and average goodness for number of last individual as an text exel import file to the best_exel file(if number of last individual is 0 returns nothing)

para.setInitParameter(0,1000);//number of individuals
para.setInitParameter(1,0);//initialize with a random point
para.setInitParameter(2,90);//initialize with point objects of the orginal picture
para.setInitParameter(3,0);//initialize correct picture objects which randomly
		//generated (positions of the Points in the conc-objects)
para.setInitParameter(4,100);//how much init-objects to load from the file
para.setInitParameter(5,0);//init korrect pictur objects rondom generated 2(positions of
		//the new point in the new conc objects); faster then the init3 procedure
para.setInitParameter(20,100);//primitiv documentation distance; if this parameter is
		//n just every n loops the documentation for DocumentParameter 7 and 8 are printed

para.setOperationsParameter(0,5);//number of imortal individuals(the best n are imortal)

para.setNamesParameter(0,"/home/biokom/bel/bilder/sw_H_16_16.bmp ");//pictur to load
para.setNamesParameter(1,"best.btx ");	//wher to store the best pictur
para.setNamesParameter(2,"best_object.txt ");//wher to store the best pictur in fib

para.setNamesParameter(3,"oldobj.txt ");//from wich file to load init objects
para.setNamesParameter(4,"best_exel.txt ");//name of the best_exel file to store the best data to, see DocumentParameter 8
/*
para.save("para.par");

Parameter para1;
para1.load("para.par");
*/
Environment env=Environment(para);

//env.load("oldobj.txt",100);

env.start();//or

cout<<endl<<endl<<"Ende ";
/*
char c;
cin>>c;
*/
/*
env.init();
char n;
unsigned int z=0;
while ((n!='n')&&(z<100))
{
	env.makeNewIndividual();
//	cin>>n;
	z++;
}
*/

};


/*
stringstream strstr;
unsigned int i1=0;
obj->store(i1,strstr);
cout<<" obj : "<<strstr.str()<<endl<<flush;


*/
