โ† All Picat Flashcard Decks

Tabling for Memoization Flashcards

7 cards from real Picat practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Tabling for Memoization flashcards as text
  1. What does the `table` mode specifier `max` do when applied to an argument in Picat?

    Answer: It keeps only the answer with the largest value for that argument, useful for maximization problems.

    The `max` mode retains only the answer maximizing that argument, enabling optimal-value dynamic programming.

  2. When solving the 0/1 knapsack problem with Picat tabling, which two parameters typically form the call pattern?

    Answer: The current item index and the remaining capacity.

    Knapsack tabling indexes subproblems by item index and remaining capacity, the two dimensions of the DP table.

  3. In Picat, which loop construct can serve as an alternative to tabling for simple iterative DP problems?

    Answer: foreach loops combined with arrays

    Picat's imperative foreach loops over arrays can implement iterative DP directly, avoiding recursive overhead.

  4. What does it mean for a tabled predicate in Picat to have reached a 'fixpoint'?

    Answer: No new answers are generated by further evaluation; the table is complete.

    Fixpoint means iterative tabled evaluation has stabilized: another pass adds no new answers.

  5. Which Picat built-in can be used to inspect or clear the tabling store at runtime?

    Answer: abolish_table_pred/1

    `abolish_table_pred/1` removes all tabled results for a specified predicate from the tabling store.

  6. How does Picat's tabling interact with Picat's constraint solving module?

    Answer: Tabling can be combined with constraint solving, but constrained variables in table entries require careful mode declarations.

    Mixing tabling and constraints requires that output arguments be sufficiently instantiated or use appropriate modes to avoid storing unresolved constraints.

  7. In Picat tabling, what distinguishes 'variant tabling' from 'subsumption-based tabling'?

    Answer: Variant tabling indexes by exact call structure, while subsumption-based tabling reuses answers from more general calls.

    Subsumption-based tabling allows a specific call to reuse answers from a pre-existing more general tabled call, reducing redundancy.