Ejemplo n.º 1
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (checkInputs())
            {
                getInputs();
            }
            else
            {
                return;
            }

            random              = new Random();
            analyticObj         = new AnalyticMethod(dataInput.gamma, dataInput.intervalBegin, dataInput.intervalEnd, dataInput.x0);
            inverseMethodObj    = new InverseFunctionMethod(dataInput.experimentsAmount, dataInput.partitionsAmount, dataInput.gamma, dataInput.intervalBegin, dataInput.intervalEnd, dataInput.x0);
            neymanMethodObj     = new NeymanMethod(dataInput.experimentsAmount, dataInput.partitionsAmount, dataInput.gamma, dataInput.intervalBegin, dataInput.intervalEnd, dataInput.x0);
            metropolisMethodObj = new MetropolisMethod(dataInput.experimentsAmount, dataInput.partitionsAmount, dataInput.gamma, dataInput.intervalBegin, dataInput.intervalEnd, dataInput.x0);
            experiment          = new Experiment(dataInput, analyticObj, inverseMethodObj, neymanMethodObj, metropolisMethodObj);

            actualExperimentAmount = 0;
            pause   = false;
            isSaved = false;

            setButtonsEnable(true);
            startButton.Enabled = false;
            saveButton.Enabled  = false;

            backgroundWorker.RunWorkerAsync();
        }
 public Experiment(Experiment experiment)
 {
     this.dataInput                = new DataInput(experiment.dataInput);
     this.analyticMethodObj        = new AnalyticMethod(experiment.analyticMethodObj);
     this.inverseFunctionMethodObj = new InverseFunctionMethod(experiment.inverseFunctionMethodObj);
     this.neymanMethodObj          = new NeymanMethod(experiment.neymanMethodObj);
     this.metropolisMethodObj      = new MetropolisMethod(experiment.metropolisMethodObj);
 }
 public Experiment(DataInput dataInput, AnalyticMethod analyticMethodObj, InverseFunctionMethod inverseFunctionMethodObj, NeymanMethod neymanMethodObj, MetropolisMethod metropolisMethodObj)
 {
     this.dataInput                = new DataInput(dataInput);
     this.analyticMethodObj        = new AnalyticMethod(analyticMethodObj);
     this.inverseFunctionMethodObj = new InverseFunctionMethod(inverseFunctionMethodObj);
     this.neymanMethodObj          = new NeymanMethod(neymanMethodObj);
     this.metropolisMethodObj      = new MetropolisMethod(metropolisMethodObj);
 }
Ejemplo n.º 4
0
 public InverseFunctionMethod(InverseFunctionMethod inverseFunctionMethod)
 {
     this.experimentsAmount = inverseFunctionMethod.experimentsAmount;
     this.partitionsAmount  = inverseFunctionMethod.partitionsAmount;
     this.gamma             = inverseFunctionMethod.gamma;
     this.intervalBegin     = inverseFunctionMethod.intervalBegin;
     this.intervalEnd       = inverseFunctionMethod.intervalEnd;
     this.x0            = inverseFunctionMethod.x0;
     this.intervalDelta = inverseFunctionMethod.intervalDelta;
     this.leftZone      = inverseFunctionMethod.leftZone;
     this.rightZone     = inverseFunctionMethod.rightZone;
     this.resultList    = new List <double>(inverseFunctionMethod.resultList);
     this.intervalsList = new List <double>(inverseFunctionMethod.intervalsList);
 }
        public void LoadExperimentsFromDB()
        {
            this.idList.Clear();

            using (SQLiteConnection connection = new SQLiteConnection("Data Source=Experiments.sqlite3"))
            {
                connection.Open();

                using (SQLiteCommand command = connection.CreateCommand())
                {
                    command.CommandText = "SELECT * FROM experiment;";

                    using (SQLiteDataReader reader = command.ExecuteReader())
                    {
                        BinaryFormatter formatter = new BinaryFormatter();
                        this.experimentsList = new List <Experiment>();

                        while (reader.Read())
                        {
                            using (MemoryStream ms = new MemoryStream((byte[])reader["metropolis"]))
                            {
                                ms.Seek(0, SeekOrigin.Begin);
                                this.dataInput             = new DataInput((DataInput)formatter.Deserialize(ms));
                                this.analyticMethod        = new AnalyticMethod((AnalyticMethod)formatter.Deserialize(ms));
                                this.inverseFunctionMethod = new InverseFunctionMethod((InverseFunctionMethod)formatter.Deserialize(ms));
                                this.neymanMethod          = new NeymanMethod((NeymanMethod)formatter.Deserialize(ms));
                                this.metropolisMethod      = new MetropolisMethod((MetropolisMethod)formatter.Deserialize(ms));

                                this.idList.Add(int.Parse(reader["id"].ToString()));
                                this.experimentsList.Add(new Experiment(dataInput, analyticMethod, inverseFunctionMethod, neymanMethod, metropolisMethod));
                            }
                        }
                    }
                }
            }

            this.FillListBox();
        }