get_lp_index

Returns the index in the lp of the original row/column.

int get_lp_index(lprec *lp, int orig_index);

Return Value

get_lp_index returns the index in the lp of the original row/column.

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

orig_index

Original constraint or column number. If orig_index is between 1 and get_Norig_rows then the index is a constraint (row) number. If orig_index is between 1 + get_Norig_rows and get_Norig_rows + get_Norig_columns then the index is a column number.

Remarks

The get_lp_index function returns the index in the lp of the original row/column.
Note that the number of constraints (get_Nrows) and columns (get_Ncolumns) can change when a presolve is done or when negative variables are split in a positive and a negative part. get_lp_index returns the position of the constraint/variable in the lp. If orig_index is not a legal index, the return value is 0. If the constraint/column is deleted by presolve, then the return value is negative.

Example

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

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

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

  index = get_lp_index(lp, 1); /* Will return 1 */

  set_presolve(lp, PRESOLVE_COLS);
  solve(lp);

  index = get_lp_index(lp, 1); /* Will return -1 */

  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_orig_index, get_Ncolumns, get_Norig_columns, get_Nrows, get_Norig_rows, get_Lrows