coin-or / coin-or/python-mip

Fail to access variable in lazy_constrs_generator callback

Open
#66 9 comments 1 reaction 0 assignees View on GitHub
bug cbc reproducible
Dominant language
Linear Programming
Stars
600
Forks
108
PR merge metrics
No merged PRs in 30d

Description

After seeing "Reduced cost fixing - 45 rows, 117 columns - restarting search" message, variable access in lazy_constrs_generator callback will fail. All variable names are changed.

I see that both heuristics and preprocess are turned off at the beginning. Why it still triggers mini B&B?

The strangest thing is that, this only happens when using PyPy3.6. The same program ran just fine under CPython3.6. I'm using PyPy because it's about 30% faster than CPython for my program.

Any clue or workaround? The full program with data is a little bit long, but I can provide that upon request.

```
Starting MIP optimization
Option for heuristicsOnOff changed from on to off
Option for preprocess changed from sos to off
Option for timeMode changed from cpu to elapsed
maxSavedSolutions was changed from 0 to 10
integerTolerance was changed from 1e-06 to 1e-06
Option for mergeCliques changed from off to after
Option for cliqueCuts changed from ifmove to off
Option for bkcliqueCuts changed from off to ifmove
Option for oddholewcCuts changed from off to ifmove
Continuous objective value is 52.3333 - 0.00 seconds
Cgl0015I Clique merge extended 0 cliques, 0 were dominated
Cutoff increment increased from 1e-05 to 0.9999
Cbc0013I At root node, 0 cuts changed objective from 52.333333 to 52.333333 in 1 passes
Cbc0014I Cut generator 0 (LazyConstraints) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is 1
Cbc0014I Cut generator 1 (Probing) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 2 (Gomory) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 3 (Knapsack) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 4 (BKClique) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 5 (OddHoleWC) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 6 (MixedIntegerRounding2) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 7 (FlowCover) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 8 (TwoMirCuts) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 9 (ZeroHalf) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0016I Integer solution of 92 found by strong branching after 182 iterations and 37 nodes (0.30 seconds)
Cbc0038I Full problem 228 rows 182 columns, reduced to 45 rows 117 columns
Cbc0044I Reduced cost fixing - 45 rows, 117 columns - restarting search
Cbc0012I Integer solution of 83 found by Previous solution after 0 iterations and 0 nodes (0.38 seconds)
From cffi callback .cbc_cut_callback at 0x00007fffef4d52e0>:
Traceback (most recent call last):
File "/localworkspaces/pypy3.6-v7.3.0-linux64/site-packages/mip/cbc.py", line 763, in cbc_cut_callback
self.model.lazy_constrs_generator.generate_constrs(osi_model)
File "/localworkspaces/pysandbox/stp14.py", line 142, in generate_constrs
selected = [n for n, nv in nsv.items() if nv.x >= 0.99]
File "/localworkspaces/pysandbox/stp14.py", line 142, in
selected = [n for n, nv in nsv.items() if nv.x >= 0.99]
AttributeError: 'NoneType' object has no attribute 'x'

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.