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, copy_lp, read_lp, read_LP, 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 or the constraint/column is deleted, the return value is 0.

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, 2);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  str_add_constraint(lp, "0 1", LE, 1.0);

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

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

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

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_LP, 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, set_presolve