Beispiel #1
0
        //
        // Given the problems with at least one assumption, construct ALL such combinations to form (I, G).
        //
        private void CalculateKnonStrictCardinalities(GeometryTutorLib.ProblemAnalyzer.InterestingProblemCalculator interestingCalculator,
                                                      List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > problems,
                                                      StatisticsGenerator.ProofProblemFigureStatisticsAggregator figureStats)
        {
            // K-G  container: index 0 is 1-G, index 1 is 2-G, etc.
            List <List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > > KmgProblems = new List <List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > >();

            //
            // Create the new set of multigoal problems each with 1 goal: 1-G
            //
            List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > mgProblems = new List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> >();

            foreach (GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> problem in problems)
            {
                GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> new1GProblem = new GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation>();
                new1GProblem.AddProblem(problem);
                mgProblems.Add(new1GProblem);
            }

            // Add the 1-G problems to the K-G problem set.
            KmgProblems.Add(mgProblems);


            // Construct all of the remaining
            CalculateKnonStrictCardinalities(KmgProblems, problems, ProofProblemFigureStatisticsAggregator.MAX_K);

            //
            // Now that we have 1, 2, ..., MAX_K -G multigoal problems, we must filter them.
            // That is, are the problems strictly interesting?
            //
            // Filtered K-G  container: index 0 is 1-G, index 1 is 2-G, etc.
            List <List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > > filteredKmgProblems = new List <List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > >();

            foreach (List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > originalKgProblems in KmgProblems)
            {
                filteredKmgProblems.Add(interestingCalculator.DetermineStrictlyInterestingMultiGoalProblems(originalKgProblems));
            }

            // Calculate the final numbers: counts of the k-G Strictly interesting problems.
            StringBuilder str = new StringBuilder();

            for (int k = 1; k <= ProofProblemFigureStatisticsAggregator.MAX_K; k++)
            {
                figureStats.kGcardinalities[k] = filteredKmgProblems[k - 1].Count;

                str.AppendLine(k + "-G: " + figureStats.kGcardinalities[k]);
            }

            Debug.WriteLine(str);

            if (GeometryTutorLib.Utilities.PROBLEM_GEN_DEBUG)
            {
                Debug.WriteLine(str);
            }
        }
        // Returns: <number of interesting problems, number of original problems generated>
        public ProofProblemFigureStatisticsAggregator AnalyzeFigure()
        {
            ProofProblemFigureStatisticsAggregator figureStats = new ProofProblemFigureStatisticsAggregator();

            // For statistical analysis, count the number of each particular type of implicit facts.
            CountIntrisicProperties(figureStats);

            // Start timing
            figureStats.stopwatch.Start();

            // Precompute all coordinate-based interesting relations (problem goal nodes)
            // These become the basis for the template-based problem generation (these are the goals)
            Precompute();

            // Handle givens that strengthen the intrinsic parts of the figure; modifies if needed
            givens = DoGivensStrengthenFigure();

            // Use a worklist technique to instantiate nodes to construct the hypergraph for this figure
            ConstructHypergraph();

            // Create the integer-based hypergraph representation
            ConstructPebblingHypergraph();

            // Pebble that hypergraph
            Pebble();

            // Analyze paths in the hypergraph to generate the pair of <forward problems, backward problems> (precomputed nodes are goals)
            KeyValuePair<List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>,
                         List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>> problems = GenerateTemplateProblems();

            // Combine the problems together into one list
            List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> candidateProbs = new List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>();
            candidateProbs.AddRange(problems.Key);
            //candidateProbs.AddRange(problems.Value); // converse

            figureStats.totalBackwardProblemsGenerated = problems.Value.Count;
            figureStats.totalProblemsGenerated = candidateProbs.Count;

            // Determine which, if any, of the problems are interesting (using definition that 100% of the givens are used)
            interestingCalculator = new GeometryTutorLib.ProblemAnalyzer.InterestingProblemCalculator(graph, figure, givens, goals);
            List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> interestingProblems = interestingCalculator.DetermineInterestingProblems(candidateProbs);
            figureStats.totalInterestingProblems = interestingProblems.Count;

            // Explicit number of facts: hypergraph size - figure facts
            figureStats.totalExplicitFacts = graph.vertices.Count - figure.Count;

            // Validate that the original book problems were generated.
            Validate(interestingProblems, figureStats);

            // Stop timing before we generate all of the statistics
            figureStats.stopwatch.Stop();

            List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> strictlyInteresting = GetStrictlyInteresting(interestingProblems);

            // Construct partitions based on different queries
            // GenerateStatistics(interestingProblems, figureStats, strictlyInteresting);

            //
            // Is this figure complete? That is, do the assumptions define the figure completely?
            //
            figureStats.isComplete = templateProblemGenerator.DefinesFigure(precomputer.GetPrecomputedRelations(), precomputer.GetStrengthenedClauses());

            // Debug.WriteLine("Explicit Complete: " + figureStats.isComplete);

            // Construct the K-goal problems
            // CalculateKnonStrictCardinalities(interestingCalculator, interestingProblems, figureStats);

            return figureStats;
        }
