示例#1
0
        public bool Mutate(Individual individual)
        {
            bool triedBackPropagation;
            bool mutated = ResultSemanticsOperator.Operate(DesiredSemantics, individual,
                                                           SubTreePool, MaxTreeDepth, out triedBackPropagation);

            double fitnessChange = 0;

            if (triedBackPropagation && individual.FitnessEvaluated && FitnessEvaluator != null)
            {
                double fitness = FitnessEvaluator.Evaluate(individual, Problem).Fitness;
                fitnessChange = fitness - individual.Fitness;
            }

            Statistics.Instance.AddBackpropagationAttemptMutation(triedBackPropagation, fitnessChange);
            if (!triedBackPropagation && Fallback != null)
            {
                return(Fallback.Mutate(individual));
            }
            return(mutated);
        }