예제 #1
0
        /// <summary>
        /// Analyzes a QP with the specified computer of maximal nonzero equivalence class
        /// representatives.
        /// </summary>
        /// <typeparam name="TVertex">The type of the vertices of the quiver.</typeparam>
        /// <param name="qp">The quiver with potential.</param>
        /// <param name="settings">The settings for the analysis.</param>
        /// <param name="computer">A computer of maximal nonzero equivalence class representatives.</param>
        /// <returns>The results of the analysis.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="qp"/> is
        /// <see langword="null"/>, or <paramref name="settings"/> is <see langword="null"/>,
        /// or <paramref name="computer"/> is <see langword="null"/>.</exception>
        /// <exception cref="NotSupportedException">The potential of <paramref name="qp"/> has a
        /// cycle with coefficient not equal to either of -1 and +1,
        /// or some arrow occurs multiple times in a single cycle of the potential of
        /// <paramref name="qp"/>.</exception>
        /// <exception cref="ArgumentException">For some arrow in the potential of
        /// <paramref name="qp"/> and sign, the arrow is contained in more than one cycle of that
        /// sign.</exception>
        public IQPAnalysisResults <TVertex> Analyze <TVertex>(
            QuiverWithPotential <TVertex> qp,
            QPAnalysisSettings settings,
            IMaximalNonzeroEquivalenceClassRepresentativeComputer computer)
            where TVertex : IEquatable <TVertex>, IComparable <TVertex>
        {
            if (qp is null)
            {
                throw new ArgumentNullException(nameof(qp));
            }
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (computer is null)
            {
                throw new ArgumentNullException(nameof(computer));
            }

            // Simply get the underlying semimonomial unbound quiver and analyze it using the appropriate analyzer
            var semimonomialUnboundQuiver = SemimonomialUnboundQuiverFactory.CreateSemimonomialUnboundQuiverFromQP(qp);
            var suqAnalyzer = new SemimonomialUnboundQuiverAnalyzer();
            var suqSettings = AnalysisSettingsFactory.CreateSemimonomialUnboundQuiverAnalysisSettings(settings);
            var suqResults  = suqAnalyzer.Analyze(semimonomialUnboundQuiver, suqSettings, computer);
            var results     = AnalysisResultsFactory.CreateQPAnalysisResults(suqResults);

            return(results);
        }
예제 #2
0
        public void QuiverGeneration_GivesQPSatisfyingTheSufficientConditionForHavingASemimonomialJacobianAlgebra()
        {
            var layerType = CreateLayerType(4, 4, 8, 8, 12, 8, 4);

            var nextCompositionParameters = generator.StartGeneration(layerType);

            Assert.That(nextCompositionParameters.Sum, Is.EqualTo(8));
            Assert.That(nextCompositionParameters.NumTerms, Is.EqualTo(4));

            // Distribute pairs
            nextCompositionParameters = generator.SupplyComposition(CreateComposition(Utility.RepeatMany(4, 2)));
            Assert.That(nextCompositionParameters.Sum, Is.EqualTo(12));
            Assert.That(nextCompositionParameters.NumTerms, Is.EqualTo(8));

            nextCompositionParameters = generator.SupplyComposition(CreateComposition(Utility.RepeatMany(4, 2, 1)));
            Assert.That(nextCompositionParameters.Sum, Is.EqualTo(12));
            Assert.That(nextCompositionParameters.NumTerms, Is.EqualTo(8));

            // Distribute pairs
            nextCompositionParameters = generator.SupplyComposition(CreateComposition(Utility.RepeatMany(4, 2, 1)));
            Assert.That(nextCompositionParameters.Sum, Is.EqualTo(20));
            Assert.That(nextCompositionParameters.NumTerms, Is.EqualTo(16));

            nextCompositionParameters = generator.SupplyComposition(CreateComposition(Utility.RepeatMany(4, 2, 1, 1, 1)));
            Assert.That(nextCompositionParameters.Sum, Is.EqualTo(16));
            Assert.That(nextCompositionParameters.NumTerms, Is.EqualTo(12));

            // Distribute pairs
            nextCompositionParameters = generator.SupplyComposition(CreateComposition(Utility.RepeatMany(4, 2, 1, 1)));
            Assert.That(nextCompositionParameters.Sum, Is.EqualTo(16));
            Assert.That(nextCompositionParameters.NumTerms, Is.EqualTo(16));

            nextCompositionParameters = generator.SupplyComposition(CreateComposition(Utility.RepeatMany(4, 1, 1, 1, 1)));
            Assert.That(nextCompositionParameters, Is.Null);

            var qp = generator.EndGeneration().QP;

            Assert.That(() => SemimonomialUnboundQuiverFactory.CreateSemimonomialUnboundQuiverFromQP(qp), Throws.Nothing);
        }