Exemple #1
0
 private void RefreshLoadSaveButtonState()
 {
     if (DoesSaveFileExist)
     {
         ControlBridge.SetControlEnabledState(btnLoad, true);
         ControlBridge.SetControlEnabledState(btnCreate, false);
         ControlBridge.SetControlEnabledState(btnSave, true);
     }
     else
     {
         ControlBridge.SetControlEnabledState(btnLoad, false);
         ControlBridge.SetControlEnabledState(btnCreate, true);
         ControlBridge.SetControlEnabledState(btnSave, false);
     }
 }
Exemple #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();
            }
        }
Exemple #3
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();
            }
        }
Exemple #4
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();
            }
        }