示例#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
        /// <summary>
        /// Analyzes a <see cref="QuiverInPlane{TVertex}"/>.
        /// </summary>
        /// <typeparam name="TVertex">The type of the vertices in the quiver.</typeparam>
        /// <param name="quiverInPlane">The quiver in plane to analyze.</param>
        /// <returns>The analysis results.</returns>
        /// <remarks>
        /// <para>If the analysis is unsuccessful, the value of the <c>MainResult</c> property
        /// of the returned analysis results does not have the
        /// <see cref="QuiverInPlaneAnalysisMainResults.Success"/> or the
        /// <see cref="QuiverInPlaneAnalysisMainResults.QPIsSelfInjective"/> flags set and has at least
        /// one of the other flags (each of which indicates some sort of failure) set. However, in
        /// the case of multiple causes for failure (e.g., the quiver has loops and anti-parallel
        /// arrows), all the corresponding flags are not necessarily set (e.g.,
        /// <see cref="QuiverInPlaneAnalysisMainResults.QuiverHasLoops"/> is set but
        /// <see cref="QuiverInPlaneAnalysisMainResults.QuiverHasAntiParallelArrows"/> is not set,
        /// or <see cref="QuiverInPlaneAnalysisMainResults.QuiverHasAntiParallelArrows"/> is set but
        /// <see cref="QuiverInPlaneAnalysisMainResults.QuiverHasLoops"/> is not set).</para>
        /// <para>This method does not throw any exceptions (unless I've forgotten something).</para>
        /// </remarks>
        public IQuiverInPlaneAnalysisResults <TVertex> Analyze <TVertex>(
            QuiverInPlane <TVertex> quiverInPlane,
            QuiverInPlaneAnalysisSettings settings)
            where TVertex : IEquatable <TVertex>, IComparable <TVertex>
        {
            if (quiverInPlane is null)
            {
                throw new ArgumentNullException(nameof(quiverInPlane));
            }

            var qpExtractor      = new QPExtractor();
            var extractionResult = qpExtractor.TryExtractQP(quiverInPlane, out var qp);

            if (extractionResult != QPExtractionResult.Success)
            {
                return(AnalysisResultsFactory.CreateQuiverInPlaneAnalysisResults <TVertex>(extractionResult));
            }

            var analyzer           = new QPAnalyzer();
            var qpAnalyzerSettings = AnalysisSettingsFactory.CreateQPAnalysisSettings(settings);
            var qpAnalysisResults  = analyzer.Analyze(qp, qpAnalyzerSettings);
            var analysisResults    = AnalysisResultsFactory.CreateQuiverInPlaneAnalysisResults(qpAnalysisResults);

            return(analysisResults);
        }