LP
Simple C/C++ interface to COIN-OR CBC, CPLEX, GLPK and GUROBI, with some interesting features
|
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... | |
Routines to query problem information
int lp_col | ( | LinearProgram * | lp, |
int | col, | ||
int * | idx, | ||
double * | coef | ||
) |
gets the contents of a given column (variable)
lp | the (integer) linear program |
col | column index |
pointer | to the vector of row indexes that will be filled |
pointer | to the vector of row coefficients that will be filled |
int lp_col_index | ( | LinearProgram * | lp, |
const char * | name | ||
) |
returns the column (variable) index of a given column name
lp | the (integer) linear program |
name | column name |
double lp_col_lb | ( | LinearProgram * | lp, |
int | col | ||
) |
queries a column lower bound
lp | the (integer) linear program |
col | column index |
char* lp_col_name | ( | LinearProgram * | lp, |
int | col, | ||
char * | dest | ||
) |
queries a column name
lp | the (integer) linear program |
col | column index |
dest | string where the column name will be saved |
double lp_col_ub | ( | LinearProgram * | lp, |
int | col | ||
) |
queries a column upper bound
lp | the (integer) linear program |
col | column index |
int lp_cols | ( | LinearProgram * | lp | ) |
returns the numbef of columns (variables) in a given problem
lp | the (integer) linear program |
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
lp | the (integer) linear program |
binaries | pointer to the integer that will be used to compute the number of binary variables |
integer | pointer to the integer that will be used to compute the number of general integer variables |
continuous | pointer to the integer that will be used to compute the number of continuous variables |
char lp_is_binary | ( | LinearProgram * | lp, |
const int | j | ||
) |
checks if a given variable is binary or not
lp | the (integer) linear program |
j | column index |
char lp_is_integer | ( | LinearProgram * | lp, |
const int | j | ||
) |
checks if a given variable is integer or continuous
lp | the (integer) linear program |
j | column index |
char lp_is_mip | ( | LinearProgram * | lp | ) |
checks if there are integer variables in this program
lp | the (integer) linear program |
int lp_nz | ( | LinearProgram * | lp | ) |
returns the numbef of non-zero coefficients in the linear program rows
lp | the (integer) linear program |
const double* lp_obj_coef | ( | LinearProgram * | lp | ) |
return the vector with objective coefficients
lp | the (integer) linear program |
int* lp_original_colummns | ( | LinearProgram * | lp | ) |
if this is a pre-processed problem, returns indexes of respective original columns
lp | the (integer) linear program |
double lp_rhs | ( | LinearProgram * | lp, |
int | row | ||
) |
return the right hand side of a given row
lp | the (integer) linear program |
int lp_row | ( | LinearProgram * | lp, |
int | row, | ||
int * | idx, | ||
double * | coef | ||
) |
gets the contents of a given row (linear constraint)
lp | the (integer) linear program |
row | row index |
idx | pointer to the vector of indexes that will be filled |
idx | pointer to the vector of coefficients that will be filled |
int lp_row_index | ( | LinearProgram * | lp, |
const char * | name | ||
) |
returns the row (linear constraint) index of a given row name
lp | the (integer) linear program |
name | row name |
char* lp_row_name | ( | LinearProgram * | lp, |
int | row, | ||
char * | dest | ||
) |
queries a row name
lp | the (integer) linear program |
row | row index |
dest | string where the row name will be saved |
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
lp | the (integer) linear program |
row | row index |
int lp_rows | ( | LinearProgram * | lp | ) |
returns the numbef of rows (linear constraints) in a given problem
lp | the (integer) linear program |
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
lp | the (integer) linear program |
rtype | vector where constraint types will be filled |
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 (<=)
lp | the (integer) linear program |
row | row index |