โ† All Picat Flashcard Decks

Constraint Programming with CP 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 Constraint Programming with CP flashcards as text
  1. In Picat's CP module, which predicate is used to declare a list of decision variables with a shared domain?

    Answer: Vars :: [Low..High]

    The `::` operator with a list on the left and a domain expression on the right constrains all variables in the list to that domain.

  2. What does the `indomain` predicate do when called on a CP variable during search in Picat?

    Answer: It assigns the variable each value in its domain on backtracking

    `indomain(Var)` non-deterministically instantiates Var to successive values in its domain, supporting backtracking search.

  3. Which global constraint in Picat's CP module enforces that no two variables take the same value?

    Answer: all_different/1

    `all_different(List)` posts a constraint ensuring every pair of variables in the list has distinct values.

  4. In Picat CP, what is the correct way to post a constraint that X is strictly less than Y?

    Answer: X #< Y

    Arithmetic constraints on CP variables use the `#` prefix operators such as `#`, `#=`, and `#\=`.

  5. What does `solve(Vars)` do in Picat's CP module?

    Answer: Labels all variables in Vars with default search options

    `solve(Vars)` triggers constraint propagation and labeling for the given variable list using default strategies.

  6. Which labeling option in Picat's CP `solve` tells the solver to choose the variable with the smallest remaining domain first?

    Answer: [ff]

    `ff` (fail-first) selects the variable with the fewest remaining domain values, reducing early branching failures.

  7. In Picat CP, what is reification of a constraint?

    Answer: Converting a constraint to a boolean variable that is 1 iff the constraint holds

    Reification links a boolean (0/1) CP variable to a constraint so the variable equals 1 exactly when the constraint is satisfied.