Example #1
0
        public void Find()
        {
            if (string.IsNullOrWhiteSpace(Settings.Term_Pool))
            {
                throw new Exception("Setting TermPool is empty. Check the configuration file, and set the AppSetting value to a comma delimited list of allowed values for the key \"Term.Pool\".");
            }

            int        parseOut = 0;
            List <int> termPool = new List <int>();

            foreach (string term in Settings.Term_Pool.Split(','))
            {
                parseOut = 0;
                if (int.TryParse(term, out parseOut))
                {
                    termPool.Add(parseOut);
                }
            }

            equationArgs = new EquationFinderArgs(Settings.Equations_Goal, ResultPredicate.IsEqualTo, Settings.Operations_Quantity, termPool, Settings.Operand_Pool);
            threadArgs   = new ThreadSpawnerArgs(previousfoundResults, LogSolution, Settings.Round_TimeToLive, Settings.Round_Threads, Settings.Round_Quantity, equationArgs);

            ThreadedEquationFinder <AlgebraicTuple> equationFinder = new ThreadedEquationFinder <AlgebraicTuple>(threadArgs);

            if (File.Exists(outputFilename))
            {
                equationFinder.Results.AddRange(File.ReadAllLines(outputFilename));
            }
            equationFinder.Run();
        }
        public void Find()
        {
            if (string.IsNullOrWhiteSpace(Settings.Term_Pool))
            {
                throw new Exception("Setting TermPool is empty. Check the configuration file, and set the AppSetting value to a comma delimited list of allowed values for the key \"Term.Pool\".");
            }

            int parseOut = 0;
            List<int> termPool = new List<int>();
            foreach (string term in Settings.Term_Pool.Split(','))
            {
                parseOut = 0;
                if (int.TryParse(term, out parseOut))
                {
                    termPool.Add(parseOut);
                }
            }

            equationArgs = new  EquationFinderArgs(Settings.Equations_Goal, Settings.Operations_Quantity, termPool, Settings.Operand_Pool);
            threadArgs = new ThreadSpawnerArgs(previousfoundResults, LogSolution, Settings.Round_TimeToLive, Settings.Round_Threads, Settings.Round_Quantity, equationArgs);

            ThreadedEquationFinder<AlgebraicTuple> equationFinder = new ThreadedEquationFinder<AlgebraicTuple>(threadArgs);
            if (File.Exists(outputFilename))
            {
                equationFinder.Results.AddRange(File.ReadAllLines(outputFilename));
            }
            equationFinder.Run();
        }
        private void backgroundWorker_ThreadSpawner_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            if (e != null && e.Argument != null)
            {
                if (e.Argument is ThreadSpawnerArgs)
                {
                    IsDirty = true;

                    equationFinder = new ThreadedEquationFinder <AlgebraicExpression2>((ThreadSpawnerArgs)e.Argument);
                    equationFinder.Run();

                    // Stats
                    RoundEquationsGenerated  = equationFinder.TotalEquationsGenerated;
                    TotalEquationsGenerated += RoundEquationsGenerated;
                    DisplayStats();
                }
            }
        }
        private void backgroundWorker_ThreadSpawner_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            if (e != null && e.Argument != null)
            {
                if (e.Argument is ThreadSpawnerArgs)
                {
                    IsDirty = true;

                    equationFinder = new ThreadedEquationFinder<AlgebraicExpression2>((ThreadSpawnerArgs)e.Argument);
                    equationFinder.Run();

                    // Stats
                    RoundEquationsGenerated = equationFinder.TotalEquationsGenerated;
                    TotalEquationsGenerated += RoundEquationsGenerated;
                    DisplayStats();
                }
            }
        }