Hello Andrew

Concerning GLPK version 4.35, released 09-Jan-2009.

I wonder if 'glp_del_rows' and similar should be more
fault-tolerant.

Consider the following incorrect code:

    int nRows = glp_get_num_rows(d_prob);   // GLPK API, returns 0 in this 
example
    std::vector<int> vRows(1, 0);           // contains { 0 } but could be any 
value
    glp_del_rows(d_prob, nRows, &vRows[0]); // GLPK API

which fails thus:

  glp_del_rows: nrs = 0; invalid number of rows
  Error detected in file glpapi01.c at line 1089

This example clearly falls outside documented usage --
but is not itself completely illogical.  I now protect
against such calls, but it might be useful to make GLPK
more tolerant in such circumstances.  Just a thought.

In passing, note the use of the C++ std::vector 'vRows'
as a C array -- in which case, simply pass in the
address of the first element: &vRows[0].  I quite like
this idiom.

cheers, Robbie
---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : [email protected]
Webmail (preferred)           : [email protected]
[from IMAP client]







_______________________________________________
Bug-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-glpk

Reply via email to