Reading / Constraint solving

Finding a feasible answer

Sometimes software needs to find an answer that obeys a set of rules before it can ask which answer is best.

Start with what must be true

Constraint solving describes a problem through variables, the choices available to them, and conditions those choices must satisfy. A solver looks for assignments that respect those conditions. The answer may be one feasible arrangement rather than a single universally best result.

This distinction matters when describing a problem. A requirement rules out unacceptable arrangements. A preference ranks arrangements that remain. Mixing the two can make a reasonable preference behave like an absolute prohibition.

Hypothetical example · Three rooms

Imagine assigning three workshops to three rooms. One workshop needs a projector, and two workshops happen at the same time. A feasible arrangement puts the first in an equipped room and keeps simultaneous sessions apart. If the preferred arrangement also minimizes walking, that introduces a separate objective. The example is illustrative; it describes no company activity.

Possible assignmentsRequired conditionsFeasible answers

A model has boundaries

A solver can only account for conditions represented in its model. A perfectly valid answer on paper might still overlook an unrecorded practical need. Before interpreting a result, ask which choices were allowed, which requirements were mandatory, and whether the conditions can all be satisfied together. Those questions make the answer more useful than a bare declaration of success.

Further reading: Google’s introduction to constraint programming.