Пример #1
0
 public PartitionedProblemSpace(Hypergraph.Hypergraph<ConcreteAST.GroundedClause, Hypergraph.EdgeAnnotation> g, QueryFeatureVector query)
 {
     graph = g;
     partitions = new List<ProblemEquivalenceClass>();
     this.query = query;
     totalProblems = 0;
 }
Пример #2
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;
        }
Пример #3
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());
 }
Пример #4
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);
 }
Пример #5
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());
 }