del_constraint

Remove a constraint from the lp.

unsigned char del_constraint(lprec *lp, int del_row);

Return Value

del_constraint returns TRUE (1) if the operation was successful. A return value of FALSE (0) indicates an error.
An error occurs when del_row is not between 1 and the number of rows in the lp.
Note that row entry mode must be off, else this function also fails. See set_add_rowmode

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

del_row

The row to delete. Must be between 1 and the number of rows in the lp.

Remarks

The del_constraint function deletes a row from the model. The row is effectively deleted, so all rows after this row shift one up.
Note that row 0 (the objective function) cannot be deleted. There is always an objective function.

Note that if you can also delete multiple constraints by a call to resize_lp.

Example

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

int main(void)
{
  lprec *lp;

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

  del_constraint(lp, 1);

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also resize_lp, make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, add_constraint, add_constraintex, str_add_constraint