Logging

Logging related parameters and functions are essential for users to control the display of solving logs of COPT. This chapter provides an interpretation of loggings for different algorithms, including the following sections:

Parameters and Functions for Logging

Users can control the display of logs by setting related parameters.

  • Logging

    Integer parameter.

    Whether to print optimization logs.

    Default: 1

    Possible values:

    0: No optimization logs.

    1: Print optimization logs.

  • LogToConsole

    Integer parameter.

    Whether to print optimization logs to console.

    Default: 1

    Possible values:

    0: No optimization logs to console.

    1: Print optimization logs to console.

COPT provides operations related to logs, such as setting the logging file.

COPT provides functions to set the logging file, write the optimization logs into the specified file (with the file name suffix .log ), allowing users to save and review the logs. The functions for different programming interfaces are shown in Table 41:

Table 41 Functions for setting logging files in different programming interfaces

Programming Interface

Functions for setting logging files

C

COPT_SetLogFile

C++

Model::SetLogFile()

C#

Model.SetLogFile()

Java

Model.setLogFile()

Python

Model.setLogFile()

Note: When calling these functions, users should specify the file name for saving logs using the logfile parameter.

Basic Information

COPT outputs basic information before starting the solving process, depending on the problem types. The following information is typically displayed:

Model fingerprint: 2c27ab28

Hardware has 64 cores and 128 threads. Using instruction set X86_AVX512_E1 (14)
Minimizing a MIP problem

Here, Model fingerprint represents the unique code for the current model.

The next output provides information about the hardware used, including the number of CPU cores (cores) and threads (threads).

Finally, the problem type and optimization sense are displayed, such as:

Minimizing an LP problem, Minimizing a MIP problem, and Minimizing an SDP problem, etc.

Simplex Method Logging

Based on different stages of the optimization process, the logs for Simplex Method can be divided into three parts:

  1. Presolve

  2. Simplex iteration process

  3. Summary of optimization results

This section uses the logs for example problem afiro.mps to interpret the information in the Simplex Method logging.

Presolve

By default, before starting the Simplex Method, the COPT performs presolve on the model to improve its quality. A preprocessed model will be transmitted to the solver.

The presolve part of the log outputs changes in the model size before and after presolve:

The original problem has:
    27 rows, 32 columns and 83 non-zero elements
The presolved problem has:
    7 rows, 10 columns and 28 non-zero elements

The description of the LP problem size includes the following information:

  • Number of constraints (rows)

  • Number of variables (columns)

  • Number of non-zero elements in the coefficient matrix (non-zero elements)

In the example logs, after presolve, the number of constraints, variables, and non-zero elements in the coefficient matrix are all reduced.

Simplex iteration process

This part of the logs provides relevant information about the iteration process using the Simplex method.

Starting the simplex solver using up to 8 threads

Method   Iteration           Objective  Primal.NInf   Dual.NInf        Time
Dual             0   -4.8553789460e+02            3           0       0.00s
Dual             3   -4.6476735494e+02            0           0       0.00s
Postsolving
Dual             3   -4.6475314286e+02            0           0       0.00s

Here, the first line indicates that the current optimization algorithm is the Simplex method, and it uses 8 threads (threads) for computation.

The subsequent lines represent the simplex iteration process with 6 columns:

  • Method: The optimization algorithm used, where "Dual" represents the dual simplex method.

  • Iteration: The number of iterations.

  • Objective: The objective function value.

  • Primal.NInf: The number of primal infeasibilities in the primal problem.

  • Dual.NInf: The number of dual infeasibilities in the dual problem.

  • Time: The time taken for solving (in seconds).

Summary of Optimization Results

This part of the logs summarizes the results and the iteration process of the Simplex method after completing the solving process.

Solving finished
Status: Optimal  Objective: -4.6475314286e+02  Iterations: 3  Time: 0.00s

The included information consists of:

  • Solving status (Status): If the model has an optimal solution, it is Optimal.

  • Objective function value (Objective): If the model has an optimal solution, Objective displays the optimal objective function value.

  • Total number of iterations (Iterations).

  • Total solving time (Time).

If the model is infeasible, the corresponding log output is as follows:

Solving finished
Status: Infeasible  Objective: -  Iterations: 2  Time: 0.00s

Barrier Method Logging

Based on different stages of the optimization process, the solving logs for the Barrier Method can be divided into three parts:

  1. Presolve

  2. Barrier optimization process

  3. Summary of Optimization Results

Note: By setting the optimization parameter "LpMethod = 2", you can choose the Barrier method as the algorithm for solving linear programming problems.

Similarly, using the example problem afiro.mps, this section interprets the information in the logs for solving LP problems with the Barrier method.

Presolve

By default, before starting the Barrier Method, the COPT performs presolve to reduce the model size. A preprocessed model will be transmitted to the solver.

The presolve part of the log outputs changes in the model size before and after presolve:

The original problem has:
    27 rows, 32 columns and 83 non-zero elements
The presolved problem has:
    7 rows, 10 columns and 28 non-zero elements

Model Information

This part of the log presents relevant numerical information about the model:

Starting barrier solver using 64 threads

Problem info:
Dualized in presolve:            No
Range of matrix coefficients:    [4e-01,4e+00]
Range of rhs coefficients:       [8e+01,3e+02]
Range of bound coefficients:     [4e+01,1e+02]
Range of cost coefficients:      [2e-01,2e+00]

Factor info:
Number of free columns:          0
Number of dense columns:         0
Number of matrix entries:        2.800e+01
Number of factor entries:        2.800e+01
Number of factor flops:          1.140e+02

Here, the first line indicates that the current optimization algorithm is Barrier Method, and it uses 64 threads (threads). The information includes:

  • Problem info output, which includes: whether the dualized model is solved, the range of matrix coefficients, the range of RHS coefficients, the range of bound coefficients for constraint variables, and the range of cost coefficients for the objective function.

  • Factor info output, which includes: the number of free columns, the number of dense columns, information related to the linear system matrix factorization.

Branch-and-Cut Method Logging

Based on different stages of the optimization process, the Branch-and-Cut logging can be divided into three parts:

  1. Presolve

  2. Branch-and-Cut Search Process

  3. Summary of Results

Here, we’ll use the example of cutstock.mps.gz in the “/examples/data” directory of COPT installation package to interpret the information of the MIP log,

Presolve

To simplify the model, the COPT solver performs presolve on the MIP model to eliminate redundant constraints or variable ranges. The information presented in the Presolve log includes the changes in model size before and after presolving.

The original problem has:
    404 rows, 1200 columns and 2598 non-zero elements
    200 binaries and 1000 integers

Presolving the problem

The presolved problem has:
    373 rows, 1169 columns and 2505 non-zero elements
    369 binaries and 800 integers

The description of MIP problem size includes

  • the number of constraints (rows).

  • the number of variables (columns).

  • non-zero elements in the coefficient matrix (non-zero elements).

  • the number of binary variables (binaries).

  • the number of integer variables (integers).

Notes

  • The variable count (cols) here includes all types of variables in the model, including continuous variables, integer variables, and 0-1 variables.

  • In theory, 0-1 variables are a special case of integer variables, but they are counted separately in this context.

In the provided log example, the problem size (number of constraints and variables) is reduced after presolving.

Branch-and-Cut Search Process

This section of the log provides information about the Branch-and-Cut search process.

Starting the MIP solver with 8 threads and 32 tasks

    Nodes    Active  LPit/n  IntInf     BestBound  BestSolution    Gap   Time
        0         1      --       0  3.100000e+01            --    Inf  0.05s
H       0         1      --       0  3.100000e+01  6.800000e+01  54.4%  0.70s
H       0         1      --       0  3.100000e+01  6.600000e+01  53.0%  0.70s
H       0         1      --       0  3.100000e+01  6.500000e+01  52.3%  0.71s
        0         1      --      86  5.591304e+01  6.500000e+01  14.0%  0.72s
H       0         1      --      86  5.591304e+01  6.200000e+01  9.82%  0.74s
        1         2     0.0      86  5.591304e+01  6.200000e+01  9.82%  0.76s
H       1         1    2129       6  6.000000e+01  6.000000e+01  0.00%  0.87s
        2         0    1064       6  6.000000e+01  6.000000e+01  0.00%  0.87s
        2         0    1064       6  6.000000e+01  6.000000e+01  0.00%  0.87s

Note: The presented log content is a partial representation of the optimization process due to space limitation, aiming to facilitating the interpretation of log content.

The Branch-and-Cut search log can be divided into three parts based on the meaning of each information item, and we’ll interpret each part separately:

  • Node search information (columns 1-4)

  • Feasible solution interval information (columns 5-7)

  • Solving time information (column 8)

Node search information (columns 1-4):

  • Nodes: Number of nodes searched.

  • Active: Number of leaf nodes yet to be searched.

  • LPit/n: Average number of Simplex iterations per node.

  • IntInf: Number of integer variables not taking integer values in the current linear relaxation (LP relaxation) solution.

Feasible solution interval information (columns 5-7):

  • BestBound: Current best objective bound.

  • BestSolution: Current best objective function value.

  • Gap: Relative gap between upper and lower bounds. If less than the specified RelGap parameter, the solving process will stop.

Solving time information (column 8):

  • Time: Time taken for solving.

Notes

  • The markers (H/*) before Nodes in the first column indicate the discovery of a new feasible solution.

    • H: Found through heuristics.

    • *: Found by solving subproblems through branching.

  • Sometimes, Nodes stays 0 for an extended period, indicating that COPT is processing the root node. At the root node, COPT generates cutting planes and attempts various heuristic methods to obtain the optimal feasible solution, aiming to reduce the subsequent search scope.

Summary of Results

This part summarizes the final solving status of the MIP problem and the search process of the Branch-and-Cut method, including the model’s solution and the workload of the solving process.

Best solution   : 60.000000000
Best bound      : 60.000000000
Best gap        : 0.0000%
Solve time      : 0.87
Solve node      : 2
MIP status      : solved
Solution status : integer optimal (relative gap limit 0.0001)

Violations    :     absolute     relative
bounds        :            0            0
rows          :            0            0
integrality   :            0

Results:

  • Best objective function value (Best solution).

  • Best lower bound (Best bound).

  • Best gap (Best gap).

  • Solving status (Solution status).

Solving Workload:

  • Solving time (Solve time).

  • Number of nodes searched (Solve node).

The section Violations indicates the extent to which the optimal solution satisfies the model’s constraints and variable ranges. This includes conflict values for variables (bounds) and constraints (rows), as well as conflicts for integer solutions (integrality).

Logging for First-order method (PDLP) of GPU solver

For Linear Programming Problems, if the PDLP method is selected (setting the parameter LpMethod=6 ), GPU solver can be enabled. (The machine needs the compatible GPU and the necessary CUDA library needs to be configured).

The logging for GPU solver can be divided into the following sections, which are slightly different from the CPU solver, with the main distinction in the second section:

  1. Presolve section

  2. GPU hardware information of the machine

  3. First-order method PDLP iteration process

  4. Crossover section

  5. Summary of optimization results

Taking the "thk_63" instance from public LP benchmark as an example, the following is the solving log for the GPU solver.

GPU hardware information of the machine

This section outputs information about the current machine’s GPU information and CUDA version.

Hardware has 1 supported GPU device with CUDA 12.3
  GPU 0: NVIDIA GeForce RTX 4090 (CUDA capability 8.9)

Notes

  1. The "CUDA 12.3" mentioned in the log refers to the highest version of the CUDA Toolkit supported by the currently installed CUDA driver.

  2. COPT’s GPU solver requires a minimum CUDA Toolkit version of 11.7 (for Linux systems, the corresponding minimum CUDA Driver version is 525.60.13; for Windows systems, the corresponding minimum CUDA Driver version is 527.41). It is recommended to directly install CUDA version 12.0 or higher. If you need to use CUDA Toolkit 11.7, please install CUDA Toolkit and CUDA Driver separately. For details, please refer to the FAQ section: GPU Usage.

3. First-order method PDLP iteration process

This section outputs the solving iteration process of the PDLP method, and the summary after the completion, including the iteration count of PDLP, and the optimal objective values, dual gaps for primal and dual problems.

Starting PDLP solver on GPU 0

Iterations      Primal.Obj        Dual.Obj         Gap  Primal.Inf  Dual.Inf    Time
        0  +6.00000000e+00  +6.00000000e+00  +0.00e+00    7.87e+00  0.00e+00  21.63s
     4000  +1.95436674e+03  -1.77166004e+03  +3.73e+03    2.09e-02  0.00e+00  33.37s
     8000  +1.90433201e+03  +1.55817851e+03  +3.46e+02    1.51e-02  0.00e+00  44.75s
    12000  +1.87801607e+03  +1.85689627e+03  +2.11e+01    1.74e-02  0.00e+00  56.27s
    16000  +1.86810632e+03  +1.86897715e+03  +8.71e-01    4.92e-03  0.00e+00  67.72s
    20000  +1.87022842e+03  +1.86994685e+03  +2.82e-01    3.42e-03  0.00e+00  79.18s
    23640  +1.87099459e+03  +1.87099144e+03  +3.15e-03    4.69e-05  0.00e+00  89.68s

PDLP status:                     OPTIMAL
PDLP iterations:                 23640
Primal objective:                1.87099459e+03
Dual objective:                  1.87099144e+03
Primal infeasibility (abs/rel):  4.69e-05 / 6.20e-07
Dual infeasibility (abs/rel):    0.00e+00 / 0.00e+00
Duality gap (abs/rel):           3.15e-03 / 8.43e-07

Experimental: using crossover to find a basic solution after PDLP
Please set parameter Crossover to 0 if the basic solution is not required
Please set parameter PDLPTol to a smaller value if the crossover cleanup takes too long

Starting crossover using up to 8 threads

50320 primal pushes remaining     92.09s
12495 primal pushes remaining     97.71s
 4124 primal pushes remaining       102s
  202 primal pushes remaining       104s
    0 primal pushes remaining       104s
1480858 dual pushes remaining       104s
 589582 dual pushes remaining       106s
      0 dual pushes remaining       107s

Method   Iteration           Objective  Primal.NInf   Dual.NInf        Time
Dual        986011    1.8710000000e+03            0           0     107.97s
Postsolving
Dual        986011    1.8710000000e+03            0           0     110.56s
Unfolding
Dual       1036742    1.8710000000e+03            0           0     157.25s

Solving finished
Status: Optimal  Objective: 1.8710000000e+03  Iterations: 1036742  Time: 157.69s

Note: After solving with a First-order method (PDLP), if the solution reaches optimality (Status: Optimal), the default behavior is to perform the Crossover process to the basic solution. This process can also be disabled by setting the parameter Crossover to 0.