Пример #1
0
        //Constructor
        public LifeObject(Hive h, NodalNetwork nn)
        {
            //Set Energies
            //this._interalEnergy = new Energy(Energy.State.Entropy, nn.EnergyCost);

            //Handle Hive Creation/Setting
            if (h == null)
                this._myHive = new Hive();
            else
                this._myHive = h;

            //Add TO Hive
            //this._myHive.AddLifeObject(this);
            this._myID = this._myHive.NextID();

            //Set Neural Netowrk
            this._myNetwork = nn;
        }
Пример #2
0
 public ID(ID parent)
 {
     this._myIDGenerator = parent._myIDGenerator;
     this._ID = this._myIDGenerator.NextID();
     this._Parents = new ID[1] { parent };
 }
Пример #3
0
        public ID(ID parent1, ID parent2)
        {
            if (parent1._myIDGenerator != parent2._myIDGenerator)
                throw new Exception("Cannot have parents with differing ID pools");

            this._myIDGenerator = parent1._myIDGenerator;
            this._ID = this._myIDGenerator.NextID();
            this._Parents = new ID[2] { parent1, parent2 };
        }
Пример #4
0
            public Pointer(PointerType pt, ID id, Pointer copyNode, bool performDeepCloneMutation)
                : this(pt, id)
            {
                if (!performDeepCloneMutation)
                    throw new Exception("Can only perform deep clone, no object relative information allowed within copy");

                if (pt != PointerType.Sigmoid && pt != PointerType.Output)
                    throw new Exception("Unhandled for non sigmoid pointers");

                var spread = 3;
                var appeareance = //.1 *
                    (.25 / 8);
                var changes = new List<double>();

                for (int i = 0; i < 5; i++)
                {
                    if (NodalNetwork.R.NextDouble() <= appeareance)
                        changes.Add(((NodalNetwork.R.NextDouble() - .5) / .5) * spread);
                    else
                        changes.Add(0);
                }

                this._sigHeight = copyNode._sigHeight + changes[0];
                this._sigOffset = copyNode._sigOffset + changes[1];
                this._sigSharp = copyNode._sigSharp + changes[2];
                this._sigScaleIn = copyNode._sigScaleIn + changes[3];
                this._sigBottom = copyNode._sigBottom + changes[4];
            }
Пример #5
0
 public Pointer(ID id)
     : this(PointerType.Base, id)
 {
 }
Пример #6
0
 //Constructor
 public Pointer(PointerType pt, ID id)
 {
     //Set
     this._id = id;
     this._myType = pt;
 }
Пример #7
0
            public Link(ID id, Pointer ptIn, Pointer ptOut, Link l, bool performDeepCloneMutation)
                : this(id, ptIn, ptOut, false)
            {
                if (!performDeepCloneMutation)
                    throw new Exception("This function does not allow the transfer of object-relative infomration");

                var spread = 3;
                var appeareance = //.1 *
                    (.25 / 413);
                var change = 0.0;

                if (l._mutatable && NodalNetwork.R.NextDouble() <= appeareance)
                    change = (((NodalNetwork.R.NextDouble() - .5) / .5) * spread);

                this._mutatable = l._mutatable;
                this._naturalWeight = l._naturalWeight + change;
            }
Пример #8
0
 //Construcotr
 public Link(ID id, Pointer ptIn, Pointer ptOut, bool mutatable)
 {
     //Set
     this._myID = id;
     this._inputPointer = ptIn;
     this._outputPointer = ptOut;
     this._mutatable = mutatable;
 }