coin-or / coin-or/CyLP

Wrong output isRelaxationInfeasible

Open
#32 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JetBrains MPS
Stars
192
Forks
70
PR merge metrics
No merged PRs in 30d

Description

I just started using CyLP and I'm trying to understand how it works. The following code solves an instance of the famous subset-sum problem:

``` python
m = CyClpSimplex()
x = m.addVariable('x', 5)
c = scipy.matrix([-6,-9,11,12,13])
m += c*x == 0
m += x.sum() >= 1
m += 0 <= x <= 1
m.setInteger(x)
cbcModel = m.getCbcModel()
print(cbcModel.branchAndBound())
print(cbcModel.isRelaxationOptimal())
print(cbcModel.isRelaxationInfeasible())
print(cbcModel.primalVariableSolution['x'])
```

I expect the problem to be infeasible. The last few lines of output are:

> Clp0006I 0 Obj 0 Primal inf 0.77777768 (1)
> Clp0001I Primal infeasible - objective value 0
> Cbc0001I Search completed - best objective 1e+050, took 7 iterations and 12 nodes (0.01 seconds)
> Cbc0032I Strong branching done 18 times (17 iterations), fathomed 0 nodes and fixed 0 variables
> Cbc0035I Maximum depth 2, 0 variables fixed on reduced cost
> Clp0006I 0 Obj 0 Primal inf 1.4444443 (1)
> Clp0006I 0 Obj 0 Primal inf 1.4444443 (1)
> Clp0001I Primal infeasible - objective value 0
> solution
> True
> False
> [ 0. 1.44444444 0. 0. 1. ]

I expect the penultimate three lines to be 'infeasible', 'False, 'True'. What am I doing wrong? Is it possible to have Cbc display model statistics and supress other output?

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.