Exemplo n.º 1
0
 public PartitionedProblemSpace(Hypergraph.Hypergraph <ConcreteAST.GroundedClause, Hypergraph.EdgeAnnotation> g, QueryFeatureVector query)
 {
     graph         = g;
     partitions    = new List <ProblemEquivalenceClass>();
     this.query    = query;
     totalProblems = 0;
 }
Exemplo n.º 2
0
        public static QueryFeatureVector ConstructSourceIsomorphismQueryVector()
        {
            QueryFeatureVector query = new QueryFeatureVector();

            query.sourceIsomorphism = true;

            return(query);
        }
Exemplo n.º 3
0
        public static QueryFeatureVector ConstructInterestingnessIsomorphismQueryVector(List <int> partitions)
        {
            QueryFeatureVector query = new QueryFeatureVector();

            query.interestingPartitioning = true;

            query.interestingPartitions.SetPartitions(partitions);

            return(query);
        }
Exemplo n.º 4
0
        public static QueryFeatureVector ConstructDeductiveBasedIsomorphismQueryVector(List <int> partitions)
        {
            QueryFeatureVector query = new QueryFeatureVector();

            query.deductiveStepsPartitioning       = true;
            query.rangedDeductiveStepsPartitioning = true;

            query.stepsPartitions.SetPartitions(partitions);

            return(query);
        }
Exemplo n.º 5
0
        public UIFigureAnalyzerMain(EngineUIBridge.ProblemDescription pdesc)
        {
            figure = pdesc.figure;
            givens = pdesc.givens;

            // Create the precomputer object for coordinate-based pre-comutation analysis
            precomputer  = new Precomputer.CoordinatePrecomputer(figure);
            instantiator = new GenericInstantiator.Instantiator();
            queryVector  = new ProblemAnalyzer.QueryFeatureVector();

            EngineUIBridge.JustificationSwitch.SetAssumptions(EngineUIBridge.Assumption.GetAssumptions());
        }
Exemplo n.º 6
0
        //
        // Given a problem and query vector determine strict isomorphism between this problem and this partition of problems
        //
        public bool IsStrictlyIsomorphic(Problem <Hypergraph.EdgeAnnotation> newProblem, QueryFeatureVector query)
        {
            //
            // GOAL
            //
            if (query.goalIsomorphism)
            {
                if (!AreNodesIsomorphic(elements[0].goal, newProblem.goal))
                {
                    return(false);
                }
            }

            //
            // LENGTH
            //
            if (query.lengthPartitioning)
            {
                if (query.rangedLengthPartitioning)
                {
                    if (!AreRangedEqualLength(query, elements[0], newProblem))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!AreEqualLength(elements[0], newProblem))
                    {
                        return(false);
                    }
                }
            }

            //
            // WIDTH
            //
            if (query.widthPartitioning)
            {
                if (query.rangedWidthPartitioning)
                {
                    if (!AreRangedEqualWidth(query, elements[0], newProblem))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!AreEqualWidth(elements[0], newProblem))
                    {
                        return(false);
                    }
                }
            }

            //
            // DEDUCTIVE STEPS
            //
            if (query.deductiveStepsPartitioning)
            {
                if (query.rangedDeductiveStepsPartitioning)
                {
                    if (!AreRangedEqualDeductiveSteps(query, elements[0], newProblem))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!AreEqualDeductiveSteps(elements[0], newProblem))
                    {
                        return(false);
                    }
                }
            }

            //
            // Add other query checks here....
            //

            //
            // Interestingness query (% of givens covered)
            //
            if (query.interestingPartitioning)
            {
                if (!AreRangedEqualInteresting(query, elements[0], newProblem))
                {
                    return(false);
                }
            }

            //
            // SOURCE NODE
            //
            if (query.sourceIsomorphism)
            {
                if (!AreSourceNodesIsomorphic(elements[0].givens, newProblem.givens))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 7
0
 private bool AreRangedEqualInteresting(QueryFeatureVector query, Problem <Hypergraph.EdgeAnnotation> thisProblem, Problem <Hypergraph.EdgeAnnotation> thatProblem)
 {
     return(query.interestingPartitions.GetPartitionIndex(thisProblem.interestingPercentage) ==
            query.interestingPartitions.GetPartitionIndex(thatProblem.interestingPercentage));
 }
Exemplo n.º 8
0
 private bool AreRangedEqualDeductiveSteps(QueryFeatureVector query, Problem <Hypergraph.EdgeAnnotation> thisProblem, Problem <Hypergraph.EdgeAnnotation> thatProblem)
 {
     return(query.stepsPartitions.GetPartitionIndex(thisProblem.GetNumDeductiveSteps()) ==
            query.stepsPartitions.GetPartitionIndex(thatProblem.GetNumDeductiveSteps()));
 }
Exemplo n.º 9
0
 private bool AreRangedEqualWidth(QueryFeatureVector query, Problem <Hypergraph.EdgeAnnotation> thisProblem, Problem <Hypergraph.EdgeAnnotation> thatProblem)
 {
     return(query.widthPartitions.GetPartitionIndex(thisProblem.GetWidth()) == query.widthPartitions.GetPartitionIndex(thatProblem.GetWidth()));
 }