get_basis
Returns the basis of the lp.
void get_basis(lprec *lp, int *bascolumn);
Return Value
get_basis has no return value.
Parameters
lp
Pointer to previously created lp model. See return value of make_lp,
copy_lp, read_lp, read_lp_file,
read_LP, read_mps, read_MPS
bascolumn
An array with 1+get_Nrows elements that will contain the basis after the call.
Remarks
The get_basis function returns the basis of the lp.
The array receives the basis variables. If an element is less then zero then it
means on lower bound, else on upper bound.
Element 0 of the array is unused.
The default initial basis is bascolumn[x] = x.
Each element represents a basis variable. If the absolute value is between 1 and get_Nrows, it represents a slack variable and if it is between get_Nrows+1 and get_Nrows+get_Ncolumns then it represents a regular variable. If the value is negative, then the variable is on its lower bound. If positive it is on its upper bound.
Setting an initial basis can speed up the solver considerably. It is the
starting point from where the algorithm continues to find an optimal solution.
When a restart is done, lp_solve continues at the last basis, except if
set_basis or reset_basis is called.
Example
#include <stdio.h>
#include <stdlib.h>
#include "lpkit.h"
int main(void)
{
lprec *lp;
int bascolumn[1+2]; /* must be 1 more then number of rows ! */
/* Create a new LP model */
lp = make_lp(2, 0);
if(lp == NULL) {
fprintf(stderr, "Unable to create new LP model\n");
return(1);
}
get_basis(lp, bascolumn);
delete_lp(lp);
return(0);
}
lp_solve API reference
See Also make_lp, copy_lp,
read_lp, read_lp_file, read_LP, read_mps,
read_MPS, set_basis, reset_basis
