コード例 #1
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);
        }
コード例 #2
0
ファイル: NewGPModel.cs プロジェクト: bhrnjica/gpdotnetv4
 public NewGPModel()
 {
     InitializeComponent();
     this.pictureBox1.Image  = GPModelGlobals.LoadImageFromName("GPdotNET.App.Resources.gpdotnet_ico48.png");
     comboBox1.SelectedIndex = 0;
     comboBox2.SelectedIndex = 0;
 }
コード例 #3
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);
        }
コード例 #4
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!");
            }
        }
コード例 #5
0
        /// <summary>
        /// loads training data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoadTrainig_Click(object sender, EventArgs e)
        {
            var strFile = GPModelGlobals.GetFileFromOpenDialog();
            var data    = GPModelGlobals.LoadDataFromFile(strFile);

            LoadTrainingData(data, GPModelType.SR);
        }
コード例 #6
0
        /// <summary>
        /// Fire event for loading test data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoadTesting_Click(object sender, EventArgs e)
        {
            var strFile = GPModelGlobals.GetFileFromOpenDialog();
            var data    = GPModelGlobals.LoadDataFromFile(strFile);

            if (_problemType == GPModelType.SR || _problemType == GPModelType.SRO)
            {
                LoadTestingData(data);
            }
            else if (_problemType == GPModelType.TS)
            {
                LoadSeriesData(data);
            }
            else if (_problemType == GPModelType.TSP)
            {
                LoadTrainingData(data, _problemType);
            }
            else if (_problemType == GPModelType.AP)
            {
                LoadTrainingData(data, _problemType);
            }
            else if (_problemType == GPModelType.TP)
            {
                LoadTrainingData(data, _problemType);
            }
            else
            {
                LoadTestingData(data);
            }
        }
コード例 #7
0
ファイル: ResultPanel.cs プロジェクト: bhrnjica/gpdotnetv4
        private void button1_Click(object sender, System.EventArgs e)
        {
            var filePath = GPModelGlobals.GetFileFromSaveDialog("PNG File Format", "*.png");

            if (!string.IsNullOrEmpty(filePath))
            {
                treeCtrlDrawer1.SaveAsImage(filePath);
            }
        }
コード例 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            var strPath = GPModelGlobals.GetFileFromOpenDialog("Rich text files ", "*.rtf");

            if (strPath != null)
            {
                richTextBox1.LoadFile(strPath, RichTextBoxStreamType.RichText);
            }
        }
コード例 #9
0
ファイル: FunctionPanel.cs プロジェクト: bhrnjica/gpdotnetv4
 public FunctionPanel()
 {
     InitializeComponent();
     listView1.CheckBoxes    = true;
     listView1.GridLines     = true;
     listView1.HideSelection = false;
     if (this.DesignMode)
     {
         return;
     }
     _gpFunctions = GPModelGlobals.LoadFunctionsfromXMLFile(_xmlDoc);
     fillListView(_gpFunctions.Select(x => x.Value).ToList());
 }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        bool OpenFromFile()
        {
            var strFile = GPModelGlobals.GetFileFromOpenDialog("GPdotNET file format", "*.gpa");

            if (string.IsNullOrEmpty(strFile))
            {
                return(false);
            }

            if (!CloseCurrentModel())
            {
                return(false);
            }

            bool retVal = Open(strFile);

            return(retVal);
        }
コード例 #11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button3_Click(object sender, EventArgs e)
 {
     if (_constants != null)
     {
         if (MessageBox.Show("Previous solution will be reset. Do you want to continue?", "Settings", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             _constants = GPModelGlobals.GenerateConstants(GetParameters().rConstFrom, GetParameters().rConstTo, GetParameters().rConstNum);
             //send event about dataLoading
             if (ResetSolution != null)
             {
                 ResetSolution(this, new EventArgs());
             }
         }
     }
     else
     {
         _constants = GPModelGlobals.GenerateConstants(GetParameters().rConstFrom, GetParameters().rConstTo, GetParameters().rConstNum);
     }
 }
コード例 #12
0
        //Import file
        private void button1_Click(object sender, EventArgs e)
        {
            var strFile = GPModelGlobals.GetFileFromOpenDialog("", "");

            if (strFile == null)
            {
                return;
            }
            var data = string.Join(Environment.NewLine, File.ReadAllLines(strFile).Where(l => !l.StartsWith("#") && !l.StartsWith("!")));

            originData    = data;
            textBox3.Text = data;
            ProcesData();

            if (!string.IsNullOrEmpty(data))
            {
                button2.Enabled = true;
            }
        }
コード例 #13
0
 public ExportDialog()
 {
     InitializeComponent();
     listBox1.SelectedIndex = 1;
     this.pictureBox1.Image = GPModelGlobals.LoadImageFromName("GPdotNET.App.Resources.gpdotnet_ico48.png");
 }