Esempio n. 1
0
        public CFGPythonSolution(ISymbolicExpressionTree tree, ICFGPythonProblemData problemData, double timeout, PythonProcess pythonProcess)
            : base(tree, problemData)
        {
            name        = ItemName;
            description = ItemDescription;

            string program = PythonHelper.FormatToProgram(tree, problemData.LoopBreakConst, problemData.FullHeader, problemData.FullFooter);

            Add(new Result(ProgramResultName, "The program with header and footer", new TextValue(program)));
            string code = CFGSymbolicExpressionTreeStringFormatter.StaticFormat(tree);

            Add(new Result(CodeResultName, "The code that was evolved", new TextValue(code)));

            Evaluate(problemData, program, timeout, pythonProcess);
        }
            public BrokenIndividual(ISymbolicExpressionTree tree, string exception, bool includeTree, ICFGPythonProblemData problemData)
            {
                name        = String.Format("{0}: {1}", ItemName, exception);
                description = ItemDescription;
                Add(new Result(ModelLengthResultName, "Length of the symbolic regression model.", new IntValue(tree.Length)));
                Add(new Result(ModelDepthResultName, "Depth of the symbolic regression model.", new IntValue(tree.Depth)));
                if (includeTree)
                {
                    Add(new Result(ModelResultName, "The CFG model.", tree));
                }
                Add(new Result(ExceptiontName, "The CFG model.", new StringValue(exception)));

                string program = PythonHelper.FormatToProgram(tree, problemData.LoopBreakConst, problemData.FullHeader, problemData.FullFooter);

                Add(new Result(ProgramResultName, "The program with header and footer", new TextValue(program)));
                string code = CFGSymbolicExpressionTreeStringFormatter.StaticFormat(tree);

                Add(new Result(CodeResultName, "The code that was evolved", new TextValue(code)));
            }
Esempio n. 3
0
 public Tuple <IEnumerable <bool>, IEnumerable <double>, double, string> EvaluateProgram(string program, StringArray input, StringArray output, IEnumerable <int> indices, double timeout = 1)
 {
     return(EvaluateProgram(program, PythonHelper.ConvertToPythonValues(input, indices), PythonHelper.ConvertToPythonValues(output, indices), indices, timeout));
 }