Exemple #1
0
        private static IEnumerable <ProblemGeneratorInput> Triangle_FourObjects_ThreeLinesAndOnePoint_OnlySymmetric_OnlyUsedLines_PlusTwoObjects()
        {
            // Create the loose objects
            var A = new LooseConfigurationObject(Point);
            var B = new LooseConfigurationObject(Point);
            var C = new LooseConfigurationObject(Point);

            // Create the initial configuration
            var configuration = Configuration.DeriveFromObjects(Triangle, A, B, C);

            // Create the dictionary with the counts of objects to be added
            var maximalNumbersOfObjectsObjectsToAdd = new Dictionary <ConfigurationObjectType, int>
            {
                { Point, 1 },
                { Line, 3 },
                { Circle, 0 }
            };

            // Prepare the generator input that takes only fully symmetric configurations
            var problemGeneratorInput = new ProblemGeneratorInput(configuration, _constructions, numberOfIterations: 4, maximalNumbersOfObjectsObjectsToAdd, SymmetryGenerationMode.GenerateOnlySymmetric);

            // Prepare the generator settings
            var settings = new ProblemGeneratorSettings(numberOfPictures: 2);

            // Return the generation enumerable by taking the generator
            return(_kernel.Get <IProblemGenerator>(new ConstructorArgument("settings", settings))
                   // Pass the input to it
                   .Generate(problemGeneratorInput)
                   // Unwrap the enumerable
                   .generationOutputs
                   // Take the configuration
                   .Select(output => output.Configuration)
                   // That is on the last iteration
                   .Where(configuration => configuration.IterationIndex == 4)
                   // Exclude those where there is a hanging line
                   .Where(configuration => !configuration.ObjectMap.GetObjectsForKeys(Line).Any(line
                                                                                                // We don't want a line that is not used in a construction
                                                                                                => configuration.ConstructedObjects.All(constructedObject => !constructedObject.PassedArguments.FlattenedList.Contains(line))))
                   // Every generated configuration makes an input file
                   .Select(configuration => new ProblemGeneratorInput(configuration, _constructions,
                                                                      // We will want 2 iterations
                                                                      numberOfIterations: 2,
                                                                      // Set maximal numbers of objects to be added
                                                                      new Dictionary <ConfigurationObjectType, int>
            {
                // Points and lines are not limited
                { Point, 2 },
                { Line, 2 },

                // We want at most 2 circles in total. More are not necessary, since circles
                // never appear as construction arguments, only in theorems itself, and at most
                // two of them (when we have two tangent circles)
                { Circle, 2 - configuration.ObjectMap.GetObjectsForKeys(Circle).Count() }
            },
                                                                      // We will want only symmetric results
                                                                      symmetryGenerationMode: SymmetryGenerationMode.GenerateOnlySymmetric)));
        }
Exemple #2
0
        private static IEnumerable <ProblemGeneratorInput> Quadrilateral_TwoObjects_PlusTwoObjects()
        {
            // Create the loose objects
            var A = new LooseConfigurationObject(Point);
            var B = new LooseConfigurationObject(Point);
            var C = new LooseConfigurationObject(Point);
            var D = new LooseConfigurationObject(Point);

            // Create the initial configuration
            var configuration = Configuration.DeriveFromObjects(Quadrilateral, A, B, C, D);

            // Create the dictionary with the counts of objects to be added
            var maximalNumbersOfObjectsObjectsToAdd = new Dictionary <ConfigurationObjectType, int>
            {
                { Point, 2 },
                { Line, 2 },
                { Circle, 2 }
            };

            // Prepare the generator input that doesn't exclude asymmetric configurations
            var problemGeneratorInput = new ProblemGeneratorInput(configuration, _constructions, numberOfIterations: 2, maximalNumbersOfObjectsObjectsToAdd, SymmetryGenerationMode.GenerateBothSymmetricAndAsymmetric);

            // Prepare the generator settings
            var settings = new ProblemGeneratorSettings(numberOfPictures: 2);

            // Return the generation enumerable by taking the generator
            return(_kernel.Get <IProblemGenerator>(new ConstructorArgument("settings", settings))
                   // Pass the input to it
                   .Generate(problemGeneratorInput)
                   // Unwrap the enumerable
                   .generationOutputs
                   // Take the configuration
                   .Select(output => output.Configuration)
                   // That is on the last iteration
                   .Where(configuration => configuration.IterationIndex == 2)
                   // Every generated configuration makes an input file
                   .Select(configuration => new ProblemGeneratorInput(configuration, _constructions,
                                                                      // We will want plus 2 objects
                                                                      numberOfIterations: 2,
                                                                      // Set maximal numbers of objects to be added
                                                                      new Dictionary <ConfigurationObjectType, int>
            {
                // Points and lines are not limited
                { Point, 2 },
                { Line, 2 },

                // We want at most 2 circles in total. More are not necessary, since circles
                // never appear as construction arguments, only in theorems itself, and at most
                // two of them (when we have two tangent circles)
                { Circle, 2 - configuration.ObjectMap.GetObjectsForKeys(Circle).Count() }
            },
                                                                      // We will want only symmetric results
                                                                      symmetryGenerationMode: SymmetryGenerationMode.GenerateOnlySymmetric)));
        }