Exemplo n.º 1
0
        public static StageDimer Mutate(this StageDimer genomeStageDimer, IRando randy)
        {
            var newStage1   = genomeStageDimer.Stage1;
            var newStage2   = genomeStageDimer.Stage2;
            var newModifier = genomeStageDimer.Modifier;

            var spot = randy.NextUint(3);

            switch (spot)
            {
            case 0:
                newStage1 = newStage1.ConjugateBy(randy.ToSingleTwoCyclePermutation(newStage1.Order));
                break;

            case 1:
                newStage2 = newStage2.ConjugateBy(randy.ToSingleTwoCyclePermutation(newStage2.Order));
                break;

            case 2:
                newModifier = newModifier.ConjugateBy(randy.ToSingleTwoCyclePermutation(newModifier.Order));
                break;

            default:
                throw new Exception($"spot {spot} not handled in StageDimerExt.Mutate");
            }

            return(new StageDimer(
                       stage1: newStage1,
                       stage2: newStage2,
                       modifier: newModifier
                       ));
        }
Exemplo n.º 2
0
 public static IPermutation ConjugateByRandomSingleTwoCycle(this IPermutation perm, IRando randy)
 {
     return(perm.ConjugateBy(randy.ToSingleTwoCyclePermutation(perm.Order)));
     // return perm.ConjugateBy(randy.ToFullTwoCyclePermutation(perm.Order));
 }