[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting GenomeManipulator.cs,1.3,1.
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-08-07 08:21:09
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18128/b7_Scripts/TickerSelectionTesting Modified Files: GenomeManipulator.cs Log Message: Code has been simplified and a bug has been fixed in setMaskForChildsForMixingWithoutDuplicates (method used by MixGenesWithoutDuplicates) Index: GenomeManipulator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManipulator.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GenomeManipulator.cs 3 Aug 2005 23:12:25 -0000 1.3 --- GenomeManipulator.cs 7 Aug 2005 08:20:53 -0000 1.4 *************** *** 86,90 **** return returnValue; } ! private static void setMaskForChildsForMixingWithoutDuplicates(Genome parent1, Genome parent2) --- 86,90 ---- return returnValue; } ! /*old private static void setMaskForChildsForMixingWithoutDuplicates(Genome parent1, Genome parent2) *************** *** 119,123 **** } } ! private static void setChildsUsingMaskForChilds(Genome parent1, Genome parent2) --- 119,154 ---- } } ! */ ! private static void setMaskForChildsForMixingWithoutDuplicates(Genome parent1, Genome parent2) ! ! { ! int[] genePlacesOfParent1NotPresentInParent2 = ! genePositionsOfParent1NotPresentInParent2(parent1, parent2); ! int[] genePlacesOfParent2NotPresentInParent1 = ! genePositionsOfParent1NotPresentInParent2(parent2, parent1); ! bool justExchangedAtPreviousPosition = false; ! for(int i = 0;i<parent1.Size;i++) ! { ! if(!justExchangedAtPreviousPosition) ! //exchanges between genes of parents in childs ! //must follow an alternate pattern, in order to ! //avoid plain copy of parents in childs when all genes ! //of the first parent are not in the second one (and viceversa) ! { ! if(genePlacesOfParent2NotPresentInParent1[i]!= - 1) ! { ! maskForChilds[0, i] = 2; ! justExchangedAtPreviousPosition = true; ! } ! if(genePlacesOfParent1NotPresentInParent2[i]!= - 1) ! { ! maskForChilds[1, i] = 1; ! justExchangedAtPreviousPosition = true; ! } ! } ! else ! justExchangedAtPreviousPosition = false; ! } ! } private static void setChildsUsingMaskForChilds(Genome parent1, Genome parent2) |