Specifies which add routine performs best. add_column, add_columnex, str_add_column or add_constraint, add_constraintex, str_add_constraint

unsigned char set_add_rowmode(lprec *lp, unsigned char turnon);

Return Value

set_add_rowmode return TRUE if changed from mode and FALSE if this mode was already set.



Pointer to previously created lp model. See return value of make_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI


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.


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


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

int main(void)
  lprec *lp;

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

  set_add_rowmode(lp, TRUE);
  /* first! set the objective function */

  /* now add the constraints */
  set_add_rowmode(lp, FALSE);


lp_solve API reference

See Also make_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, is_add_rowmode, set_obj_fn, set_obj_fnex, str_set_obj_fn, set_obj, add_column, add_columnex, str_add_column, set_column, set_columnex, add_constraint, add_constraintex, str_add_constraint