# Using lp_solve 5.5 in Java programs

## C - Java function reference

This file contains a reference for all methods in the lp_solve library and the Java wrapper. The first column of the following table contains the C functions of the lp_solve library, the second column the corresponding methods of the Java wrapper.

C function | Java wrapper method (LpSolve class)
--- | ---
unsigned char add_column (lprec* lp, REAL* column) | void addColumn(double[] column) throws LpSolveException
unsigned char add_columnex (lprec* lp, int count, REAL* column, int* rowno) | void addColumnex(int count, double[] column, int[] rowno) throws LpSolveException
unsigned char add_constraint (lprec* lp, REAL *row, int constr_type, REAL rh) | void addConstraint(double[] row, int constrType, double rh) throws LpSolveException
unsigned char add_constraintex (lprec *lp, int count, REAL *row, int *colno, int constr_type, REAL rh) | void addConstraintex(int count, double[] row, int[] colno, int constrType, double rh) throws LpSolveException
unsigned char add_lag_con (lprec* lp, REAL *row, int con_type, REAL rhs) | void addLagCon(double[] row, int constrType, double rh) throws LpSolveException
int add_SOS (lprec* lp, char *name, int sostype, int priority, int count, int *sosvars, REAL *weights) | void addSOS(String name, int sostype, int priority, int count, int[] sosvars, double[] weights) throws LpSolveException
int column_in_lp (lprec* lp, REAL *column) | int columnInLp(double[] column)
void default_basis (lprec* lp) | void defaultBasis()
unsigned char del_column(lprec *lp, int column) | void delColumn(int columnnr) throws LpSolveException
unsigned char del_constraint(lprec *lp, int del_row) | void delConstraint(int rownr) throws LpSolveException
void delete_lp(lprec *lp) | void deleteLp()
void free_lp(lprec **plp) | <Not implemented, use deleteLp() instead>
int get_anti_degen(lprec *lp) | int getAntiDegen()
void get_basis(lprec *lp, int *bascolumn, unsigned char nonbasic) | void getBasis(int[] bascolumn, boolean nonbasic)
int get_basiscrash(lprec *lp) | int getBasiscrash()
int get_bb_depthlimit(lprec *lp) | int getBbDepthlimit()
int get_bb_floorfirst(lprec *lp) | int getBbFloorfirst()
int get_bb_rule(lprec *lp) | int getBbRule()
unsigned char get_bounds_tighter(lprec *lp) | boolean getBoundsTighter()
REAL get_break_at_value(lprec *lp) | double getBreakAtValue()
char *get_col_name(lprec *lp, int column) | String getColName(int colnr) throws LpSolveException
unsigned char get_column(lprec *lp, int col_nr, REAL *column) | void getColumn(int columnrnr, double[] column) throws LpSolveException
<Not implemented> | double[] getPtrColumn(int columnrnr) throws LpSolveException
int get_constr_type(lprec *lp, int row) | short getConstrType(int rownr) throws LpSolveException
unsigned char get_constraints(lprec *lp, REAL *constr) | void getConstraints(double[] var) throws LpSolveException
unsigned char get_dual_solution(lprec *lp, REAL *duals) | void getDualSolution(double[] duals) throws LpSolveException
REAL get_epsb(lprec *lp) | double getEpsb()
REAL get_epsd(lprec *lp) | double getEpsd()
REAL get_epsel(lprec *lp) | double getEpsel()
REAL get_epsint(lprec *lp) | double getEpsint()
REAL get_epsperturb(lprec *lp) | double getEpsperturb()
REAL get_epspivot(lprec *lp) | double getEpspivot()
int get_improve(lprec *lp) | int getImprove()
REAL get_infinite(lprec *lp) | double getInfinite()
unsigned char get_lambda(lprec *lp, REAL *lambda) | void getLambda(double[] lambda) throws LpSolveException
REAL get_lowbo(lprec *lp, int column) | double getLowbo(int colnr) throws LpSolveException
int get_lp_index(lprec *lp, int orig_index) | int getLpIndex(int index)
char *get_lp_name(lprec *lp) | String getLpName() throws LpSolveException
int get_Lrows(lprec *lp) | int getLrows()
REAL get_mat(lprec *lp, int row, int column) | double getMat(int row, int column)
int get_max_level(lprec *lp) | int getMaxLevel()
int get_maxpivot(lprec *lp) | int getMaxpivot()
REAL get_mip_gap(lprec *lp, unsigned char absolute) | double getMipGap(boolean absolute)
int get_Ncolumns(lprec *lp) | int getNcolumns()
REAL get_negrange(lprec *lp) | double getNegrange()
int get_nonzeros(lprec *lp) | int getNonzeros()
int get_Norig_columns(lprec *lp) | int getNorigColumns()
int get_Norig_rows(lprec *lp) | int getNorigRows()
int get_Nrows(lprec *lp) | int getNrows()
REAL get_obj_bound(lprec *lp) | double getObjBound()
REAL get_objective(lprec *lp) | getObjective()
int get_orig_index(lprec *lp, int lp_index) | int getOrigIndex(int index)
char *get_origcol_name(lprec *lp, int column) | String getOrigcolName(int colnr) throws LpSolveException
char *get_origrow_name(lprec *lp, int row) | String getOrigrowName(int rownr) throws LpSolveException
int get_pivoting(lprec *lp) | int getPivoting()
int get_presolve(lprec *lp) | int getPresolve()
unsigned char get_primal_solution(lprec *lp, REAL *pv) | void getPrimalSolution(double[] pv) throws LpSolveException
int get_print_sol(lprec *lp) | int getPrintSol()
unsigned char get_ptr_constraints(lprec *lp, REAL **ptr_constr) | double[] getPtrConstraints() throws LpSolveException
unsigned char get_ptr_dual_solution(lprec *lp, REAL **ptr_duals) | double[] getPtrDualSolution() throws LpSolveException
unsigned char get_ptr_lambda(lprec *lp, REAL **ptr_lambda) | double[] getPtrLambda() throws LpSolveException
unsigned char get_ptr_primal_solution(lprec *lp, REAL **ptr_pv) | double[] getPtrPrimalSolution() throws LpSolveException
unsigned char get_ptr_sensitivity_obj(lprec *lp, REAL **ptr_objfrom, REAL **ptr_objtill) | double[][] getPtrSensitivityObj() throws LpSolveException
unsigned char get_ptr_sensitivity_objex(lprec *lp, REAL **ptr_objfrom, REAL **ptr_objtill, REAL *ptr_objfromvalue, REAL *ptr_objtillvalue) | double[][] getPtrSensitivityObjex() throws LpSolveException
unsigned char get_ptr_sensitivity_rhs(lprec *lp, REAL **ptr_duals, REAL **ptr_dualsfrom, REAL **ptr_dualstill) | double[][] getPtrSensitivityRhs() throws LpSolveException
unsigned char get_ptr_variables(lprec *lp, REAL **ptr_var) | double[] getPtrVariables() throws LpSolveException
REAL get_rh(lprec *lp, int row) | double getRh(int row)
REAL get_rh_range(lprec *lp, int row) | double getRhRange(int rownr) throws LpSolveException
unsigned char get_row(lprec *lp, int row_nr, REAL *row) | void getRow(int rownr, double[] row) throws LpSolveException
<Not implemented> | double[] getPtrRow(int rownr) throws LpSolveException
char *get_row_name(lprec *lp, int row) | String getRowName(int rownr) throws LpSolveException
REAL get_scalelimit(lprec *lp) | double getScalelimit()
int get_scaling(lprec *lp) | int getScaling()
unsigned char get_sensitivity_obj(lprec *lp, REAL *objfrom, REAL *objtill) | void getSensitivityObj(double[] objfrom, double[] objtill) throws LpSolveException
unsigned char get_sensitivity_objex(lprec *lp, REAL *objfrom, REAL *objtill, REAL *objfromvalue, REAL *objtillvalue) | void getSensitivityObjex(double[] objfrom, double[] objtill, double[] objfromvalue, double[] objtillvalue) throws LpSolveException
unsigned char get_sensitivity_rhs(lprec *lp, REAL *duals, REAL *dualsfrom, REAL *dualstill) | void getSensitivityRhs(double[] duals, double[] dualsfrom, double[] dualstill) throws LpSolveException
int get_simplextype(lprec *lp) | int getSimplextype()
int get_solutioncount(lprec *lp) | int getSolutioncount()
int get_solutionlimit(lprec *lp) | int getSolutionlimit()
int get_status(lprec *lp) | int getStatus()
char *get_statustext(lprec *lp, int statuscode) | String getStatustext(int statuscode)
long get_timeout(lprec *lp) | long getTimeout()
int get_total_iter(lprec *lp) | int getTotalIter()
int get_total_nodes(lprec *lp) | int getTotalNodes()
REAL get_upbo(lprec *lp, int column) | double getUpbo(int colnr) throws LpSolveException
int get_var_branch(lprec *lp, int column) | int getVarBranch(int colnr) throws LpSolveException
REAL get_var_dualresult(lprec *lp, int index) | double getVarDualresult(int index) throws LpSolveException
REAL get_var_primalresult(lprec *lp, int index) | double getVarPrimalresult(int index) throws LpSolveException
int get_var_priority(lprec *lp, int column) | int getVarPriority(int colnr) throws LpSolveException
unsigned char get_variables(lprec *lp, REAL *var) | void getVariables(double[] var) throws LpSolveException
int get_verbose(lprec *lp) | int getVerbose()
REAL get_working_objective(lprec *lp) | double getWorkingObjective() throws LpSolveException
unsigned char guess_basis(lprec *lp, double *guessvector, int *basisvector) | void guessBasis(double[] guessvector, int[] basisvector) throws LpSolveException
unsigned char has_BFP(lprec *lp) | boolean hasBFP()
unsigned char has_XLI(lprec *lp) | boolean hasXLI()
unsigned char is_add_rowmode(lprec *lp) | boolean isAddRowmode()
unsigned char is_anti_degen(lprec *lp, int testmask) | boolean isAntiDegen(int testmask)
unsigned char is_binary(lprec *lp, int column) | boolean isBinary(int colnr)
unsigned char is_break_at_first(lprec *lp) | boolean isBreakAtFirst()
unsigned char is_constr_type(lprec *lp, int row, int mask) | boolean isConstrType(int row, int mask)
unsigned char is_debug(lprec *lp) | boolean isDebug()
unsigned char is_feasible(lprec *lp, REAL *values, REAL threshold) | boolean isFeasible(double[] values, double threshold) throws LpSolveException
unsigned char is_free(lprec *lp, int column) | boolean isFree(int colnr)
unsigned char is_infinite(lprec *lp, REAL value) | boolean isInfinite(double value)
unsigned char is_int(lprec *lp, int column) | boolean isInt(int colnr)
unsigned char is_integerscaling(lprec *lp) | boolean isIntegerscaling()
unsigned char is_lag_trace(lprec *lp) | boolean isLagTrace()
unsigned char is_maxim(lprec *lp) | boolean isMaxim()
unsigned char is_nativeBFP(lprec *lp) | boolean isNativeBFP()
unsigned char is_nativeXLI(lprec *lp) | boolean isNativeXLI()
unsigned char is_negative(lprec *lp, int column) | boolean isNegative(int colnr)
unsigned char is_piv_mode(lprec *lp, int testmask) | boolean isPivMode(int testmask)
unsigned char is_piv_rule(lprec *lp, int rule) | boolean isPivRule(int rule)
unsigned char is_presolve(lprec *lp, int testmask) | boolean isPresolve(int testmask)
unsigned char is_scalemode(lprec *lp, int testmask) | boolean isScalemode(int testmask)
unsigned char is_scaletype(lprec *lp, int scaletype) | boolean isScaletype(int scaletype)
unsigned char is_semicont(lprec *lp, int column) | boolean isSemicont(int colnr)
unsigned char is_SOS_var(lprec *lp, int column) | boolean isSOSVar(int colnr) throws LpSolveException
unsigned char is_trace(lprec *lp) | boolean isTrace()
int lag_solve(lprec *lp, REAL start_bound, int num_iter, short verbose) | <Function is currently not exported from lp_solve dll>
void lp_solve_version(int *majorversion, int *minorversion, int *release, int *build) | static VersionInfo lpSolveVersion()
lprec *make_lp(int rows, int columns) | static LpSolve makeLp(int rows, int columns) throws LpSolveException
void print_constraints(lprec *lp, int columns) | void printConstraints(int columns)
unsigned char print_debugdump(lprec *lp, char *filename) | void printDebugdump(String filename) throws LpSolveException
void print_duals(lprec *lp) | void printDuals()
void print_lp(lprec *lp) | void printLp()
void print_objective(lprec *lp) | void printObjective()
void print_scales(lprec *lp) | void printScales()
void print_solution(lprec *lp, int columns) | void printSolution(int columns)
void print_str(lprec *lp, char *str) | void printStr(String str)
void print_tableau(lprec *lp) | void printTableau()
void put_abortfunc(lprec *lp, ctrlcfunc newctrlc, void *ctrlchandle) | void putAbortfunc(AbortListener listener, Object userhandle) throws LpSolveException
void put_logfunc(lprec *lp, logfunc newlog, void *loghandle) | void putLogfunc(LogListener listener, Object userhandle) throws LpSolveException
void put_msgfunc(lprec *lp, msgfunc newmsg, void *msghandle, int mask) | void putMsgfunc(MsgListener listener, Object userhandle, int mask) throws LpSolveException
lprec *read_freeMPS(char *filename, int verbose) | static LpSolve readFreeMps(String filename, int verbose) throws LpSolveException
lprec *read_freemps(FILE *stream, int verbose) | <Not implemented, use readFreeMps instead>
lprec *read_lp(FILE *stream, int verbose, char *lp_name) | <Not implemented, use readLp instead>
lprec *read_LP(char *filename, int verbose, char *lp_name) | static LpSolve readLp(String filename, int verbose, String lpName) throws LpSolveException
lprec *read_lpt(FILE *stream, int verbose, char *lp_name) | <Not implemented, use readLpt instead>
lprec *read_LPT(char *filename, int verbose, char *lp_name) | static LpSolve readLpt(String filename, int verbose, String lpName) throws LpSolveException
lprec *read_mps(FILE *stream, int verbose) | <Not implemented, use readMps instead>
lprec *read_MPS(char *filename, int verbose) | static LpSolve readMps(String filename, int verbose) throws LpSolveException
lprec *read_XLI(char *xliname, char *modelname, char *dataname, char *options, int verbose) | static LpSolve readXLI(String xliname, String modelname, String dataname, String options, int verbose) throws LpSolveException
void reset_basis(lprec *lp) | void resetBasis()
unsigned char resize_lp(lprec *lp, int rows, int columns) | void resizeLp(int rows, int columns) throws LpSolveException
unsigned char set_add_rowmode(lprec *lp, unsigned char turnon) | boolean setAddRowmode(boolean turnon)
void set_anti_degen(lprec *lp, int anti_degen) | void setAntiDegen(int antiDegen)
unsigned char set_basis(lprec *lp, int *bascolumn, unsigned char nonbasic) | void setBasis(int[] bascolumn, boolean nonbasic) throws LpSolveException
void set_basiscrash(lprec *lp, int mode) | void setBasiscrash(int mode)
void set_bb_depthlimit(lprec *lp, int bb_maxlevel) | void setBbDepthlimit(int bbMaxlevel)
void set_bb_floorfirst(lprec *lp, int bb_floorfirst) | void setBbFloorfirst(int floorFirst)
void set_bb_rule(lprec *lp, int bb_rule) | void setBbRule(int bbRule)
unsigned char set_BFP(lprec *lp, char *filename) | void setBFP(String filename) throws LpSolveException
unsigned char set_XLI(lprec *lp, char *filename) | void setXLI(String filename) throws LpSolveException
unsigned char set_binary(lprec *lp, int column, unsigned char must_be_bin) | void setBinary(int colnr, boolean mustBeBin) throws LpSolveException
unsigned char set_bounds(lprec *lp, int column, REAL lower, REAL upper) | void setBounds(int colnr, double lower, double upper) throws LpSolveException
void set_bounds_tighter(lprec *lp, unsigned char tighten) | void setBoundsTighter(boolean tighten)
void set_break_at_first(lprec *lp, unsigned char break_at_first) | void setBreakAtFirst(boolean breakAtFirst)
void set_break_at_value(lprec *lp, REAL break_at_value) | void setBreakAtValue(double breakAtValue)
unsigned char set_col_name(lprec *lp, int column, char *new_name) | void setColName(int colnr, String name) throws LpSolveException
unsigned char set_column(lprec *lp, int col_no, REAL *column) | void setColumn(int colno, double[] column) throws LpSolveException
unsigned char set_columnex(lprec *lp, int col_no, int count, REAL *column, int *rowno) | void setColumnex(int colno, int count, double[] column, int[] rowno) throws LpSolveException
unsigned char set_constr_type(lprec *lp, int row, int con_type) | void setConstrType(int rownr, int constrType) throws LpSolveException
void set_debug(lprec *lp, unsigned char debug) | void setDebug(boolean debug)
void set_epsb(lprec *lp, REAL epsb) | void setEpsb(double value)
void set_epsd(lprec *lp, REAL epsd) | void setEpsd(double value)
void set_epsel(lprec *lp, REAL epsel) | void setEpsel(double value)
void set_epsint(lprec *lp, REAL epsint) | void setEpsint(double value)
void set_epsperturb(lprec *lp, REAL epsperturb) | void setEpsperturb(double value)
void set_epspivot(lprec *lp, REAL epspivot) | void setEpspivot(double value)
unsigned char set_free(lprec *lp, int column) | void setFree(int colnr) throws LpSolveException
void set_improve(lprec *lp, int improve) | void setImprove(int improve)
void set_infinite(lprec *lp, REAL infinite) | void setInfinite(double value)
unsigned char set_int(lprec *lp, int column, unsigned char must_be_int) | void setInt(int colnr, boolean mustBeInteger) throws LpSolveException
void set_lag_trace(lprec *lp, unsigned char lag_trace) | void setLagTrace(boolean lagTrace)
unsigned char set_lowbo(lprec *lp, int column, REAL value) | void setLowbo(int colnr, double value) throws LpSolveException
unsigned char set_lp_name(lprec *lp, char *lpname) | void setLpName(String name) throws LpSolveException
unsigned char set_mat(lprec *lp, int row, int column, REAL value) | void setMat(int row, int column, double value) throws LpSolveException
void set_maxim(lprec *lp) | void setMaxim()
void set_maxpivot(lprec *lp, int max_num_inv) | void setMaxpivot(int maxNumInv)
void set_minim(lprec *lp) | void setMinim()
void set_mip_gap(lprec *lp, unsigned char absolute, REAL mip_gap) | void setMipGap(boolean absolute, double value)
void set_negrange(lprec *lp, REAL negrange) | void setNegrange(double negRange)
void set_obj_bound(lprec *lp, REAL obj_bound) | void setObjBound(double objBound)
unsigned char set_obj_fn(lprec *lp, REAL *row) | void setObjFn(double[] row) throws LpSolveException
unsigned char set_obj_fnex(lprec *lp, int count, REAL *row, int *colno) | void setObjFnex(int count, double[] row, int[] colno) throws LpSolveException
unsigned char set_obj(lprec *lp, int column, REAL value) | void setObj(int column, double value) throws LpSolveException
void set_outputstream(lprec *lp, FILE *stream) | <Not implemented, use setOutputfile instead>
unsigned char set_outputfile(lprec *lp, char *filename) | void setOutputfile(String filename) throws LpSolveException
void set_pivoting(lprec *lp, int pivoting) | void setPivoting(int pivRule)
void set_preferdual(lprec *lp, unsigned char dodual) | void setPreferdual(int dodual)
void set_presolve(lprec *lp, int do_presolve) | void setPresolve(int doPresolve)
void set_print_sol(lprec *lp, int print_sol) | void setPrintSol(int printSol)
unsigned char set_rh(lprec *lp, int row, REAL value) | void setRh(int row, double value) throws LpSolveException
unsigned char set_rh_range(lprec *lp, int row, REAL deltavalue) | void setRhRange(int rownr, double range) throws LpSolveException
void set_rh_vec(lprec *lp, REAL *rh) | void setRhVec(double[] rh) throws LpSolveException
unsigned char set_row(lprec *lp, int row_no, REAL *row) | void setRow(int rowno, double[] row) throws LpSolveException
unsigned char set_rowex(lprec *lp, int row_no, int count, REAL *row, int *colno) | void setRowex(int rowno, int count, double[] row, int[] colno) throws LpSolveException
unsigned char set_row_name(lprec *lp, int row, char *new_name) | void setRowName(int rownr, String name) throws LpSolveException
void set_scalelimit(lprec *lp, REAL scalelimit) | void setScalelimit(double scalelimit)
void set_scaling(lprec *lp, int scalemode) | void setScaling(int scalemode)
unsigned char set_semicont(lprec *lp, int column, unsigned char must_be_sc) | void setSemicont(int colnr, boolean mustBeSc) throws LpSolveException
void set_sense(lprec *lp, unsigned char maximize) | void setSense(boolean maximize)
void set_simplextype(lprec *lp, int simplextype) | void setSimplextype(int simplextype)
void set_solutionlimit(lprec *lp, int limit) | void setSolutionlimit(int limit)
void set_timeout(lprec *lp, long sectimeout) | void setTimeout(long timeout)
void set_trace(lprec *lp, unsigned char trace) | void setTrace(boolean trace)
unsigned char set_upbo(lprec *lp, int column, REAL value) | void setUpbo(int colnr, double value) throws LpSolveException
unsigned char set_var_branch(lprec *lp, int column, int branch_mode) | void setVarBranch(int colnr, int branchMode) throws LpSolveException
unsigned char set_var_weights(lprec *lp, REAL *weights) | void setVarWeights(double[] weights) throws LpSolveException
void set_verbose(lprec *lp, int verbose) | void setVerbose(int verbose)
int solve(lprec *lp) | int solve() throws LpSolveException
unsigned char str_add_column (lprec* lp, char* col_string) | void strAddColumn(String column) throws LpSolveException
unsigned char str_add_constraint (lprec* lp, char *row_string, int constr_type, REAL rh) | void strAddConstraint(String row, int constrType, double rh) throws LpSolveException
unsigned char str_add_lag_con (lprec* lp, char *row_string, int con_type, REAL rhs) | void strAddLagCon(String row, int constrType, double rh) throws LpSolveException
unsigned char str_set_obj_fn(lprec *lp, char *row_string) | void strSetObjFn(String row) throws LpSolveException
unsigned char str_set_rh_vec(lprec *lp, char *rh_string) | void strSetRhVec(String rh) throws LpSolveException
REAL time_elapsed(lprec *lp) | double timeElapsed()
void unscale(lprec *lp) | void unscale()
unsigned char write_freeMPS(lprec *lp, FILE *stream) | <Not implemented, use writeFreeMps instead>
unsigned char write_freemps(lprec *lp, char *filename) | void writeFreeMps(String filename) throws LpSolveException
unsigned char write_lp(lprec *lp, char *filename) | void writeLp(String filename) throws LpSolveException
unsigned char write_LP(lprec *lp, FILE *stream) | <Not implemented, use writeLp instead>
unsigned char write_mps(lprec *lp, char *filename) | void writeMps(String filename) throws LpSolveException
unsigned char write_MPS(lprec *lp, FILE *stream) | <Not implemented, use writeMps instead>
unsigned char write_XLI(lprec *lp, char *filename, char *options, unsigned char results) | void writeXLI(String filename, String options, boolean results) throws LpSolveException