get_orig_index

Returns the original row/column where a constraint/variable was before presolve.

int get_orig_index(lprec *lp, int lp_index);

Return Value

get_orig_index returns the original row/column where a constraint/variable was before presolve.

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

lp_index

constraint or column number. If lp_index is between 1 and get_Nrows then the index is a constraint (row) number. If lp_index is between 1+get_Nrows and get_Nrows + get_Ncolumns then the index is a column number.

Remarks

The get_orig_index function returns the original row/column where a constraint/variable was before presolve.
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_orig_index returns the original position of the constraint/variable. If lp_index is not a legal index, 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, 1);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

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

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

  index = get_orig_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_lp_index, get_Ncolumns, get_Norig_columns, get_Nrows, get_Norig_rows, get_Lrows, get_lp_index