Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoinGetSolutionStatus is returning 0 when the solution is infeasible #13

Open
svigerske opened this issue Mar 4, 2019 · 0 comments
Open
Labels

Comments

@svigerske
Copy link
Member

Issue created by migration from Trac.

Original creator: sstewart

Original creation time: 2017-06-01 07:13:10

Assignee: somebody

Version: 1.0

If I watch the screen output CBC states that the problem is infeasible, but when I query CoinGetSolutionStatus I get 0. To CoinMP this means Optimal Solution Found -- this is wrong. Here's the CoinMP code:

if (!pProblem->SolveAsMIP) {
	pResult->SolutionStatus = pCbc->clp->status();
	pResult->ObjectValue    = pCbc->clp->objectiveValue();
	pResult->MipBestBound   = 0.0;
	pResult->IterCount      = pCbc->clp->numberIterations();
	pResult->MipNodeCount	  = 0;
	}
else {
	pResult->SolutionStatus = pCbc->cbc->status();
	pResult->ObjectValue    = pCbc->cbc->getObjValue();
	pResult->MipBestBound   = pCbc->cbc->getBestPossibleObjValue();
	pResult->IterCount      = pCbc->cbc->getIterationCount();
	pResult->MipNodeCount   = pCbc->cbc->getNodeCount();
}

