Пример #1
0
        private static void TestCode()
        {
            ECActivator.AddSourceAssemblies(new[] { Assembly.GetAssembly(typeof(IEvolutionState)), Assembly.GetAssembly(typeof(ClassificationProblem)) });
            var             parameters = Evolve.LoadParameterDatabase(new[] { "-file", @"Params\App\Iris\koza.params" });
            IEvolutionState state      = Evolve.Initialize(parameters, 0);

            state.Setup(state, new Parameter(new string[] { "a" }));
            //state.Run(EvolutionState.C_STARTED_FRESH);
            //   var individual = (GPIndividual)((SimpleStatistics)state.Statistics).BestOfRun[0];
            var tree   = new GPTree();
            var reader = new System.IO.StreamReader("single_cl_ecj_graph.txt");

            tree.ReadTree(state, reader);
            var writer = new System.IO.StreamWriter("testcode.txt");
            var code   = TreeReader.PrintCodeFromTree(tree);

            writer.Write(code);
            writer.Close();
        }
Пример #2
0
        private static void CheckTreeFromFile()
        {
            ECActivator.AddSourceAssemblies(new[] { Assembly.GetAssembly(typeof(IEvolutionState)), Assembly.GetAssembly(typeof(ClassificationProblem)) });
            var             parameters = Evolve.LoadParameterDatabase(new[] { "-file", @"Params\App\Iris\koza.params" });
            IEvolutionState state      = Evolve.Initialize(parameters, 0);

            state.Setup(state, new Parameter(new string[] { "a" }));
            //state.Run(EvolutionState.C_STARTED_FRESH);
            var individual = (GPIndividual)((SimpleStatistics)state.Statistics).BestOfRun[0];
            var tree       = new GPTree();
            var reader     = new System.IO.StreamReader("single_cl_ecj_graph.txt");

            tree.ReadTree(state, reader);
            //  individual.Setup(state, new Parameter(new string[] { "numtrees = 1", "1" }));
            individual.Trees[0] = tree;



            // CheckClassifierOnTestData(new[] { individual }, state, (int)ClassifierType.SINGLE_CLASSIFIER, directoryName);
        }