Ejemplo n.º 1
0
 void Start()
 {
     //nn = new Neuron.Network(2,5,1);
     //nn.SetRandom(-0.5f, 0.5f);
     nn = new Neuron.Network(256, 64, 8);
     nn.SetRandom(-0.5f, 0.5f);
 }
Ejemplo n.º 2
0
    public void Start()
    {
        Application.runInBackground = true;
        int   dx       = 8;
        int   dy       = 8;
        float distance = 5.0f;

        leader       = new RobotInfo();
        leader.robot = CreateRobot();
        leader.robot.transform.position = new Vector3(0, 0, -(dy + 1) * distance / 2.0f);
        leader.robot.DoStart();

        robotState = new RobotState(leader.robot.bodies.Length, leader.robot.muscles.Length);

        int inputNum = leader.robot.inputs.Length;
        int hideNum  = 50;
        int outNum   = leader.robot.muscles.Length;

        leader.network = new Neuron.Network(inputNum, hideNum, outNum);
        leader.network.SetRandom(-0.5f, 0.5f);

        for (int i = 0; i < dx; i++)
        {
            for (int j = 0; j < dy; j++)
            {
                RobotInfo robotInfo = new RobotInfo();
                Robot     robot     = CreateRobot();
                robot.transform.position = new Vector3(i * distance - (dx - 1) * distance / 2.0f, 0, j * distance - (dy - 1) * distance / 2.0f);
                robot.DoStart();
                robotInfo.robot   = robot;
                robotInfo.network = new Neuron.Network(inputNum, hideNum, outNum);
                robotInfo.network.SetRandom(-0.5f, 0.5f);
                robotInfo.startTime = Time.time;
                robots.Add(robotInfo);
            }
        }

        for (int i = 0; i < BestNum; i++)
        {
            Neuron.Network bn = new Neuron.Network(inputNum, hideNum, outNum);
            bestNetworks[i] = (new RewardPair(0, bn));
        }

        Load();
    }
Ejemplo n.º 3
0
 public RewardPair(float reward, Neuron.Network network)
 {
     this.reward  = reward;
     this.network = network;
 }