コード例 #1
0
        public static string GetRunTimeTestingPath(string fileName = "sample1_traindata.csv")
        {
            var theDirectory = GPModelGlobals.GetInstalledLocation();

            return(theDirectory + "\\RunTimeTesting\\" + fileName);
            // return GPdotNET.Engine.GPModelGlobals.LoadGPData(theDirectory + "\\RunTimeTesting\\" + fileName);
        }
コード例 #2
0
        public static double[][] LoadTestData(string fileName = "sample1_testdata.csv")
        {
            var theDirectory = GPModelGlobals.GetInstalledLocation();

            return(GPModelGlobals.LoadDataFromFile(theDirectory + "\\RunTimeTesting\\" + fileName));
            //return GPdotNET.Engine.GPModelGlobals.LoadGPData(theDirectory + "\\RunTimeTesting\\" + fileName);
        }
コード例 #3
0
        public static Dictionary <int, GPFunction> GenerateGPFunctionsFromXML()
        {
            var    theDirectory = GPModelGlobals.GetInstalledLocation();
            string filePath     = theDirectory + "\\RunTimeTesting\\FunctionSet.xml";

            try
            {
                // Loading from a file, you can also load from a stream
                var doc = XDocument.Load(filePath);
                //
                var q = from c in doc.Descendants("FunctionSet")
                        select new GPFunction
                {
                    Selected        = bool.Parse(c.Element("Selected").Value),
                    Weight          = int.Parse(c.Element("Weight").Value),
                    Name            = c.Element("Name").Value,
                    Definition      = c.Element("Definition").Value,
                    ExcelDefinition = c.Element("ExcelDefinition").Value,
                    Aritry          = ushort.Parse(c.Element("Aritry").Value),
                    Description     = c.Element("Description").Value,
                    IsReadOnly      = bool.Parse(c.Element("ReadOnly").Value),
                    IsDistribution  = bool.Parse(c.Element("IsDistribution").Value),
                    ID = int.Parse(c.Element("ID").Value)
                };
                var retval = q.ToDictionary(v => v.ID, v => v);
                return(retval);
            }
            catch (Exception)
            {
                throw new Exception("File not exist!");
            }
        }