switch (pResult->SolutionStatus) {
	case 0:	strcpy(pResult->SolutionText, "Optimal solution found");		break;
	case 1:	strcpy(pResult->SolutionText, "Problem primal infeasible");	break;
	case 2:	strcpy(pResult->SolutionText, "Problem dual infeasible");		break;
	case 3:	strcpy(pResult->SolutionText, "Stopped on iterations");			break;
	case 4: strcpy(pResult->SolutionText, "Stopped due to errors");			break;
	case 5: strcpy(pResult->SolutionText, "Stopped by user");		break;

But here is the info from the CBC user guide on Status (https://www.coin-or.org/Cbc/cbcuserguide.html#gettingsolution):

Optimality can be checked through a call to model.isProvenOptimal(). Also available are isProvenInfeasible(), isSolutionLimitReached(), isNodeLimitReached() or the feared isAbandoned(). There is also int status() which returns 0 if finished (which includes the case when the algorithm is finished because it has been proved infeasible), 1 if stopped by user, and 2 if difficulties arose.

So the code might be right for linear but it's wrong for integer...

Wrong in 1.8.3 and trunk as far as I can tell.

Here's the screen output
Starting
File Directory:C:\MPS
Print Matrix: True
Run Solver: True
Coin problem -- error code: -1
Writing matrix to disk
MPS file written to C:\MPS\Solver4.mps
Welcome to the CBC MILP Solver
Version: 2.8
Build Date: Jan 7 2014

command line - CoinMP -solve -quit (default strategy 1)
Continuous objective value is -3.20289 - 0.00 seconds
Cgl0000I Cut generators found to be infeasible! (or unbounded)
Pre-processing says infeasible or unbounded
Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00

and here's the MPS

NAME BLANK
ROWS
N OBJROW
L R0
L R1
L R2
L R3
L R4
L R5
L R6
L R7
L R8
L R9
L R10
L R11
L R12
L R13
L R14
L R15
L R16
L R17
L R18
L R19
L R20
L R21
L R22
L R23
L R24
L R25
L R26
G R27
G R28
G R29
G R30
G R31
G R32
G R33
G R34
G R35
G R36
G R37
G R38
G R39
G R40
G R41
G R42
E R43
E R44
L R45
L R46
L R47
L R48
L R49
L R50
L R51
G R52
G R53
G R54
L R55
L R56
L R57
L R58
G R59
G R60
G R61
COLUMNS
C0 OBJROW -1.2028861 R16 1.202886102
C0 R22 1. R24 3.501
C0 R25 3.501 R26 3.501
C0 R29 1. R30 1.
C0 R43 1. R45 3501.
C0 R51 3501. R53 3501.
C0 R58 3501. R60 3501.
C1 OBJROW -1.2028861 R17 1.202886102
C1 R22 1. R25 3.501
C1 R26 3.501 R30 1.
C1 R48 3501. R58 3501.
C1 R60 3501.
C2 OBJROW -1.2028861 R18 1.202886102
C2 R22 1. R26 3.501
C2 R55 3501.
C3 OBJROW -0.7971139 R16 0.797113898
C3 R23 1. R24 2.32
C3 R25 2.32 R26 2.32
C3 R33 1. R34 1.
C3 R45 2320. R51 2320.
C3 R53 2320. R58 2320.
C3 R60 2320.
C4 OBJROW -0.7971139 R17 0.797113898
C4 R23 1. R25 2.32
C4 R26 2.32 R34 1.
C4 R48 2320. R58 2320.
C4 R60 2320.
C5 OBJROW -0.7971139 R18 0.797113898
C5 R23 1. R26 2.32
C5 R44 1. R55 2320.
C6 OBJROW -1.2028861 R16 1.202886102
C6 R24 -3.501 R25 -3.501
C6 R26 -3.501 R28 -1.
C6 R29 -1. R30 -1.
C6 R37 1. R38 1.
C6 R46 3501. R51 -3501.
C6 R53 -3501. R58 -3501.
C6 R60 -3501.
C7 OBJROW -1.2028861 R17 1.202886102
C7 R25 -3.501 R26 -3.501
C7 R29 -1. R30 -1.
C7 R38 1. R49 3501.
C7 R58 -3501. R60 -3501.
C8 OBJROW -1.2028861 R18 1.202886102
C8 R26 -3.501 R30 -1.
C8 R56 3501.
C9 OBJROW -0.7971139 R16 0.797113898
C9 R24 -2.32 R25 -2.32
C9 R26 -2.32 R32 -1.
C9 R33 -1. R34 -1.
C9 R41 1. R42 1.
C9 R46 2320. R51 -2320.
C9 R53 -2320. R58 -2320.
C9 R60 -2320.
C10 OBJROW -0.7971139 R17 0.797113898
C10 R25 -2.32 R26 -2.32
C10 R33 -1. R34 -1.
C10 R42 1. R49 2320.
C10 R58 -2320. R60 -2320.
C11 OBJROW -0.7971139 R18 0.797113898
C11 R26 -2.32 R34 -1.
C11 R56 2320.
C12 OBJROW -1.2028861 R19 1.202886102
C12 R24 -3.501 R25 -3.501
C12 R26 -3.501 R28 -1.
C12 R29 -1. R30 -1.
C12 R37 1. R38 1.
C12 R46 3501. R51 -3501.
C12 R53 -3501. R58 -3501.
C12 R60 -3501.
C13 OBJROW -1.2028861 R20 1.202886102
C13 R25 -3.501 R26 -3.501
C13 R29 -1. R30 -1.
C13 R38 1. R49 3501.
C13 R58 -3501. R60 -3501.
C14 OBJROW -1.2028861 R21 1.202886102
C14 R26 -3.501 R30 -1.
C14 R56 3501.
C15 OBJROW -0.7971139 R19 0.797113898
C15 R24 -2.32 R25 -2.32
C15 R26 -2.32 R32 -1.
C15 R33 -1. R34 -1.
C15 R41 1. R42 1.
C15 R46 2320. R51 -2320.
C15 R53 -2320. R58 -2320.
C15 R60 -2320.
C16 OBJROW -0.7971139 R20 0.797113898
C16 R25 -2.32 R26 -2.32
C16 R33 -1. R34 -1.
C16 R42 1. R49 2320.
C16 R58 -2320. R60 -2320.
C17 OBJROW -0.7971139 R21 0.797113898
C17 R26 -2.32 R34 -1.
C17 R56 2320.
C42 R45 -5000. R47 1.
C42 R52 1.
C43 R46 -5000. R47 1.
C43 R54 1.
C44 R48 -5000. R50 1.
C44 R52 -1. R59 1.
C45 R49 -5000. R50 1.
C45 R54 -1. R61 1.
C46 R51 4500. R52 1.
C47 R53 -4500. R54 1.
C48 R55 -5000. R57 1.
C48 R59 -1.
C49 R56 -5000. R57 1.
C49 R61 -1.
C50 R58 4500. R59 1.
C51 R60 -4500. R61 1.
RHS
RHS R0 1367. R1 1367.
RHS R2 2941. R3 2941.
RHS R4 766.7 R5 766.7
RHS R6 32.9 R7 32.9
RHS R8 1333.3 R9 1333.3
RHS R10 833.3 R11 833.3
RHS R12 8.22 R13 8.22
RHS R14 3992.3 R15 3992.3
RHS R16 3.2393409792 R17 3.2393409792
RHS R18 3.2393409792 R19 0.8359589624
RHS R20 0.8359589624 R21 0.8359589624
RHS R22 1. R23 1.
RHS R24 5. R25 5.
RHS R26 5. R43 1.
RHS R44 1. R47 1.
RHS R50 1. R51 5000.
RHS R57 1. R58 5000.
BOUNDS
UP BOUND C0 1.
UP BOUND C1 1.
UP BOUND C2 1.
UP BOUND C3 1.
UP BOUND C4 1.
UP BOUND C5 1.
UP BOUND C6 1.
UP BOUND C7 1.
UP BOUND C8 1.
UP BOUND C9 1.
UP BOUND C10 1.
UP BOUND C11 1.
UP BOUND C12 1.
UP BOUND C13 1.
UP BOUND C14 1.
UP BOUND C15 1.
UP BOUND C16 1.
UP BOUND C17 1.
BV BOUND C42 1.
BV BOUND C43 1.
BV BOUND C44 1.
BV BOUND C45 1.
BV BOUND C46 1.
BV BOUND C47 1.
BV BOUND C48 1.
BV BOUND C49 1.
BV BOUND C50 1.
BV BOUND C51 1.
ENDATA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant