コード例 #1
0
        //NOTE: The fitness sharing code assumes that fitness is always positive.


        internal Species(EvolSpecies <T> pop, Organism <T> proto)
        {
            this.proto = proto.Index;
            this.pop   = pop;

            members = new List <Int32>();
            members.Add(proto.Index);

            max_fit = proto.TrueFit;
            avg_fit = max_fit;

            age    = 0;
            invo   = 0;
            nchild = 0;
        }
コード例 #2
0
        internal bool Extention()
        {
            //if there are no members left, we are extenct by definition
            if (members.Count == 0)
            {
                pop = null;
                return(true);
            }

            //if the species is still young or inovating (keep alive)
            if (age < YOUNG)
            {
                return(false);
            }
            if ((age - invo) < OLD)
            {
                return(false);
            }

            //if the species has assigned children (keep alive)
            if (nchild > 0)
            {
                return(false);
            }

            //marks all remaining members for death
            foreach (int index in members)
            {
                pop.MarkForDeath(index);
            }

            //cleaers the member list and the pop refference
            members.Clear();
            pop = null;

            return(true);
        }