[PD-cvs] externals/frankenstein GArhythm.c, 1.2, 1.3 Makefile, 1.7, 1.8
dmorelli
morellid at users.sourceforge.net
Wed Dec 14 12:48:49 CET 2005
Update of /cvsroot/pure-data/externals/frankenstein
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11375
Modified Files:
GArhythm.c Makefile
Log Message:
added a new fitness function
Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile 7 Dec 2005 00:20:01 -0000 1.7
--- Makefile 14 Dec 2005 11:48:47 -0000 1.8
***************
*** 2,7 ****
#VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7"
VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7"
! PDPATH="H:\PureData\pd-0.38-3.msw\pd"
! #PDPATH="C:\Documents and Settings\Davide\Documenti\personali\pd-0.38-3.msw\pd"
--- 2,7 ----
#VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7"
VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7"
! #PDPATH="H:\PureData\pd-0.38-3.msw\pd"
! PDPATH="C:\Documents and Settings\Davide\Documenti\personali\pd-0.38-3.msw\pd"
Index: GArhythm.c
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/GArhythm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** GArhythm.c 8 Dec 2005 16:31:10 -0000 1.2
--- GArhythm.c 14 Dec 2005 11:48:47 -0000 1.3
***************
*** 185,189 ****
res++;
}
! return res/max;
}
--- 185,189 ----
res++;
}
! return (float) ((float) res) / ((float) max);
}
***************
*** 202,206 ****
}
}
! return ris/max;
}
--- 202,206 ----
}
}
! return (float) ((float) ris) / ((float) max);
}
***************
*** 228,231 ****
--- 228,262 ----
}
+ // svaforisce troppi colpi consecutivi
+ static double GArhythm_evaluate_fitness4(char *woman, char *man)
+ {
+ int i, j, max, curr_consecutivi, max_consecutivi, tot_consecutivi;
+ double ris=0;
+ curr_consecutivi = max_consecutivi = tot_consecutivi = 0;
+ max = (BUFFER_LENGHT-1) * NUM_STRUM;
+ for (j=0; j<NUM_STRUM; j++)
+ {
+ i=1;
+ curr_consecutivi = 0;
+ while(i<BUFFER_LENGHT)
+ {
+ if (man[i] & (0x01<<j))
+ {
+ // here is an event
+ //is it the first?
+ curr_consecutivi++;
+ if (curr_consecutivi>max_consecutivi)
+ max_consecutivi = curr_consecutivi;
+ } else
+ {
+ tot_consecutivi += curr_consecutivi;
+ curr_consecutivi = 0;
+ }
+ }
+ }
+ ris = (float) (((float) ris) / ((float) max));
+ return 1 - ris;
+
+ }
static void GArhythm_create_child(t_GArhythm *x, char *woman, char *man, char *child)
***************
*** 444,448 ****
+ fitness2[j] * (x->indice_riempimento)
+ (1 - fitness2[j]) * (1-(x->indice_riempimento))
! + fitness3[j] * (x->indice_variazione);
if (winner_value <= fitnessTOT[j])
{
--- 475,480 ----
+ fitness2[j] * (x->indice_riempimento)
+ (1 - fitness2[j]) * (1-(x->indice_riempimento))
! + fitness3[j] * (x->indice_variazione)
! + GArhythm_evaluate_fitness4(x->population[me], x->population[tmp]);
if (winner_value <= fitnessTOT[j])
{
***************
*** 487,491 ****
+ tmp2 * (x->indice_riempimento)
+ (1-tmp2) * (1-(x->indice_riempimento))
! + tmp3 * (x->indice_variazione);
if (tmpTOT >= winner_fitness)
{
--- 519,524 ----
+ tmp2 * (x->indice_riempimento)
+ (1-tmp2) * (1-(x->indice_riempimento))
! + tmp3 * (x->indice_variazione)
! + GArhythm_evaluate_fitness4(x->last, x->population[i]);
if (tmpTOT >= winner_fitness)
{
More information about the Pd-cvs
mailing list