Exemplo n.º 1
0
        public override void Run()
        {
            if (!problemIsOn)
            {
                return;
            }

            else
            {
                System.Diagnostics.Debug.WriteLine("----------------------------- " + this.problemName + " -----------------------------");
            }

            // Map the set of clauses from parser to one set of intrinsic clauses.
            ConstructIntrinsicSet();

            // Create the analyzer
            StatisticsGenerator.HardCodedFigureAnalyzerMain analyzer = new StatisticsGenerator.HardCodedFigureAnalyzerMain(intrinsic, given, goals);

            // Perform and time the analysis
            figureStats = analyzer.AnalyzeFigure();

            //
            // If we know it's complete, keep that overridden completeness.
            // Otherwise, determine completeness through analysis of the nodes in the hypergraph.
            //
            if (!this.isComplete)
            {
                this.isComplete = figureStats.isComplete;
            }

            System.Diagnostics.Debug.WriteLine("Resultant Complete: " + this.isComplete + "\n");


            // Calculate the final numbers: counts of the k-G Strictly interesting problems.
            System.Text.StringBuilder str = new System.Text.StringBuilder();
            for (int k = 1; k <= StatisticsGenerator.FigureStatisticsAggregator.MAX_K; k++)
            {
                str.Append(figureStats.kGcardinalities[k] + "\t");
            }

            if (this.isComplete)
            {
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\complete.txt", true))
                //{
                //    file.WriteLine(str);
                //}
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\completeTime.txt", true))
                //{
                //    file.WriteLine(figureStats.stopwatch.Elapsed);
                //}
            }
            else
            {
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\interesting.txt", true))
                //{
                //    file.WriteLine(str);
                //}
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\interestingTime.txt", true))
                //{
                //    file.WriteLine(figureStats.stopwatch.Elapsed);
                //}
            }

            // Add to the cumulative statistics
            ActualProofProblem.TotalTime = ActualProofProblem.TotalTime.Add(figureStats.stopwatch.Elapsed);

            ActualProofProblem.TotalPoints          += figureStats.numPoints;
            ActualProofProblem.TotalSegments        += figureStats.numPoints;
            ActualProofProblem.TotalInMiddle        += figureStats.numInMiddle;
            ActualProofProblem.TotalAngles          += figureStats.numAngles;
            ActualProofProblem.TotalTriangles       += figureStats.numTriangles;
            ActualProofProblem.TotalIntersections   += figureStats.numIntersections;
            ActualProofProblem.TotalTotalProperties += figureStats.totalProperties;

            ActualProofProblem.TotalExplicitFacts += figureStats.totalExplicitFacts;

            ActualProofProblem.TotalGoals                     += goals.Count;
            ActualProofProblem.TotalProblemsGenerated         += figureStats.totalProblemsGenerated;
            ActualProofProblem.TotalBackwardProblemsGenerated += figureStats.totalBackwardProblemsGenerated;

            // Query: Interesting Partitioning
            int        numProblemsInPartition;
            List <int> upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructInterestingPartitionBounds();

            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalInteresting[i] += figureStats.interestingPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalInteresting[upperBounds.Count] += figureStats.interestingPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;

            upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructInterestingPartitionBounds();
            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalStrictInteresting[i] += figureStats.strictInterestingPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalStrictInteresting[upperBounds.Count] += figureStats.strictInterestingPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;


            // Rest of Cumulative Stats
            ActualProofProblem.TotalStrictInterestingProblems += figureStats.totalStrictInterestingProblems;
            ActualProofProblem.TotalInterestingProblems       += figureStats.totalInterestingProblems;
            ActualProofProblem.TotalOriginalBookProblems      += goals.Count;

            // Averages
            ActualProofProblem.TotalDeducedSteps        += figureStats.averageProblemDeductiveSteps * figureStats.totalInterestingProblems;
            ActualProofProblem.TotalProblemLength       += figureStats.averageProblemLength * figureStats.totalInterestingProblems;
            ActualProofProblem.TotalProblemWidth        += figureStats.averageProblemWidth * figureStats.totalInterestingProblems;
            ActualProofProblem.TotalStrictDeducedSteps  += figureStats.totalStrictInterestingProblems == 0 ? 0 : figureStats.strictAverageProblemDeductiveSteps * figureStats.totalStrictInterestingProblems;
            ActualProofProblem.TotalStrictProblemLength += figureStats.totalStrictInterestingProblems == 0 ? 0 : figureStats.strictAverageProblemLength * figureStats.totalStrictInterestingProblems;
            ActualProofProblem.TotalStrictProblemWidth  += figureStats.totalStrictInterestingProblems == 0 ? 0 : figureStats.strictAverageProblemWidth * figureStats.totalStrictInterestingProblems;

            // Queries
            ActualProofProblem.TotalGoalPartitions   += figureStats.goalPartitionSummary.Count;
            ActualProofProblem.TotalSourcePartitions += figureStats.sourcePartitionSummary.Count;

            // Query: Difficulty Partitioning
            upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructDifficultyPartitionBounds();
            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalDifficulty[i] += figureStats.difficultyPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalDifficulty[upperBounds.Count] += figureStats.difficultyPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;

            upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructDifficultyPartitionBounds();
            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalStrictDifficulty[i] += figureStats.strictDifficultyPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalStrictDifficulty[upperBounds.Count] += figureStats.strictDifficultyPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;
        }
