Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Form1 form = new Form1();
                form.ShowDialog();
            }
            else
            {
                MinerParams minerParams = null;

                try
                {
                    minerParams = MinerParams.Parse(args);

                    DateTime    timeBefore = DateTime.Now;
                    MineResults mineResult = null;

                    mineResult = DoMine(minerParams);

                    if (mineResult != null)
                    {
                        try
                        {
                            System.Console.WriteLine("Mining time : " + (DateTime.Now - timeBefore));
                            System.Console.WriteLine("Total found " + mineResult.Count.ToString() + " patterns");
                            System.Console.WriteLine(mineResult.ToString());
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Exception during writing result: " + ex.ToString(), "Exception",
                                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        finally
                        {
                            mineResult.Dispose();
                            mineResult = null;
                        }
                    }
                }
                catch (ArgumentException ex)
                {
                    System.Console.WriteLine("Failed to parse command line argument: " + ex.Message);
                    System.Console.WriteLine();
                    System.Console.WriteLine(MinerParams.Usage());
                }
            }
        }
Ejemplo n.º 2
0
        private void buttonMine_Click(object sender, System.EventArgs e)
        {
            MinerParams minerParams = new MinerParams();

            if (textBoxDatasetPath.Text == "")
            {
                MessageBox.Show("No dataset selected", "Dataset Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            minerParams.DatasetFileName            = textBoxDatasetPath.Text;
            minerParams.InputContainsColumnHeaders = this.checkBoxInputColumnHeaders.Checked;
            minerParams.InputContainsRowHeaders    = this.checkBoxInputRowHeaders.Checked;

            minerParams.WriteOutputFiles = this.checkBoxWriteOutput.Checked;
            minerParams.WriteAllResults  = this.checkBoxWriteAllResults.Checked;

            minerParams.MinSupport = Int32.Parse(textBoxSupport.Text);
            minerParams.MinLength  = Int32.Parse(textBoxMinLength.Text);
            minerParams.MaxLength  = Int32.Parse(textBoxMaxLength.Text);

            minerParams.MaxErrors    = Int32.Parse(textBoxMaxErrors.Text);
            minerParams.MinGroups    = Int32.Parse(textBoxMinGroups.Text);
            minerParams.MaxLayerDiff = Int32.Parse(textBoxMaxLayerDiff.Text);

            minerParams.InCoreDualCompare = this.checkBoxUseInCoreDualCompare.Checked;

            if (radioButtonOPSM.Checked == true)
            {
                minerParams.Algorithm = Algorithm.OPSM;
            }
            else if (radioButtonTreePattern.Checked == true)
            {
                minerParams.Algorithm = Algorithm.TreePattern;
            }
            else if (radioButtonWithError.Checked == true)
            {
                minerParams.Algorithm = Algorithm.WithErrors;
            }
            else if (radioButtonGroups.Checked == true)
            {
                minerParams.Algorithm = Algorithm.Groups;
            }
            else if (radioButtonLayers.Checked == true)
            {
                minerParams.Algorithm = Algorithm.Layers;
            }
            else
            {
                throw new ArgumentException("Unsupported algorithm");
            }

            buttonMine.Enabled = false;

            DateTime    timeBefore = DateTime.Now;
            MineResults mineResult = null;

            richTextBoxResults.Clear();

            mineResult = OPSMMain.DoMine(minerParams);

            if (mineResult != null)
            {
                try
                {
                    richTextBoxResults.AppendText("Mining time : " + (DateTime.Now - timeBefore) + "\n");
                    richTextBoxResults.AppendText("Total found " + mineResult.Count.ToString() + " patterns\n");
                    richTextBoxResults.AppendText(mineResult.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception during writing result: " + ex.ToString(), "Exception",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                finally
                {
                    mineResult.Dispose();
                    mineResult = null;
                }
            }

            buttonMine.Enabled = true;
        }