Esempio n. 1
0
        private void btnFindRelations_Click(object sender, EventArgs e)
        {
            if (!IsWorking)
            {
                SetAsProcessing();

                bool breakAfterOneRound = false;

                if (Logging.FirstFindRelations)
                {
                    Logging.FirstFindRelations = false;
                    breakAfterOneRound         = true;
                }

                Logging.LogMessage("[Find relations task starting up...]");

                GNFS localGnfs          = gnfs;
                CancellationToken token = cancellationTokenSource.Token;
                new Thread(() =>
                {
                    GNFS resultGnfs = GnfsUiBridge.FindRelations(token, localGnfs, breakAfterOneRound);
                    SetGnfs(this, resultGnfs);
                    HaultAllProcessing();
                    Logging.LogMessage("[Find relations task complete]");
                }).Start();
            }
        }
Esempio n. 2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (!IsWorking)
            {
                SetAsProcessing();
                //ControlBridge.SetControlEnabledState(btnCreate, false);

                n          = BigInteger.Parse(tbN.Text);
                degree     = int.Parse(tbDegree.Text);
                polyBase   = BigInteger.Parse(tbBase.Text);
                primeBound = BigInteger.Parse(tbBound.Text);

                int relationQuantity   = int.Parse(tbRelationQuantity.Text);
                int relationValueRange = int.Parse(tbRelationValueRange.Text);

                //Logging.OutputFilename = DirectoryLocations.GetUniqueNameFromN(n) + ".LOG.txt";
                //Logging.CreateLogFileIfNotExists();

                Logging.LogMessage($"[New factorization job creation initialization for N = {DirectoryLocations.GetUniqueNameFromN(n)}...]");

                CancellationToken token = cancellationTokenSource.Token;
                new Thread(() =>
                {
                    GNFS localGnfs =
                        GnfsUiBridge.CreateGnfs
                        (
                            token,                              // CancellationToken
                            n,                                  // Semi-prime to factor N = P*Q
                            polyBase,                           // Polynomial base (value for x)
                            degree,                             // Polynomial Degree
                            primeBound,                         //  BigInteger
                            relationQuantity,                   // Total # of relations to collect before proceeding.
                            relationValueRange                  //
                        );



                    SetGnfs(this, localGnfs);
                    HaultAllProcessing();
                    ControlBridge.SetControlEnabledState(panelFunctions, true);
                    Logging.LogMessage($"[New factorization job initialization complete]");
                    Logging.LogMessage($"NOTE: You should save your progress now.");
                }).Start();
            }
        }
Esempio n. 3
0
        private void btnFindSquares_Click(object sender, EventArgs e)
        {
            if (!IsWorking)
            {
                SetAsProcessing();

                Logging.LogMessage("[Find square root task starting up...]");

                GNFS localGnfs          = gnfs;
                CancellationToken token = cancellationTokenSource.Token;
                new Thread(() =>
                {
                    GNFS resultGnfs = GnfsUiBridge.FindSquares(token, localGnfs);

                    SetGnfs(this, resultGnfs);
                    HaultAllProcessing();
                    Logging.LogMessage("[Find square root task complete]");
                }).Start();
            }
        }
Esempio n. 4
0
        private void btnMatrix_Click(object sender, EventArgs e)
        {
            if (!IsWorking)
            {
                SetAsProcessing();

                Logging.LogMessage("[Matrix solve task starting up...]");

                GNFS localGnfs          = _gnfs;
                CancellationToken token = _cancellationTokenSource.Token;
                new Thread(() =>
                {
                    GNFS resultGnfs = GnfsUiBridge.MatrixSolveGaussian(token, localGnfs);

                    SetGnfs(this, resultGnfs);
                    HaultAllProcessing();
                    Logging.LogMessage("[Matrix solve task complete]");
                }).Start();
            }
        }
