Ejemplo n.º 1
0
        public void Initialize(MendelMachine mendelMachine, Genoma genoma,
                               ActivationFunction activationFunction,
                               bool learningPhase, float lifeTime, int index)
        {
            fitness = 0;

            this.activationFunction = activationFunction;
            this.index         = index;
            this.mendelMachine = mendelMachine;
            this.learningPhase = learningPhase;
            this.lifeTime      = lifeTime;

            perceptron = new Perceptron(genoma, activationFunction);
        }
Ejemplo n.º 2
0
 void Start()
 {
     if (!learningPhase && !string.IsNullOrEmpty(brainPath))
     {
         try {
             FileStream      fs        = new FileStream(brainPath, FileMode.Open);
             BinaryFormatter formatter = new BinaryFormatter();
             perceptron = new Perceptron(new Genoma((LinearAlgebra.Matrix[])formatter.Deserialize(fs)), activationFunction);
             fs.Close();
             Debug.Log("Perceptron loaded");
         } catch (SerializationException e) {
             Debug.LogError(e.Message);
         }
     }
 }