[Clp-tickets] [COIN-OR Linear Programming Solver] #84: Bug when deleting a column

COIN-OR Linear Programming Solver coin-trac at coin-or.org
Mon Jul 2 10:06:36 EDT 2018


#84: Bug when deleting a column
------------------------+----------------------
 Reporter:  issamt      |      Owner:  somebody
     Type:  defect      |     Status:  new
 Priority:  major       |  Milestone:
Component:  component1  |    Version:
 Keywords:              |
------------------------+----------------------
 Dear developers,

 I think there is a bug in Clp_getVectorStarts when a column in the middle
 is deleted.

 Here below an example (using the C interface) of an LP with 3 cols and 2
 rows. After printing it and deleting the first column, Clp_getVectorStarts
 returns an incorrect vector and you can see it in the print as well.


 {{{
     Clp_Simplex * model = Clp_newModel();

     const int numcols = 3;
     const int numrows = 2;
     const int * start = new int[4] {0, 2, 4, 5};
     const int * index = new int[5] {0, 1, 0, 1, 0};
     const double * value = new double[5] {1.0, 1.0, 1.0, -1.0, 1.0};
     const double * lb = new double[3] {0.0, 0.0, 0.0};
     const double * ub = new double[3] {1.0e20, 1.0e20, 0.0};
     const double* obj = new double[3] {1.0, 2.0, 0.0};
     const double* rowlb = new double[2] {2.0, 0.0};
     const double* rowub = new double[2] {2.0, 1.0e20};

     Clp_loadProblem (model, numcols, numrows, start, index, value, lb, ub,
 obj, rowlb, rowub);

     Clp_setOptimizationDirection(model, -1);

     Clp_printModel(model, "before");

     const int * which = new int[1] {0};
     Clp_deleteColumns(model, 1, which);

     Clp_printModel(model, "after");
 }}}


 OUTPUT:


 {{{
 before numcols = 3, numrows = 2, numelem = 5
 before model = 0x7f9affc0ad70, start = 0x7f9b02809010, index =
 0x7f9b02803c10, value = 0x7f9b02808f60
 Dumping matrix...

 colordered: 1
 major: 3   minor: 2
 vec 0 has length 2 with entries:
                       0               1.0000000000000000000000000
                       1               1.0000000000000000000000000
 vec 1 has length 2 with entries:
                       0               1.0000000000000000000000000
                       1              -1.0000000000000000000000000
 vec 2 has length 1 with entries:
                       0               1.0000000000000000000000000

 Finished dumping matrix
 before start[0] = 0
 before start[1] = 2
 before start[2] = 4
 before start[3] = 5
 before index[0] = 0, value[0] = 1
 before index[1] = 1, value[1] = 1
 before index[2] = 0, value[2] = 1
 before index[3] = 1, value[3] = -1
 before index[4] = 0, value[4] = 1
 before collb = 0x7f9b02803490, colub = 0x7f9b0281b700, obj =
 0x7f9b02805800, rowlb = 0x7f9affc07370, rowub = 0x7f9b02803940
 before optimization direction = -1
   (1 - minimize, -1 - maximize, 0 - ignore)
 before collb[0] = 0, colub[0] = 1e+20, obj[0] = 1
 before collb[1] = 0, colub[1] = 1e+20, obj[1] = 2
 before collb[2] = 0, colub[2] = 0, obj[2] = 0
 before rowlb[0] = 2, rowub[0] = 2
 before rowlb[1] = 0, rowub[1] = 1e+20
 after numcols = 2, numrows = 2, numelem = 3
 after model = 0x7f9affc0ad70, start = 0x7f9b02809010, index =
 0x7f9b02803c10, value = 0x7f9b02808f60
 Dumping matrix...

 colordered: 1
 major: 2   minor: 2
 vec 0 has length 2 with entries:
                       0               1.0000000000000000000000000
                       1              -1.0000000000000000000000000
 vec 1 has length 1 with entries:
                       0               1.0000000000000000000000000

 Finished dumping matrix
 after start[0] = 0
 after start[1] = 4
 after start[2] = 5
 after index[0] = 0, value[0] = 1
 after index[1] = 1, value[1] = -1
 after index[2] = 0, value[2] = 1
 after collb = 0x7f9b028025b0, colub = 0x7f9b02809b30, obj =
 0x7f9b02809a90, rowlb = 0x7f9affc07370, rowub = 0x7f9b02803940
 after optimization direction = -1
   (1 - minimize, -1 - maximize, 0 - ignore)
 after collb[0] = 0, colub[0] = 1e+20, obj[0] = 2
 after collb[1] = 0, colub[1] = 0, obj[1] = 0
 after rowlb[0] = 2, rowub[0] = 2
 after rowlb[1] = 0, rowub[1] = 1e+20
 }}}

 kind regards,
 Issam T.

--
Ticket URL: <https://projects.coin-or.org/Clp/ticket/84>
COIN-OR Linear Programming Solver <http://projects.coin-or.org/Clp>
A linear programming solver.



More information about the Clp-tickets mailing list