//get inputs from sensors, get outputs from Genetic NN
    void FixedUpdate()
    {
        Inputs  = GetComponent <Sensor>().sensors;
        Outputs = Car.FeedForward(Inputs);

        //set outputs to CarController class
        controller.GeneticSteering = (double)Outputs[0];
        controller.GeneticEngine   = (double)Outputs[1];
    }
Ejemplo n.º 2
0
    public void FeedForward2()
    {
        // ARRANGE
        GeneticNetwork genetic = new GeneticNetwork();

        double[] inputs = { 0.6, 0.4, 0.2, 0, 0 };

        int expectedlength = 2;

        // ACT
        List <double> outputs = genetic.FeedForward(inputs);

        // ASSERT
        Assert.That(outputs.Count, Is.EqualTo(expectedlength));

        foreach (var output in outputs)
        {
            Assert.That(output, Is.InRange(0f, 1f));
        }
    }