// // Given, the list of generated, interesting problems, validate (for soundness) the fact that the original book problem was generated. // Do so by constructing a goal-based isomorphism partitioning and check that there exists a problem with the same given set. // private void Validate(List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> problems, ProofProblemFigureStatisticsAggregator figureStats) { GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector query = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructGoalIsomorphismQueryVector(); GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace goalBasedPartitions = new GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace(graph, query); goalBasedPartitions.ConstructPartitions(problems); // Validate that we have generated all of the original problems from the text. List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> generatedBookProblems = goalBasedPartitions.ValidateOriginalProblems(givens, goals); figureStats.totalBookProblemsGenerated = generatedBookProblems.Count; if (GeometryTutorLib.Utilities.PROBLEM_GEN_DEBUG) { goalBasedPartitions.DumpPartitions(); } if (GeometryTutorLib.Utilities.BACKWARD_PROBLEM_GEN_DEBUG) { Debug.WriteLine("\nAll " + generatedBookProblems.Count + " Book-specified problems: \n"); foreach (GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation> bookProb in generatedBookProblems) { Debug.WriteLine(bookProb.ConstructProblemAndSolution(graph)); } } figureStats.goalPartitionSummary = goalBasedPartitions.GetGoalBasedPartitionSummary(); }
// 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); }
// 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; }
// // Given, the list of generated, interesting problems, validate (for soundness) the fact that the original book problem was generated. // Do so by constructing a goal-based isomorphism partitioning and check that there exists a problem with the same given set. // private void Validate(List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > problems, ProofProblemFigureStatisticsAggregator figureStats) { GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector query = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructGoalIsomorphismQueryVector(); GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace goalBasedPartitions = new GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace(graph, query); goalBasedPartitions.ConstructPartitions(problems); // Validate that we have generated all of the original problems from the text. List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > generatedBookProblems = goalBasedPartitions.ValidateOriginalProblems(givens, goals); figureStats.totalBookProblemsGenerated = generatedBookProblems.Count; if (GeometryTutorLib.Utilities.PROBLEM_GEN_DEBUG) { goalBasedPartitions.DumpPartitions(); } if (GeometryTutorLib.Utilities.BACKWARD_PROBLEM_GEN_DEBUG) { Debug.WriteLine("\nAll " + generatedBookProblems.Count + " Book-specified problems: \n"); foreach (GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> bookProb in generatedBookProblems) { Debug.WriteLine(bookProb.ConstructProblemAndSolution(graph)); } } figureStats.goalPartitionSummary = goalBasedPartitions.GetGoalBasedPartitionSummary(); }