Interpretation of solver log
AnsweredHi,
I am trying to interpret the output from the solver log when running one of my mathematical problems. I am trying to emphasise the size and complexity of the problem, but cannot seem to understand the output:
Optimize a model with 775740 rows, 246751 columns and 2584050 nonzeros
Model fingerprint: 0xe03d8eb0
Variable types: 3697 continuous, 243054 integer (0 binary)
Coefficient statistics:
Matrix range [7e-04, 4e+01]
Objective range [4e-04, 4e-01]
Bounds range [1e+00, 1e+00]
RHS range [1e+00, 2e+02]
Presolve removed 695616 rows and 204306 columns (presolve time = 5s) ...
Presolve removed 700320 rows and 206154 columns
Presolve time: 7.12s
Presolved: 75420 rows, 40597 columns, 342264 nonzeros
Variable types: 1 continuous, 40596 integer (37464 binary)
What are the difference between:
- Variable types: 3697 continuous, 243054 integer (0 binary)
- Variable types: 1 continuous, 40596 integer (37464 binary)
Why does the former say there are 0 binary variables, when I have defined 10 as binary variables?
I tried finding the answer on your webpage and previous posts, but were not able to find it.
-
Hi Marthe,
The first line
Variable types: 3697 continuous, 243054 integer (0 binary)
gives the number of variables of the original problem. There are 3697 continuous variables and 243054 integer variables. None of the integer variables is defined as binary.
The second lineVariable types: 1 continuous, 40596 integer (37464 binary)
gives the number of variables of the presolved problem. So, in Presolve many of the variables are removed and many of the remaining integer variables are identified to be actually binary.
Could it be that you defined your binary variables as
z = m.addVar(vtype=GRB.INTEGER, ub=1)
and not asz = m.addVar(vtype=GRB.BINARY, name="z")
In this case, the original variable type is integer and it is counted as an integer variable. In Presolve the variable type would be adapted to binary (if the variable survives Presolve).0 -
I think I have defined them as binary variables. I am using Pulp interface with the Gurobi solver. This is how I defined the binary variables:
Work = plp.LpVariable.dicts("Work", ((e,s,d) for e in range (Employees) for s in Shifts for d in range(Days)), lowBound=0, upBound=1,cat=plp.LpBinary)0 -
I can reproduce the issue. This seems to be a Pulp issue. However, in the end, the variables are handled correctly.
0 -
It looks like PuLP uses integer variables in place of binary variables by design.
https://github.com/coin-or/pulp/blob/a7684ac90d93dc3bca382d90841a9ab5f398b50f/pulp/pulp.py#L266
0
Please sign in to leave a comment.
Comments
4 comments