Reading a CP-SAT Solver Log

Learn to interpret the four sections of a CP-SAT solver log: the model summary, the presolve report, the search-progress stream, and the final response. Read incumbent and bound values, compute the relative optimality gap, and tell OPTIMAL apart from FEASIBLE.

Step 1 of 157%

Tutorial

Anatomy of a CP-SAT Log

When CP-SAT solves a model, it prints a structured log with four sections: a model summary, a presolve report, a stream of search-progress lines, and a final response. Reading each section tells us how the solver transformed the problem and how close to optimal the returned solution is.

The model summary enumerates variables and constraints. A typical block reads:

Initial model:\texttt{Initial model:} #Variables: 1200 (#bools: 400 #ints: 800)\texttt{\#Variables: 1200 (\#bools: 400 \#ints: 800)} #kLinear2: 600\texttt{\#kLinear2: 600} #kAllDiff: 25\texttt{\#kAllDiff: 25} #kIntervalVar: 50\texttt{\#kIntervalVar: 50}
  • #Variables\texttt{\#Variables} counts decision variables. #bools\texttt{\#bools} are 0/10/1 variables; #ints\texttt{\#ints} are integer variables with a finite domain.
  • Lines beginning with #k\texttt{\#k}\ldots count constraints by kind. kLinear2\texttt{kLinear2} is a linear constraint with two terms, kAllDiff\texttt{kAllDiff} is an all-different constraint, kIntervalVar\texttt{kIntervalVar} is an interval variable used in scheduling.

The presolve report follows, listing the simplified model:

Presolved model:\texttt{Presolved model:} #Variables: 500 (#bools: 200 #ints: 300)\texttt{\#Variables: 500 (\#bools: 200 \#ints: 300)} #kLinear2: 250\texttt{\#kLinear2: 250}

The number of variables (or constraints of each kind) eliminated by presolve is the initial count minus the presolved count. Here, presolve removed 1200500=7001200 - 500 = 700 variables and 600250=350600 - 250 = 350 linear-2 constraints. Smaller presolved models generally search faster.

navigate · Enter open · Esc close · ⌘K/Ctrl K toggle