// Calculate k-G; a set of goals with k propositions
        private void CalculateKnonStrictCardinalities(List<List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>> kgProblems,
                                                      List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> interesting, int MAX_K)
        {
            for (int k = 2; k <= MAX_K; k++)
            {
                // (k-1)-G list:
                List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> kMinus1Problems = kgProblems[k - 2];
                List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> kProblems = new List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>();

                // For each (k-1)-G problem, add each interesting problem, in turn.
                foreach (GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation> kMinus1Problem in kMinus1Problems)
                {
                    if (kMinus1Problem.givens.Count < givens.Count)
                    {
                        // For each k-G, make a copy of the (k-1)-G problem and add the interesting problem to it.
                        foreach (GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation> sgProblem in interesting)
                        {
                            // Make a copy
                            GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation> newKGproblem = new GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>(kMinus1Problem);

                            // Add the interesting problem to it; if the add is successful, the k-G problem is added to
                            if (newKGproblem.AddProblem(sgProblem))
                            {
                                // Debug.WriteLine(kMinus1Problem.ToString() + " + " + sgProblem.ToString() + " = " + newKGproblem.ToString());

                                // Is this problem, based on (Givens, Goals) in this list already?
                                bool alreadyExists = false;
                                foreach (GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation> kProblem in kProblems)
                                {
                                    if (kProblem.HasSameGivensGoals(newKGproblem))
                                    {
                                        alreadyExists = true;
                                        break;
                                    }
                                }

                                if (!alreadyExists) kProblems.Add(newKGproblem);
                            }
                        }
                    }
                }

                // Add the complete set of k-G problems to the list
                kgProblems.Add(kProblems);
            }
        }
Example #2
0
        // Calculate k-G; a set of goals with k propositions
        private void CalculateKnonStrictCardinalities(List <List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > > kgProblems,
                                                      List <GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > interesting, int MAX_K)
        {
            for (int k = 2; k <= MAX_K; k++)
            {
                // (k-1)-G list:
                List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > kMinus1Problems = kgProblems[k - 2];
                List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> > kProblems       = new List <GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> >();

                // For each (k-1)-G problem, add each interesting problem, in turn.
                foreach (GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> kMinus1Problem in kMinus1Problems)
                {
                    if (kMinus1Problem.givens.Count < givens.Count)
                    {
                        // For each k-G, make a copy of the (k-1)-G problem and add the interesting problem to it.
                        foreach (GeometryTutorLib.ProblemAnalyzer.Problem <GeometryTutorLib.Hypergraph.EdgeAnnotation> sgProblem in interesting)
                        {
                            // Make a copy
                            GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> newKGproblem = new GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation>(kMinus1Problem);

                            // Add the interesting problem to it; if the add is successful, the k-G problem is added to
                            if (newKGproblem.AddProblem(sgProblem))
                            {
                                // Debug.WriteLine(kMinus1Problem.ToString() + " + " + sgProblem.ToString() + " = " + newKGproblem.ToString());

                                // Is this problem, based on (Givens, Goals) in this list already?
                                bool alreadyExists = false;
                                foreach (GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem <GeometryTutorLib.Hypergraph.EdgeAnnotation> kProblem in kProblems)
                                {
                                    if (kProblem.HasSameGivensGoals(newKGproblem))
                                    {
                                        alreadyExists = true;
                                        break;
                                    }
                                }

                                if (!alreadyExists)
                                {
                                    kProblems.Add(newKGproblem);
                                }
                            }
                        }
                    }
                }

                // Add the complete set of k-G problems to the list
                kgProblems.Add(kProblems);
            }
        }
        //
        // 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);
            }
        }
Example #4
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);
            }
        }