Esempio n. 1
0
        public Shepherd(
            int numberOfSeenShepherds,
            int numberOfSeenSheep,
            int numberOfNeuronsInHiddenLayer,
            int numberOfHiddenLayers,
            EPerceptionType perceptionType,
            bool randomizeNeuralNet)
            : this()
        {
            NumberOfSeenShepherds = numberOfSeenShepherds;
            NumberOfSeenSheep     = numberOfSeenSheep;
            perception            = PerceptionFactory.GetPerception(perceptionType);

            Brain = NeuralNetsFactory.GetMultiLayerNeuralNet(new NeuralNetParameters()
            {
                InputLayerSize       = (numberOfSeenShepherds + numberOfSeenSheep) * 2 + 2,
                OutputLayerSize      = NEURAL_NET_OUTPUT_LAYER_SIZE,
                HiddenLayerSize      = numberOfNeuronsInHiddenLayer,
                NumberOfHiddenLayers = numberOfHiddenLayers
            });

            if (randomizeNeuralNet)
            {
                Brain.Randomize();
            }
        }
Esempio n. 2
0
 public override ThinkingAgent GetClone()
 {
     return(new Shepherd()
     {
         Brain = Brain.GetClone(),
         NumberOfSeenShepherds = NumberOfSeenShepherds,
         NumberOfSeenSheep = NumberOfSeenSheep,
         perception = PerceptionFactory.GetPerception(perception.PerceptionType),
         Position = new Vector2D(Position.X, Position.Y)
     });
 }
Esempio n. 3
0
        public Shepherd(
            int numberOfSeenShepherds,
            int numberOfSeenSheep,
            EPerceptionType perceptionType,
            NeuralNet brain)
            : this()
        {
            NumberOfSeenShepherds = numberOfSeenShepherds;
            NumberOfSeenSheep     = numberOfSeenSheep;
            perception            = PerceptionFactory.GetPerception(perceptionType);

            Brain = brain;
        }