Esempio n. 5
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            if (!IsWorking)
            {
                SetAsProcessing();
                //ControlBridge.SetControlEnabledState(btnCreate, false);

                n = BigInteger.Parse(tbN.Text);

                //Logging.OutputFilename = DirectoryLocations.GetUniqueNameFromN(n) + ".LOG.txt";
                //Logging.CreateLogFileIfNotExists();

                string jsonFilename = Path.Combine(DirectoryLocations.GetSaveLocation(n), "GNFS.json");
                Logging.LogMessage($"[Loading factorization progress from \"{jsonFilename}\"...]");

                CancellationToken token = cancellationTokenSource.Token;
                new Thread(() =>
                {
                    GNFS localGnfs = GnfsUiBridge.LoadGnfs(n);
                    SetGnfs(this, localGnfs);
                    HaultAllProcessing();
                    ControlBridge.SetControlEnabledState(panelFunctions, true);
                    Logging.LogMessage();
                    Logging.LogMessage("Counts/Quantities:");
                    Logging.LogMessage();
                    Logging.LogMessage($"Algebraic Factor Base (Quantity):\t{localGnfs.PrimeFactorBase.AlgebraicFactorBase.Count}");
                    Logging.LogMessage($"Rational Factor Base (Quantity):\t{localGnfs.PrimeFactorBase.RationalFactorBase.Count}");
                    Logging.LogMessage($"Quadratic Factor Base (Quantity):\t{localGnfs.PrimeFactorBase.QuadraticFactorBase.Count}");
                    Logging.LogMessage();
                    Logging.LogMessage($"Algebraic Factor Pairs (Quantity):\t{localGnfs.AlgebraicFactorPairCollection.Count}");
                    Logging.LogMessage($"Rational Factor Pairs (Quantity):\t{localGnfs.RationalFactorPairCollection.Count}");
                    Logging.LogMessage($"Quadratic Factor Pairs (Quantity):\t{localGnfs.QuadraticFactorPairCollection.Count}");
                    Logging.LogMessage();
                    Logging.LogMessage($"     Smooth Relations (Quantity):\t{localGnfs.CurrentRelationsProgress.SmoothRelationsCounter}");
                    Logging.LogMessage($"      Rough Relations (Quantity):\t{localGnfs.CurrentRelationsProgress.RoughRelations.Count}");
                    Logging.LogMessage($"       Free Relations (Quantity):\t{localGnfs.CurrentRelationsProgress.FreeRelationsCounter}");
                    Logging.LogMessage();
                    Logging.LogMessage("[Loading factorization progress complete]");
                }).Start();
            }
        }
Esempio n. 6
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            if (!IsWorking)
            {
                SetAsProcessing();

                BigInteger n = N;

                string jsonFilename = Path.Combine(DirectoryLocations.GetSaveLocation(n), DirectoryLocations.SaveFilename);
                Logging.LogMessage($"[Loading factorization progress from \"{jsonFilename}\"...]");

                CancellationToken token = _cancellationTokenSource.Token;

                new Thread(() =>
                {
                    GNFS localGnfs = GnfsUiBridge.LoadGnfs(n);
                    SetGnfs(this, localGnfs);
                    HaultAllProcessing();
                    ControlBridge.SetControlEnabledState(panelFunctions, true);
                    Logging.LogMessage();
                    Logging.LogMessage("Counts/Quantities:");
                    Logging.LogMessage();
                    Logging.LogMessage($"Algebraic Factor Base (MaxValue):\t{localGnfs.PrimeFactorBase.AlgebraicFactorBaseMax}");
                    Logging.LogMessage($"Rational Factor Base (MaxValue):\t{localGnfs.PrimeFactorBase.RationalFactorBaseMax}");
                    Logging.LogMessage($"Quadratic Factor Base (MaxValue):\t{localGnfs.PrimeFactorBase.QuadraticFactorBaseMax}");
                    Logging.LogMessage();
                    Logging.LogMessage($"Algebraic Factor Pairs (Quantity):\t{localGnfs.AlgebraicFactorPairCollection.Count}");
                    Logging.LogMessage($"Rational Factor Pairs (Quantity):\t{localGnfs.RationalFactorPairCollection.Count}");
                    Logging.LogMessage($"Quadratic Factor Pairs (Quantity):\t{localGnfs.QuadraticFactorPairCollection.Count}");
                    Logging.LogMessage();
                    Logging.LogMessage($"     Smooth Relations (Quantity):\t{localGnfs.CurrentRelationsProgress.SmoothRelationsCounter}");
                    Logging.LogMessage($"      Rough Relations (Quantity):\t{localGnfs.CurrentRelationsProgress.RoughRelations.Count}");
                    Logging.LogMessage($"       Free Relations (Quantity):\t{localGnfs.CurrentRelationsProgress.FreeRelationsCounter}");
                    Logging.LogMessage();
                    Logging.LogMessage("[Loading factorization progress complete]");
                    PrintCurrentCounts();
                    RefreshLoadSaveButtonState();
                }).Start();
            }
        }