is_add_rowmode

Returns a flag which of the add routines perform best.

unsigned char is_add_rowmode(lprec *lp);

Return Value

is_add_rowmode returns TRUE or FALSE. If FALSE, then add_column, add_columnex, str_add_column performs best. If TRUE, then add_constraint, add_constraintex, str_add_constraint performs best.

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

Remarks

Default, this is FALSE, meaning that add_column, add_columnex, str_add_column performs best. If the model is build via add_constraint, add_constraintex, str_add_constraint calls, then these routines will be much faster if this routine is called with turnon set on TRUE. This is also called row entry mode. The speed improvement is spectacular, especially for bigger models, so it is advisable to call this routine to set the mode. Normally a model is build either column by column or row by row.
Note that there are several restrictions with this mode:
Only use this function after a make_lp call. Not when the model is read from file. Also, if this function is used, first add the objective function via set_obj_fn, set_obj_fnex, str_set_obj_fn and after that add the constraints via add_constraint, add_constraintex, str_add_constraint. Don't call other API functions while in row entry mode. No other data matrix access is allowed while in row entry mode. After adding the contraints, turn row entry mode back off. Once turned of, you cannot switch back to row entry mode. So in short:
- turn row entry mode on
- set the objective function
- create the constraints
- turn row entry mode off

Example

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

int main(void)
{
  lprec *lp;
  unsigned char rowmode;

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

  rowmode = is_add_rowmode(lp); /* Will return FALSE */

  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, set_add_rowmode, set_add_rowmode, set_obj_fn, set_obj_fnex, str_set_obj_fn, set_obj, add_column, add_columnex, str_add_column, add_constraint, add_constraintex, str_add_constraint