get_Nrows

Returns the number of rows (constraints) in the lp.

int get_Nrows(lprec *lp);

Return Value

get_Nrows returns the number of rows (constraints) in the lp.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI

Remarks

The get_Nrows function returns the number of rows (constraints) in the lp.
Note that the number of rows can change when a presolve is done.
Therefore it is advisable to use this function to determine how many rows there are in the lp instead of relying on an own count.

Example

#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"

int main(void)
{
  lprec *lp;
  int Nrows;

  /* Create a new LP model */
  lp = make_lp(1, 0);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  Nrows = get_Nrows(lp); /* Will return 1 */

  set_presolve(lp, PRESOLVE_ROWS);
  solve(lp);

  Nrows = get_Nrows(lp); /* Will return 0 */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_Norig_rows, get_Lrows, get_Ncolumns, get_Norig_columns, get_orig_index, get_lp_index