# column_in_lp

Check if a column is already present in the lp.

int column_in_lp(lprec *lp, REAL *column);

Return Value

column_in_lp returns the (first) column number if the column is already in the lp and 0 if not.

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

column

An array with 1+get_Nrows elements that are checked against the existing columns in the lp.

Remarks

The column_in_lp functions checks if a column is already present in the lp.
It does not look at bounds and types, only at matrix values.
The first matched column is returned. If there is no column match, then 0 is returned.
Note that element 0 is the objective function value. Element 1 is column 1, and so on.

Example

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

    int main(void)
    {
      lprec *lp;
      REAL column[1+2]; /* must be 1 more then number of rows ! */
      int ret;

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

      column[0] = 0.0;
      column[1] = 0.0;
      column[2] = 0.0;
      ret = column_in_lp(lp, column); /* Will return 1 */

      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, add_column, add_columnex, str_add_column, set_column, set_columnex, del_column