LP
Simple C/C++ interface to COIN-OR CBC, CPLEX, GLPK and GUROBI, with some interesting features
Functions
Query problem information

Functions

char lp_is_mip (LinearProgram *lp)
 checks if there are integer variables in this program More...
 
char lp_is_integer (LinearProgram *lp, const int j)
 checks if a given variable is integer or continuous More...
 
char lp_is_binary (LinearProgram *lp, const int j)
 checks if a given variable is binary or not More...
 
void lp_cols_by_type (LinearProgram *lp, int *binaries, int *integers, int *continuous)
 counts the number of binary, general integer and continuous variables in this problem More...
 
int lp_cols (LinearProgram *lp)
 returns the numbef of columns (variables) in a given problem More...
 
int lp_rows (LinearProgram *lp)
 returns the numbef of rows (linear constraints) in a given problem More...
 
int lp_nz (LinearProgram *lp)
 returns the numbef of non-zero coefficients in the linear program rows More...
 
int lp_row (LinearProgram *lp, int row, int *idx, double *coef)
 gets the contents of a given row (linear constraint) More...
 
int lp_col (LinearProgram *lp, int col, int *idx, double *coef)
 gets the contents of a given column (variable) More...
 
double lp_rhs (LinearProgram *lp, int row)
 return the right hand side of a given row More...
 
char lp_sense (LinearProgram *lp, int row)
 returns the sense of a given constraints More...
 
char * lp_row_name (LinearProgram *lp, int row, char *dest)
 queries a row name More...
 
char * lp_col_name (LinearProgram *lp, int col, char *dest)
 queries a column name More...
 
double lp_col_lb (LinearProgram *lp, int col)
 queries a column lower bound More...
 
double lp_col_ub (LinearProgram *lp, int col)
 queries a column upper bound More...
 
int lp_col_index (LinearProgram *lp, const char *name)
 returns the column (variable) index of a given column name More...
 
int lp_row_index (LinearProgram *lp, const char *name)
 returns the row (linear constraint) index of a given row name More...
 
const double * lp_obj_coef (LinearProgram *lp)
 return the vector with objective coefficients More...
 
int lp_row_type (LinearProgram *lp, const int row)
 returns the constraint type of a given row More...
 
void lp_rows_by_type (LinearProgram *lp, int rtype[])
 fills the constraint types vector More...
 
int * lp_original_colummns (LinearProgram *lp)
 if this is a pre-processed problem, returns indexes of respective original columns More...
 

Detailed Description

Routines to query problem information

Function Documentation

◆ lp_col()

int lp_col ( LinearProgram lp,
int  col,
int *  idx,
double *  coef 
)

gets the contents of a given column (variable)

Parameters
lpthe (integer) linear program
colcolumn index
pointerto the vector of row indexes that will be filled
pointerto the vector of row coefficients that will be filled
Returns
number of rows that column appears

◆ lp_col_index()

int lp_col_index ( LinearProgram lp,
const char *  name 
)

returns the column (variable) index of a given column name

Parameters
lpthe (integer) linear program
namecolumn name
Returns
column index

◆ lp_col_lb()

double lp_col_lb ( LinearProgram lp,
int  col 
)

queries a column lower bound

Parameters
lpthe (integer) linear program
colcolumn index
Returns
column lower bound

◆ lp_col_name()

char* lp_col_name ( LinearProgram lp,
int  col,
char *  dest 
)

queries a column name

Parameters
lpthe (integer) linear program
colcolumn index
deststring where the column name will be saved
Returns
column name

◆ lp_col_ub()

double lp_col_ub ( LinearProgram lp,
int  col 
)

queries a column upper bound

Parameters
lpthe (integer) linear program
colcolumn index
Returns
column upper bound

◆ lp_cols()

int lp_cols ( LinearProgram lp)

returns the numbef of columns (variables) in a given problem

Parameters
lpthe (integer) linear program
Returns
number of columns (variables)

◆ lp_cols_by_type()

void lp_cols_by_type ( LinearProgram lp,
int *  binaries,
int *  integers,
int *  continuous 
)

counts the number of binary, general integer and continuous variables in this problem

Parameters
lpthe (integer) linear program
binariespointer to the integer that will be used to compute the number of binary variables
integerpointer to the integer that will be used to compute the number of general integer variables
continuouspointer to the integer that will be used to compute the number of continuous variables

◆ lp_is_binary()

char lp_is_binary ( LinearProgram lp,
const int  j 
)

