예제 #1
0
        public override bool Equals(object obj)
        {
            if (!(obj is Individual other))
            {
                return(false);
            }

            return(DecisionVector.Equals(other.DecisionVector) &&
                   SolutionVector.SequenceEqual(other.SolutionVector));
        }
예제 #2
0
        /// <summary>
        /// Returns a shallow copy of the Individual
        /// </summary>
        public Individual Clone()
        {
            var newIndividual = new Individual(DecisionVector)
            {
                SolutionVector = (double[])SolutionVector.Clone(),
                Fitness        = Fitness,
                Legal          = Legal,
                State          = State,
            };

            foreach (var key in properties.Keys)
            {
                newIndividual.SetProperty(key, properties[key]);
            }

            return(newIndividual);
        }