Exemplo n.º 2
0
        public override void Run()
        {
            if (!problemIsOn) return;

            else System.Diagnostics.Debug.WriteLine("----------------------------- " + this.problemName + " -----------------------------");

            // Map the set of clauses from parser to one set of intrinsic clauses.
            ConstructIntrinsicSet();

            // Create the analyzer
            StatisticsGenerator.HardCodedFigureAnalyzerMain analyzer = new StatisticsGenerator.HardCodedFigureAnalyzerMain(intrinsic, given, goals);

            // Perform and time the analysis
            figureStats = analyzer.AnalyzeFigure();

            //
            // If we know it's complete, keep that overridden completeness.
            // Otherwise, determine completeness through analysis of the nodes in the hypergraph.
            //
            if (!this.isComplete) this.isComplete = figureStats.isComplete;

            System.Diagnostics.Debug.WriteLine("Resultant Complete: " + this.isComplete +"\n");

            // Calculate the final numbers: counts of the k-G Strictly interesting problems.
            System.Text.StringBuilder str = new System.Text.StringBuilder();
            for (int k = 1; k <= StatisticsGenerator.FigureStatisticsAggregator.MAX_K; k++)
            {
                str.Append(figureStats.kGcardinalities[k] + "\t");
            }

            if (this.isComplete)
            {
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\complete.txt", true))
                //{
                //    file.WriteLine(str);
                //}
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\completeTime.txt", true))
                //{
                //    file.WriteLine(figureStats.stopwatch.Elapsed);
                //}
            }
            else
            {
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\interesting.txt", true))
                //{
                //    file.WriteLine(str);
                //}
                //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\interestingTime.txt", true))
                //{
                //    file.WriteLine(figureStats.stopwatch.Elapsed);
                //}
            }

            // Add to the cumulative statistics
            ActualProofProblem.TotalTime = ActualProofProblem.TotalTime.Add(figureStats.stopwatch.Elapsed);

            ActualProofProblem.TotalPoints += figureStats.numPoints;
            ActualProofProblem.TotalSegments += figureStats.numPoints;
            ActualProofProblem.TotalInMiddle += figureStats.numInMiddle;
            ActualProofProblem.TotalAngles += figureStats.numAngles;
            ActualProofProblem.TotalTriangles += figureStats.numTriangles;
            ActualProofProblem.TotalIntersections += figureStats.numIntersections;
            ActualProofProblem.TotalTotalProperties += figureStats.totalProperties;

            ActualProofProblem.TotalExplicitFacts += figureStats.totalExplicitFacts;

            ActualProofProblem.TotalGoals += goals.Count;
            ActualProofProblem.TotalProblemsGenerated += figureStats.totalProblemsGenerated;
            ActualProofProblem.TotalBackwardProblemsGenerated += figureStats.totalBackwardProblemsGenerated;

            // Query: Interesting Partitioning
            int numProblemsInPartition;
            List<int> upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructInterestingPartitionBounds();
            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalInteresting[i] += figureStats.interestingPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalInteresting[upperBounds.Count] += figureStats.interestingPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;

            upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructInterestingPartitionBounds();
            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalStrictInteresting[i] += figureStats.strictInterestingPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalStrictInteresting[upperBounds.Count] += figureStats.strictInterestingPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;

            // Rest of Cumulative Stats
            ActualProofProblem.TotalStrictInterestingProblems += figureStats.totalStrictInterestingProblems;
            ActualProofProblem.TotalInterestingProblems += figureStats.totalInterestingProblems;
            ActualProofProblem.TotalOriginalBookProblems += goals.Count;

            // Averages
            ActualProofProblem.TotalDeducedSteps += figureStats.averageProblemDeductiveSteps * figureStats.totalInterestingProblems;
            ActualProofProblem.TotalProblemLength += figureStats.averageProblemLength * figureStats.totalInterestingProblems;
            ActualProofProblem.TotalProblemWidth += figureStats.averageProblemWidth * figureStats.totalInterestingProblems;
            ActualProofProblem.TotalStrictDeducedSteps += figureStats.totalStrictInterestingProblems == 0 ? 0 : figureStats.strictAverageProblemDeductiveSteps * figureStats.totalStrictInterestingProblems;
            ActualProofProblem.TotalStrictProblemLength += figureStats.totalStrictInterestingProblems == 0 ? 0 : figureStats.strictAverageProblemLength * figureStats.totalStrictInterestingProblems;
            ActualProofProblem.TotalStrictProblemWidth += figureStats.totalStrictInterestingProblems == 0 ? 0 : figureStats.strictAverageProblemWidth * figureStats.totalStrictInterestingProblems;

            // Queries
            ActualProofProblem.TotalGoalPartitions += figureStats.goalPartitionSummary.Count;
            ActualProofProblem.TotalSourcePartitions += figureStats.sourcePartitionSummary.Count;

            // Query: Difficulty Partitioning
            upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructDifficultyPartitionBounds();
            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalDifficulty[i] += figureStats.difficultyPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalDifficulty[upperBounds.Count] += figureStats.difficultyPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;

            upperBounds = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructDifficultyPartitionBounds();
            for (int i = 0; i < upperBounds.Count; i++)
            {
                ActualProofProblem.totalStrictDifficulty[i] += figureStats.strictDifficultyPartitionSummary.TryGetValue(upperBounds[i], out numProblemsInPartition) ? numProblemsInPartition : 0;
            }
            ActualProofProblem.totalStrictDifficulty[upperBounds.Count] += figureStats.strictDifficultyPartitionSummary.TryGetValue(int.MaxValue, out numProblemsInPartition) ? numProblemsInPartition : 0;
        }