Пример #1
0
    public void SaveToFile(string filePath)
    {
        NeuralLayer.ActivationFunctionType AFType = NeuralLayer.GetActivationFunctionType(FNN.Layers[0].NeuronActivationFunction);
        AgentData ad = new AgentData(Genotype, AFType, FNN.useRNN, FNN.Topology);

        Save.WriteToXmlFile(filePath, ad);
    }
Пример #2
0
    public void LoadAgents(string agents_folder, out List <Agent> agents)
    {
        agents = new List <Agent>();

        if (!Directory.Exists(agents_folder))
        {
            throw new DirectoryNotFoundException(string.Format("Can't find {0} Directory", agents_folder));
        }

        string[] agent_files = Directory.GetFiles(agents_folder, "*." + AGENT_SUFFIX);

        if (agent_files.Length == 0)
        {
            throw new FileNotFoundException(string.Format("Can't find files with suffix \"{0}\"", AGENT_SUFFIX));
        }

        foreach (string file in agent_files)
        {
            agents.Add(Agent.LoadFromFile(file));
        }

        activationFunctionType = NeuralLayer.GetActivationFunctionType(agents[0].FNN.Layers[0].NeuronActivationFunction);
        useRNN      = agents[0].FNN.useRNN;
        NNTopology  = agents[0].FNN.Topology;
        isNewAgents = false;
    }
Пример #3
0
 public AgentData(Genotype genotype, NeuralLayer.ActivationFunctionType activationFunctionType, bool useRNN, uint[] topology)
 {
     this.genotype = genotype;
     this.activationFunctionType = activationFunctionType;
     this.useRNN   = useRNN;
     this.topology = topology;
 }