Beispiel #3
0
        // Returns: <number of interesting problems, number of original problems generated>
        public ProofProblemFigureStatisticsAggregator AnalyzeFigure()
        {
            ProofProblemFigureStatisticsAggregator figureStats = new ProofProblemFigureStatisticsAggregator();

            // For statistical analysis, count the number of each particular type of implicit facts.
            CountIntrisicProperties(figureStats);

            // Start timing
            figureStats.stopwatch.Start();

            // Precompute all coordinate-based interesting relations (problem goal nodes)
            // These become the basis for the template-based problem generation (these are the goals)
            Precompute();

            // Handle givens that strengthen the intrinsic parts of the figure; modifies if needed
            givens = DoGivensStrengthenFigure();


            // Use a worklist technique to instantiate nodes to construct the hypergraph for this figure
            ConstructHypergraph();

            // Create the integer-based hypergraph representation
            ConstructPebblingHypergraph();

            // Pebble that hypergraph
            Pebble();

            // Analyze paths in the hypergraph to generate the pair of <forward problems, backward problems> (precomputed nodes are goals)
            KeyValuePair <List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> >,
                          List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > > problems = GenerateTemplateProblems();

            // Combine the problems together into one list
            List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > candidateProbs = new List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> >();

            candidateProbs.AddRange(problems.Key);
            //candidateProbs.AddRange(problems.Value); // converse

            figureStats.totalBackwardProblemsGenerated = problems.Value.Count;
            figureStats.totalProblemsGenerated         = candidateProbs.Count;

            // Determine which, if any, of the problems are interesting (using definition that 100% of the givens are used)
            interestingCalculator = new GeometryTutorLib.ProblemAnalyzer.InterestingProblemCalculator(graph, figure, givens, goals);
            List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > interestingProblems = interestingCalculator.DetermineInterestingProblems(candidateProbs);

            figureStats.totalInterestingProblems = interestingProblems.Count;

            // Explicit number of facts: hypergraph size - figure facts
            figureStats.totalExplicitFacts = graph.vertices.Count - figure.Count;

            // Validate that the original book problems were generated.
            Validate(interestingProblems, figureStats);

            // Stop timing before we generate all of the statistics
            figureStats.stopwatch.Stop();


            List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > strictlyInteresting = GetStrictlyInteresting(interestingProblems);

            // Construct partitions based on different queries
            // GenerateStatistics(interestingProblems, figureStats, strictlyInteresting);

            //
            // Is this figure complete? That is, do the assumptions define the figure completely?
            //
            figureStats.isComplete = templateProblemGenerator.DefinesFigure(precomputer.GetPrecomputedRelations(), precomputer.GetStrengthenedClauses());

            // Debug.WriteLine("Explicit Complete: " + figureStats.isComplete);

            // Construct the K-goal problems
            // CalculateKnonStrictCardinalities(interestingCalculator, interestingProblems, figureStats);

            return(figureStats);
        }