Commit 61e9c08b authored by Ogier Maitre's avatar Ogier Maitre

Debuging :

	-Print standard floating point number in csv file
	(no longer in scientific format, because scientific format is not standard
	for example it is not compatible with openoffice).
parent 02778c2b
......@@ -41,7 +41,7 @@ __________________________________________________________*/
float pMutPerGene=0.1;
float pMutDesCard = 0.05;
float pMutDesThre = 0.5;
float pMutDesThre = 0.05;
struct base* t1 = NULL;
struct base* t2 = NULL;
......@@ -161,6 +161,8 @@ GenomeClass {
\GenomeClass::crossover :
{
#if 0
for (int i=0; i<GENOME_SIZE; i+=GENE_SIZE){
if( tossCoin(0.5) )
for( unsigned j=0 ; j<GENE_SIZE ; j++ )
......@@ -168,7 +170,16 @@ GenomeClass {
else
for( unsigned j=0 ; j<GENE_SIZE ; j++ )
child.x[i+j] = parent2.x[i+j];
}
#else
for (int i=0; i<GENOME_SIZE; i+=1){
if( tossCoin(0.5) )
child.x[i] = parent1.x[i];
else
child.x[i] = parent2.x[i];
}
#endif
}
\end
......@@ -317,7 +328,7 @@ GenomeClass {
}
fitness_value = (((float)error) / t1->no_instances)*100 + ((float)tree_size)/K;
fitness_value = (((float)error) / t1->no_instances)*100;// + ((float)tree_size)/K;
for( unsigned i=0 ; i<K ; i++ ){
ba_delete(k_tmp_tables[i]);
......
run=50
f_line=2
l_line=$(($run+$f_line))
echo "Best" > concat.csv
k=4
for(( j=$f_line ; j< $l_line ; j++))
do
for i in `ls ./card*.csv`
do
echo -n `head $i -n $j | tail -n1 | cut -d"," -f $k`, >> concat.csv
done
echo "" >> concat.csv
done
echo "Avg" >> concat.csv
k=5
for(( j=$f_line ; j< $l_line ; j++))
do
for i in `ls ./card*.csv`
do
echo -n `head $i -n $j | tail -n1 | cut -d"," -f $k`, >> concat.csv
done
echo "" >> concat.csv
done
echo "StdDev" >> concat.csv
k=6
for(( j=$f_line ; j< $l_line ; j++))
do
for i in `ls ./card*.csv`
do
echo -n `head $i -n $j | tail -n1 | cut -d"," -f $k`, >> concat.csv
done
echo "" >> concat.csv
done
for(( i=0 ; i<20 ; i++ ))
for(( i=0 ; i<1 ; i++ ))
do
suf=`date +%s`
echo $suf
./card --seed=$suf --generateCSVFile=1 --nbGen=50
./card --seed=$suf --generateCSVFile=1 --nbGen=20
mv card.csv out/card-$suf.csv
done
\ No newline at end of file
......@@ -349,9 +349,9 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
if(currentGeneration==0)
fprintf(f,"GEN,TIME,EVAL,BEST,AVG,STDEV\n");
#ifdef WIN32
fprintf(f,"%lu,%2.6f,%lu,%.15e,%.15e,%.15e\n",currentGeneration,duration,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
fprintf(f,"%lu,%2.6f,%lu,%.15e,%.15e,%.15e\n",currentGeneration,duration,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
#else
fprintf(f,"%d,%ld.%06ld,%d,%.15e,%.15e,%.15e\n",currentGeneration,res.tv_sec,res.tv_usec,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
fprintf(f,"%d,%ld.%d,%d,%f,%f,%f\n",currentGeneration,res.tv_sec,res.tv_usec,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
#endif
fclose(f);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment