Beispiel #1
0
        //
        // Atomize the circle by creating:
        //    (1) all radii connecting to other known polygon / circle intersection points.
        //    (2) all chords connecting the radii
        //
        //    All constructed segments may intersect at imaginary points; these need to be calculated
        //
        public static List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion> Atomize(GeometryTutorLib.ConcreteAST.Circle circle)
        {
            List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion> atoms = new List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion>();
            List<GeometryTutorLib.ConcreteAST.Point> interPts = circle.GetIntersectingPoints();

            //
            // Construct the radii
            //
            List<GeometryTutorLib.ConcreteAST.Segment> radii = new List<GeometryTutorLib.ConcreteAST.Segment>();
            foreach (GeometryTutorLib.ConcreteAST.Point interPt in interPts)
            {
                radii.Add(new GeometryTutorLib.ConcreteAST.Segment(circle.center, interPt));
            }

            //
            // Construct the chords
            //
            List<GeometryTutorLib.ConcreteAST.Segment> chords = new List<GeometryTutorLib.ConcreteAST.Segment>();
            for (int p1 = 0; p1 < interPts.Count - 1; p1++)
            {
                for (int p2 = p1 + 1; p2 < interPts.Count; p2++)
                {
                    chords.Add(new GeometryTutorLib.ConcreteAST.Segment(interPts[p1], interPts[p2]));
                }
            }

            //
            // Do any of the chords intersect the radii?
            //

            //
            // Do the chords intersect each other?
            //
            return new List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion>();
        }
Beispiel #2
0
        public PlanarGraphEdge(GeometryTutorLib.ConcreteAST.Point targ, EdgeType type, double c, int initDegree)
        {
            this.target = targ;
            edgeType = type;

            cost = c;
            degree = initDegree;
            isCycle = false;
        }
 public void SendProblem(
     HypergraphWrapper wrapper,
     GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation> p,
     string probStr)
 {
     this.wrapper = wrapper;
     problem = p;
     problemString = probStr;
 }
 public HardCodedShadedAreaMain(List<GeometryTutorLib.ConcreteAST.GroundedClause> fs,
                                List<GeometryTutorLib.ConcreteAST.GroundedClause> giv,
                                GeometryTutorLib.Area_Based_Analyses.KnownMeasurementsAggregator kn,
                                List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion> goalRs,
                                GeometryTutorLib.TutorParser.ImpliedComponentCalculator impl,
                                double area)
     : this(fs, giv, kn, goalRs, impl)
 {
     this.area = area;
 }
        public HardCodedShadedAreaMain(List<GeometryTutorLib.ConcreteAST.GroundedClause> fs,
                                       List<GeometryTutorLib.ConcreteAST.GroundedClause> giv,
                                       GeometryTutorLib.Area_Based_Analyses.KnownMeasurementsAggregator kn,
                                       List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion> goalRs,
                                       GeometryTutorLib.TutorParser.ImpliedComponentCalculator impl)
        {
            this.figure = fs;
            this.given = giv;
            this.known = kn;
            this.goalRegions = goalRs;
            this.area = -1;
            this.implied = impl;

            instantiator = new GeometryTutorLib.GenericInstantiator.Instantiator();
            stopwatch = new Stopwatch();
        }
        //
        // If no radii are drawn, construct them as well as the chords connecting them.
        //
        private void AddImpliedSegments(GeometryTutorLib.ConcreteAST.Circle circle)
        {
            List<GeometryTutorLib.ConcreteAST.Segment> constructedChords = new List<GeometryTutorLib.ConcreteAST.Segment>();
            List<GeometryTutorLib.ConcreteAST.Segment> constructedRadii = new List<GeometryTutorLib.ConcreteAST.Segment>();
            List<Point> imagPoints = new List<Point>();

            List<GeometryTutorLib.ConcreteAST.Point> interPts = circle.GetIntersectingPoints();

            // If there are no points of interest, the circle is the atomic region.
            if (!interPts.Any()) return;

            // Construct the radii
            foreach (Point interPt in interPts)
            {
                GeometryTutorLib.Utilities.AddStructurallyUnique<GeometryTutorLib.ConcreteAST.Segment>(implied.segments,
                                                                                                       new GeometryTutorLib.ConcreteAST.Segment(circle.center, interPt));
            }

            // Construct the chords
            for (int p1 = 0; p1 < interPts.Count - 1; p1++)
            {
                for (int p2 = p1 + 1; p2 < interPts.Count; p2++)
                {
                    GeometryTutorLib.Utilities.AddStructurallyUnique<GeometryTutorLib.ConcreteAST.Segment>(implied.segments,
                                                                                                           new GeometryTutorLib.ConcreteAST.Segment(interPts[p1], interPts[p2]));
                }
            }
        }
Beispiel #7
0
        public void MarkEdge(GeometryTutorLib.ConcreteAST.Point targetNode)
        {
            PlanarGraphEdge edge = GetEdge(targetNode);

            if (edge == null) return;

            edge.isCycle = true;
        }
Beispiel #8
0
        public bool IsCyclicEdge(GeometryTutorLib.ConcreteAST.Point targetNode)
        {
            PlanarGraphEdge edge = GetEdge(targetNode);

            if (edge == null) return false;

            return edge.isCycle;
        }
Beispiel #9
0
        public PlanarGraphEdge GetEdge(GeometryTutorLib.ConcreteAST.Point targ)
        {
            int index = edges.IndexOf(new PlanarGraphEdge(targ));

            return index == -1 ? null : edges[index];
        }
Beispiel #10
0
 public void AddEdge(GeometryTutorLib.ConcreteAST.Point targ, EdgeType type, double c, int initDegree)
 {
     edges.Add(new PlanarGraphEdge(targ, type, c, initDegree));
 }
Beispiel #11
0
 // , NodePointType t)
 // public NodePointType type { get; private set; }
 public PlanarGraphNode(GeometryTutorLib.ConcreteAST.Point value)
 {
     thePoint = value;
     //type = t;
     edges = new List<PlanarGraphEdge>();
 }
Beispiel #12
0
 public void RemoveEdge(GeometryTutorLib.ConcreteAST.Point targetNode)
 {
     edges.Remove(new PlanarGraphEdge(targetNode));
 }
Beispiel #13
0
 // For quick construction only
 public PlanarGraphEdge(GeometryTutorLib.ConcreteAST.Point targ)
 {
     this.target = targ;
 }
        // Simple function for creating a point (if needed since it is not labeled by the UI).
        private Point HandleIntersectionPoint(List<Point> containment, List<Point> toAdd, GeometryTutorLib.ConcreteAST.Segment segment, Point pt)
        {
            if (pt == null) return null;

            // The point must be between the endpoints of the segment
            if (!segment.PointLiesOnAndBetweenEndpoints(pt)) return null;

            return HandleIntersectionPoint(containment, toAdd, pt);
        }
        //
        // 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);
            }
        }
        public Intersection GetIntersection(GeometryTutorLib.ConcreteAST.Segment segment1, GeometryTutorLib.ConcreteAST.Segment segment2)
        {
            Point inter = (Point)Get(segment1.FindIntersection(segment2));

            return (Intersection)Get(new Intersection(inter, segment1, segment2));
        }
        private static int GetComposableCycleWithSegment(UndirectedPlanarGraph.PlanarGraph graph,
                                                         List<MinimalCycle> cycles,
                                                         GeometryTutorLib.ConcreteAST.Segment segment)
        {
            for (int c = 0; c < cycles.Count; c++)
            {
                if (cycles[c].HasThisExtendedSegment(graph, segment)) return c;
            }

            return -1;
        }
        //
        // Validate that calculated area value matches the value from the hard-coded problem.
        //
        private void Validate(GeometryTutorLib.Area_Based_Analyses.ComplexRegionEquation equation, double calculatedArea)
        {
            if (this.area < 0)
            {
                Debug.WriteLine("Cannot validate calculated area since no area was provided.");
            }

            //if (!GeometryTutorLib.Utilities.CompareValues(this.area, calculatedArea))
            //{
            //    throw new Exception("Expected area (" + this.area + ") not found; found (" + calculatedArea + ")");
            //}
        }