checks if a given variable is binary or not

Parameters
lpthe (integer) linear program
jcolumn index
Returns
1 if variable is integer, 0 otherwise

◆ lp_is_integer()

char lp_is_integer ( LinearProgram lp,
const int  j 
)

checks if a given variable is integer or continuous

Parameters
lpthe (integer) linear program
jcolumn index
Returns
1 if variable is integer, 0 otherwise

◆ lp_is_mip()

char lp_is_mip ( LinearProgram lp)

checks if there are integer variables in this program

Parameters
lpthe (integer) linear program
Returns
1 if there are integer variables, 0 otherwise

◆ lp_nz()

int lp_nz ( LinearProgram lp)

returns the numbef of non-zero coefficients in the linear program rows

Parameters
lpthe (integer) linear program
Returns
number of non-zero coefficients in the linear program rows

◆ lp_obj_coef()

const double* lp_obj_coef ( LinearProgram lp)

return the vector with objective coefficients

Parameters
lpthe (integer) linear program
Returns
vector with objective coefficients

◆ lp_original_colummns()

int* lp_original_colummns ( LinearProgram lp)

if this is a pre-processed problem, returns indexes of respective original columns

Parameters
lpthe (integer) linear program
Returns
vector with indexes of respective original columns

◆ lp_rhs()

double lp_rhs ( LinearProgram lp,
int  row 
)

return the right hand side of a given row

Parameters
lpthe (integer) linear program
Returns
right hand side of row row

◆ lp_row()

int lp_row ( LinearProgram lp,
int  row,
int *  idx,
double *  coef 
)

gets the contents of a given row (linear constraint)

Parameters
lpthe (integer) linear program
rowrow index
idxpointer to the vector of indexes that will be filled
idxpointer to the vector of coefficients that will be filled
Returns
number of non-zeros in row

◆ lp_row_index()

int lp_row_index ( LinearProgram lp,
const char *  name 
)

returns the row (linear constraint) index of a given row name

Parameters
lpthe (integer) linear program
namerow name
Returns
row index

◆ lp_row_name()

char* lp_row_name ( LinearProgram lp,
int  row,
char *  dest 
)

queries a row name

Parameters
lpthe (integer) linear program
rowrow index
deststring where the row name will be saved
Returns
row name

◆ lp_row_type()

int lp_row_type ( LinearProgram lp,
const int  row 
)

returns the constraint type of a given row

Returns the constraint type:

0 : CONS_PARTITIONING : set partitioning constraint
1 : CONS_PACKING : set packing constraint
2 : CONS_COVERING : set covering constraints
3 : CONS_CARDINALITY : cardinality constraint
4 : CONS_KNAPSACK : knapsack constraint
5 : CONS_INV_KNAPSACK : invariant knapsack constraint
6 : CONS_FLOW_BIN : flow constraint with binary variables
7 : CONS_FLOW_INT : flow constraint with general integer variables
8 : CONS_FLOW_MX : flow constraint continuous and or integer variables
9 : CONS_VBOUND : variable bound constraint

Parameters
lpthe (integer) linear program
rowrow index
Returns
constraint type

◆ lp_rows()

int lp_rows ( LinearProgram lp)

returns the numbef of rows (linear constraints) in a given problem

Parameters
lpthe (integer) linear program
Returns
number of rows (linear constraints)

◆ lp_rows_by_type()

void lp_rows_by_type ( LinearProgram lp,
int  rtype[] 
)

fills the constraint types vector

Fills a constraint type vector:

0 : CONS_PARTITIONING : set partitioning constraint
1 : CONS_PACKING : set packing constraint
2 : CONS_COVERING : set covering constraints
3 : CONS_CARDINALITY : cardinality constraint
4 : CONS_KNAPSACK : knapsack constraint
5 : CONS_INV_KNAPSACK : invariant knapsack constraint
6 : CONS_FLOW_BIN : flow constraint with binary variables
7 : CONS_FLOW_INT : flow constraint with general integer variables
8 : CONS_FLOW_MX : flow constraint continuous and or integer variables
9 : CONS_VBOUND : variable bound constraint

Parameters
lpthe (integer) linear program
rtypevector where constraint types will be filled

◆ lp_sense()

char lp_sense ( LinearProgram lp,
int  row 
)

returns the sense of a given constraints

Returns the sense of a given constraint:

E : : equal (=)
G : : greater-or-equal (>=)
L : : less-or-equal (<=)

Parameters
lpthe (integer) linear program
rowrow index