Exemplo n.º 1
0
        public void Test00_Initialize()
        {
            TestContext.WriteLine($"ENTER: {nameof(Test00_Initialize)}");

            step00_passed = false;
            step01_passed = false;
            step02_passed = false;
            step03_passed = false;
            step04_passed = false;

            if (Directory.Exists(TestSaveLocation))
            {
                RecursiveDelete(TestSaveLocation);
            }

            DirectoryLocations.SetBaseDirectory(TestSaveLocation);

            gnfs = null;
            cancellationTokenSource = new CancellationTokenSource();
            cancelToken             = cancellationTokenSource.Token;

            step00_passed = true;

            TestContext.WriteLine($"{nameof(Test00_Initialize)} passed?: {step00_passed}");
            TestContext.WriteLine($"LEAVE: {nameof(Test00_Initialize)}");
        }
Exemplo n.º 2
0
        public static GNFS LoadGnfs(BigInteger n)
        {
            string jsonFilename = Path.Combine(DirectoryLocations.GetSaveLocation(n), "GNFS.json");
            GNFS   gnfs         = Serialization.Load.All(jsonFilename);

            gnfs.LogFunction = Logging.LogMessage;
            return(gnfs);
        }
Exemplo n.º 3
0
 public static bool Initialize()
 {
     if (!DirectoryLocations.Initialize() || !FileLocations.Initialize())
     {
         return(false);
     }
     LogClassificationTypes.Initialize();
     Logger.AddLog(new LogData("", LogTypes.Default.LogConfigIo, LogClassificationTypes.Information));
     return(true);
 }
Exemplo n.º 4
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();
            }
        }
Exemplo n.º 5
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();
            }
        }
Exemplo n.º 6
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();
            }
        }
 public InvoicingPrinterRepository(AppDbContext appDbContext, IMapper mapper, IOptions <DirectoryLocations> directoryLocations, IOptions <TestingEnvironment> settings) : base(appDbContext, settings)
 {
     this.directoryLocations = directoryLocations.Value;
     this.mapper             = mapper;
 }