Determines a starting base.

void set_basiscrash(lprec *lp, int mode);

Return Value



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


Specifies which basis crash mode is used. Can by any of the following values:

CRASH_NONE (0) No basis crash
CRASH_MOSTFEASIBLE (2) Most feasible basis
CRASH_LEASTDEGENERATE (3) Construct a basis that is in some measure the "least degenerate"


The set_basiscrash function specifies which basis crash mode must be used. Default is CRASH_NONE.

When no base crash is done (the default), the initial basis from which lp_solve starts to solve the model is the basis containing all slack or artificial variables that is automatically associates with each constraint.

When base crash is enabled, a heuristic ``crash procedure'' is executed before the first simplex iteration to quickly choose a basis matrix that has fewer artificial variables. This procedure tends to reduce the number of iterations to optimality since a number of iterations are skipped. lp_solve starts iterating from this basis until optimality.


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

int main(void)
  lprec *lp;

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

  /* Model created */

  set_basiscrash(lp, CRASH_MOSTFEASIBLE);



lp_solve API reference

See Also make_lp, copy_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_basiscrash, default_basis, read_basis, write_basis, guess_basis, get_basis, set_basis