7.5 Retrieving information items

After the optimization the user has access to the solution as well as to a report containing a large amount of additional information items. For example, one can obtain information about:

  • timing: total optimization time, time spent in various optimizer subroutines, number of iterations, etc.
  • solution quality: feasibility measures, solution norms, constraint and bound violations, etc.
  • problem structure: counts of variables of different types, constraints, nonzeros, etc.
  • integer optimizer: integrality gap, objective bound, number of cuts, etc.

and more. Information items are numerical values of integer, long integer or double type. The full list can be found in the API reference:

Certain information items make sense, and are made available, also during the optimization process. They can be accessed from a callback function, see Section 7.6 for details.

Remark

For efficiency reasons, not all information items are automatically computed after optimization. To force all information items to be updated use the parameter MSK_IPAR_AUTO_UPDATE_SOL_INFO.

Retrieving the values

Values of information items are fetched using one of the methods

Each information item is identified by a unique name. The example below reads two pieces of data from the solver: total optimization time and the number of interior-point iterations.

Listing 7.3 Information items example. Click here to download.
      res = MSK_getdouinf(task, MSK_DINF_OPTIMIZER_TIME,     &tm);
      res = MSK_getintinf(task, MSK_IINF_INTPNT_ITER,        &iter);     

      printf("Time: %f\nIterations: %d\n", tm, iter);