docplex.mp.sdetails module

class docplex.mp.sdetails.SolveDetails(time=0, dettime=0, status_code=-1, status_string=None, problem_type=None, ncolumns=0, nonzeros=0, miprelgap=None, best_bound=None, n_iterations=0, n_nodes_processed=0)[source]

Bases: object

The SolveDetails class contains the details of a solve.

This class should never be instantiated. You get an instance of this class from the model by calling the property docplex.mp.model.Model.solve_details.

best_bound

This property returns the MIP best bound at the end of the solve.

Note

  • This property returns NaN when the problem is not a MIP.
  • This property returns 1e+20 for multi-objective MIP problems.
columns

This property returns the number of columns.

deterministic_time

This property returns the solve deterministic time in ticks.

dettime

This property returns the solve deterministic time in ticks.

gap

This property returns the MIP relative gap.

Note

  • This property returns NaN when the problem is not a MIP.
  • This property returns 1e+20 for multi-objective MIP problems.
  • The gap is returned as a floating-point value, not as a percentage.
has_hit_limit()[source]

Checks if the solve details indicate that the solve has hit a limit.

Returns:True if the solve details indicate that the solve has hit a limit.
Return type:Boolean
mip_relative_gap

This property returns the MIP relative gap.

Note

  • This property returns NaN when the problem is not a MIP.
  • This property returns 1e+20 for multi-objective MIP problems.
  • The gap is returned as a floating-point value, not as a percentage.
nb_iterations

This property returns the number of iterations at the end of the solve.

Note

  • The nature of the iterations depend on the algorithm usd to solve the model.
  • For multi-objective models, this property returns a tuple of numbers,
    one for each objective solved.
nb_linear_nonzeros

This property returns the number of linear non-zeros in the matrix solved.

nb_nodes_processed

This property returns the number of nodes processed at the end of solve.

Note: for multi-objective problems, this property returns a tuple of numbers,
one for each objective solved.
problem_type

This property returns the problem type as a string.

status

This property returns the solve status as a string.

This string is normally the value returned by the CPLEX callable library method CPXXgetstatstring, see https://www.ibm.com/support/knowledgecenter/SSSA5P_20.1.0/ilog.odms.cplex.help/refcallablelibrary/cpxapi/getstatstring.html

Example

  • Returns “optimal” when the solution has been proven optimal.
  • Returns “feasible” for a feasible, but not optimal, solution.
  • Returns “MIP_time_limit_feasible” for a MIP solution obtained before a time limit.

Note

In certain cases, status may return a string that is not directly passed from CPLEX

  • If an exception occurs during the CPLEX solve phase, status contains the text of the exception.
  • If solve fails because of a promotional version limitation, the following message is returned
    “Promotional version. Problem size limits exceeded., CPLEX code=1016.” The corresponding status code is 1016.
status_code

This property returns the CPLEX status code as a number. Possible values for the status code are described in the CPLEX documentation at: https://www.ibm.com/support/knowledgecenter/SSSA5P_20.1.0/ilog.odms.cplex.help/refcallablelibrary/macros/Solution_status_codes.html

Returns:an integer number (a CPLEX status code)
time

This property returns the solve time in seconds.