โ† 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. Which predicate in Picat's CP module finds a solution that minimizes a given objective expression?

    Answer: solve([min(Obj)], Vars)

    Passing `min(Obj)` as a solve option instructs the CP solver to use branch-and-bound to minimize the objective Obj.

  2. What is the purpose of `element/3` in Picat's CP module?

    Answer: It accesses the Nth element of a list where N is a CP variable

    `element(Index, List, Value)` constrains Value to equal List[Index] when Index is a CP variable, enabling indexed access in models.

  3. In a Picat CP model, what does posting `X #= Y + Z` when Y and Z are already instantiated do?

    Answer: It unifies X with the sum of Y and Z via constraint propagation

    When Y and Z are ground, propagation immediately determines X's value, effectively unifying X with Y+Z within the constraint store.

  4. Which built-in in Picat CP is used to obtain the current lower bound of a variable's domain?

    Answer: fd_min(Var, Lo)

    `fd_min(Var, Lo)` unifies Lo with the minimum value currently in Var's finite domain.

  5. What does the `cumulative/4` global constraint model in Picat CP?

    Answer: Resource allocation where tasks use capacity over time

    `cumulative(Starts, Durations, Resources, Limit)` ensures that at no point in time does the total resource consumption exceed Limit.

  6. In Picat, how do you express that variable X must be different from the integer constant 3?

    Answer: X #\= 3

    `X #\= 3` is the disequality constraint operator for finite-domain variables in Picat's CP module.

  7. What search strategy does `[up]` specify when passed to `solve` in Picat's CP module?

    Answer: Tries the largest value first during value selection

    The `up` value-ordering option makes the solver try the largest value in the domain first at each choice point.