coin-or / Clp.old

This a mirror of the subversion repository on COIN-OR.
https://projects.coin-or.org/Clp
Other
36 stars 20 forks source link

[TRAC] Clp QP simple simplex failure #53

Open qtothec opened 5 years ago

qtothec commented 5 years ago

Moved from TRAC as part of COIN fORgery: https://projects.coin-or.org/Clp/ticket/24

Using Clp trunk from 2008/09/15, I setup a QP problem as follows:

    ClpSimplex* simplex = new ClpSimplex();
    CoinPackedMatrix* matrix = new CoinPackedMatrix(false, 0, 0);
    // ...
    matrix->setDimensions(0, number_columns);
    // ...
    simplex->loadProblem(*matrix, varLB, varUB, objective, rowLB, rowUB);
    // Setup the quadratic part of a simple "x'Ix + f'x" objective
    // ...
    simplex->loadQuadraticObjective(number_columns, start, column, w_q);
    // Add some rows (~2000) of the form
    for (...) {
        // ...
        simplex->addRow(dim + 1, col_index, col_el, lb, COIN_DBL_MAX);
    }
    // Solve
    simplex->primal();

Clp produces the following output which seems to give the correct objective 2310:

Clp0024I Matrix will be packed to eliminate 307230 small elements
Clp0006I 0  Obj 0 Primal inf 2310 (2310) Dual inf 2310 (2310)
Clp0029I End of values pass after 0 iterations
Clp0006I 0  Obj 0 Primal inf 2310 (2310) Dual inf 2310 (2310)
Clp0006I 200  Obj 0 Primal inf 2110 (2110) Dual inf 2110 (2110)
Clp0006I 400  Obj 0 Primal inf 1910 (1910) Dual inf 1910 (1910)
Clp0006I 600  Obj 0 Primal inf 1710 (1710) Dual inf 1710 (1710)
Clp0006I 800  Obj 0 Primal inf 1510 (1510) Dual inf 1510 (1510)
Clp0006I 1000  Obj 0 Primal inf 1310 (1310) Dual inf 1310 (1310)
Clp0006I 1200  Obj 0 Primal inf 1110 (1110) Dual inf 1110 (1110)
Clp0006I 1400  Obj 0 Primal inf 910 (910) Dual inf 910 (910)
Clp0006I 1600  Obj 0 Primal inf 710 (710) Dual inf 710 (710)
Clp0006I 1800  Obj 0 Primal inf 510 (510) Dual inf 510 (510)
Clp0006I 2000  Obj 0 Primal inf 310 (310) Dual inf 310 (310)
Clp0006I 2200  Obj 0 Primal inf 110 (110) Dual inf 110 (110)
Clp0006I 2310  Obj 0
Clp0000I Optimal - objective value 0  
Clp0006I 0  Obj 2310
Clp0000I Optimal - objective value 2310

However, I check, as I do for LP's, the following

    if (simplex->isProvenOptimal() == false) {
        // error ...
    }

which is triggered and dumps:

Quadratic Program Solver failed.
Problem: 2443 variables, 2310 rows.
Written problem to file "QP-CRASH.qps" for analysis.
         problem sense: 1
STATUS:  numerical difficulties: no
STATUS:       primal infeasible: YES
STATUS:         dual infeasible: no
STATUS: iteration limit reached: no

If I ignore the isProvenOptimal() check and try to obtain the objective using

    const double* primal = simplex->primalColumnSolution();

then it is all-zero, which is not a feasible point.

I checked the dumped QPS file and solved the problem using BPMPD which solves it with objective 2310 (see attached output logfile).

Am I using the interface incorrectly or is this a bug in Clp? Also, if I want to disable any kind of presolve, is there a way to do this using the ClpSimplex? and ClpModel? interfaces? (In initialSolve I can pass a ClpSolve? object, but how to do this just by calling primal()?)

Thanks.

bernalde commented 5 years ago

Attachments: QPS model written https://projects.coin-or.org/Clp/attachment/ticket/24/QP-CRASH.qps.gz BPMPD output log for the QPS model https://projects.coin-or.org/Clp/attachment/ticket/24/QP-CRASH.out.gz

jjhforrest commented 5 years ago

Attached model has bad column names - can't debug problem