Ejemplo n.º 1
0
        private List <Problem <Hypergraph.EdgeAnnotation> > GenerateBackwardProblems(List <GroundedClause> goalClauses,
                                                                                     Pebbler.HyperEdgeMultiMap <Hypergraph.EdgeAnnotation> edgeDatabase)
        {
//            System.Diagnostics.Debug.WriteLine("Backward");

            List <int> clauseIndices = AcquireGoalIndices(goalClauses);

            // The resultant structure of problems; graph size dictates associated array size in hashMap; number of givens is a limiting factor the size of problems
            // Problem generation limits the number of givens in BACKWARD problems to 4 (or the constant in the HashMap structure)
            ProblemHashMap <Hypergraph.EdgeAnnotation> problems = new ProblemHashMap <Hypergraph.EdgeAnnotation>(edgeDatabase, graph.vertices.Count);

            // Generate all the problems based on the node indices
            foreach (int goalNode in clauseIndices)
            {
                if (Utilities.PROBLEM_GEN_DEBUG)
                {
                    System.Diagnostics.Debug.WriteLine("Template node; will generate problems (" + goalNode + "): " + graph.vertices[goalNode].data.ToString());
                }

                pathGenerator.GenerateProblemsUsingBackwardPathToLeaves(problems, edgeDatabase, goalNode);
            }

            // Filter backward problems so that only problems with goal being the original figure givens persist.
            return(FilterBackwardProblems(clauseIndices, FilterForMinimalAndRedundantProblems(problems.GetAll())));
        }
Ejemplo n.º 2
0
        public ProblemHashMap(Pebbler.HyperEdgeMultiMap <A> edges, int sz)
        {
            size       = 0;
            TABLE_SIZE = sz;

            table     = new List <Problem <A> > [TABLE_SIZE];
            generated = new bool[TABLE_SIZE];

            edgeDatabase = edges;
            MAX_GIVENS   = DEFAULT_MAX_BACKWARD_GIVENS;
            // FORWARD_GENERATION = false;
        }
Ejemplo n.º 3
0
        // If the user specifies the size, we will never have to rehash
        public ProblemHashMap(Pebbler.HyperEdgeMultiMap <A> edges, int sz, int maxGivens)
        {
            size       = 0;
            TABLE_SIZE = sz;

            table     = new List <Problem <A> > [TABLE_SIZE];
            generated = new bool[TABLE_SIZE];

            edgeDatabase = edges;
            MAX_GIVENS   = maxGivens;
            // FORWARD_GENERATION = true;
        }