The lp_solve program is a command line application that can use as good as all functionality of the library.
A list of all options is given by entering the following command:
lp_solve -h
This gives:
Usage of lp_solve version 5.5.2.11: lp_solve [options] [[<]input_file] List of options: -h prints this message -lp read from LP file (default) See read_LP, See lp-format -mps read from MPS file, default in fixed format See read_MPS, See mps-format -mps_free use free format See read_MPS, See mps-format -mps_ibm interprete integers accoring to ibm format See read_MPS, See mps-format -mps_negobjconst negate objective constant See read_MPS, See mps-format -fmps read from MPS file in free format See read_freeMPS, See mps-format -rpar filename read parameters from filename. See read_params -rparopt options options for parameter file: -H headername: header name for parameters. By default 'Default' -rxli xliname filename read file with xli library See external language interface -rxlidata datafilename data file name for xli library. See external language interface -rxliopt options options for xli library. See external language interface -rbas filename read basis from filename. See read_basis, See mps bas file format -gbas filename guess basis with variables from filename. See guess_basis -plp print model. See print_lp -wlp filename write to LP file See write_lp, See lp-format -wmps filename write to MPS file in fixed format See write_mps, See mps-format -wfmps filename write to MPS file in free format See write_freemps, See mps-format -wxli xliname filename write file with xli library See external language interface -wxliopt options options for xli library. See external language interface -wxlisol xliname filename write solution file with xli library See external language interface -wxlisolopt options options for xli library. See external language interface -wbas filename write basis to filename. See write_basis, See mps bas file format -wpar filename write parameters to filename. See write_params -wparopt options options for parameter file: -H headername: header name for parameters. By default 'Default' -wafter Write model after solve (useful if presolve used). -parse_only parse input file but do not solve -nonames Ignore variables and constraint names See set_use_names -norownames Ignore constraint names See set_use_names -nocolnames Ignore variable names See set_use_names -min Minimize the lp problem (overrules setting in file) See set_minim -max Maximize the lp problem (overrules setting in file) See set_maxim -r <value> specify max nbr of pivots between a re-inversion of the matrix See set_maxpivot -piv <rule> specify simplex pivot rule See set_pivoting -piv0: Select first -piv1: Select according to Dantzig -piv2: Select Devex pricing from Paula Harris (default) -piv3: Select steepest edge These pivot rules can be combined with any of the following: -pivf In case of Steepest Edge, fall back to DEVEX in primal. See set_pivoting -pivm Multiple pricing. See set_pivoting -piva Temporarily use First Index if cycling is detected. See set_pivoting -pivr Adds a small randomization effect to the selected pricer. See set_pivoting -pivll Scan entering/leaving columns left rather than right. See set_pivoting -pivla Scan entering/leaving columns alternatingly left/right. See set_pivoting -pivh Use Harris' primal pivot logic rather than the default. See set_pivoting -pivt Use true norms for Devex and Steepest Edge initializations. See set_pivoting -o0 Don't put objective in basis. See set_obj_in_basis -o1 Put objective in basis (default). See set_obj_in_basis -s <mode> <scaleloop> use automatic problem scaling. See set_scaling -s0: No scaling -s1: Geometric scaling (default) -s2: Curtis-reid scaling -s3: Scale to convergence using largest absolute value -s: -s4: Numerical range-based scaling -s5: Same as -s4 -sl -s6: Scale based on the simple numerical range -s7: Same as -s4 -sq These scaling rules can be combined with any of the following: -sp: also do power scaling. -si: also do integer scaling (default). -se: also do equilibration to scale to the -1..1 range (default). -sq: also do quadratic scaling. -sl: Scale to convergence using logarithmic mean of all values. -sd: Dynamic update. -sr: Scale only rows. -sc: Scale only columns. -presolve presolve problem before start optimizing (rows+columns) See set_presolve -presolverow presolve problem before start optimizing (rows only) See set_presolve -presolvecol presolve problem before start optimizing (columns only) See set_presolve -presolvel also eliminate linearly dependent rows See set_presolve -presolves also convert constraints to SOSes (only SOS1 handled) See set_presolve -presolver If the phase 1 solution process finds that a constraint is redundant then this constraint is deleted See set_presolve -presolvek Simplification of knapsack-type constraints through addition of an extra variable, which also helps bound the OF See set_presolve -presolveq Direct substitution of one variable in 2-element equality constraints; this requires changes to the constraint matrix See set_presolve -presolvem Merge rows See set_presolve -presolvefd COLFIXDUAL See set_presolve -presolvebnd Presolve bounds See set_presolve -presolved Presolve duals See set_presolve -presolvef Identify implied free variables (releasing their expl. bounds) See set_presolve -presolveslk IMPLIEDSLK See set_presolve -presolveg Reduce (tighten) coef. in integer models based on GCD argument See set_presolve -presolveb Attempt to fix binary variables at one of their bounds See set_presolve -presolvec Attempt to reduce coefficients in binary models See set_presolve -presolverowd Idenfify and delete qualifying constraints that are dominated by others, also fixes variables at a bound See set_presolve -presolvecold Deletes variables (mainly binary), that are dominated by others (only one can be non-zero) See set_presolve -C <mode> basis crash mode See set_basiscrash -C0: No crash basis -C2: Most feasible basis -C3: Least degenerate basis -prim Prefer the primal simplex for both phases. See set_preferdual -dual Prefer the dual simplex for both phases. See set_preferdual -simplexpp Set Phase1 Primal, Phase2 Primal. See set_simplextype -simplexdp Set Phase1 Dual, Phase2 Primal. See set_simplextype -simplexpd Set Phase1 Primal, Phase2 Dual. See set_simplextype -simplexdd Set Phase1 Dual, Phase2 Dual. See set_simplextype -degen use perturbations to reduce degeneracy, can increase numerical instability See set_anti_degen -degenc use column check to reduce degeneracy See set_anti_degen -degend dynamic check to reduce degeneracy See set_anti_degen -degenf anti-degen fixedvars See set_anti_degen -degens anti-degen stalling See set_anti_degen -degenn anti-degen numfailure See set_anti_degen -degenl anti-degen lostfeas See set_anti_degen -degeni anti-degen infeasible See set_anti_degen -degenb anti-degen B&B See set_anti_degen -degenr anti-degen Perturbation of the working RHS at refactorization See set_anti_degen -degenp anti-degen Limit bound flips See set_anti_degen -trej <Trej> set minimum pivot value See set_epspivot -epsd <epsd> set minimum tolerance for reduced costs See set_epsd -epsb <epsb> set minimum tolerance for the RHS See set_epsb -epsel <epsel> set tolerance for rounding values to zero See set_epsel -epsp <epsp> set the value that is used as perturbation scalar for degenerative problems See set_epsperturb -improve <level> iterative improvement level See set_improve -improve0: none -improve1: Running accuracy measurement of solved equations on Bx=r -improve2: Improve initial dual feasibility by bound flips (default) -improve4: Low-cost accuracy monitoring in the dual -improve8: check for primal/dual feasibility at the node level -timeout <sec> Timeout after sec seconds when not solution found. See set_timeout -ac <accuracy> Fail when accuracy is less then specified value. -bfp <filename> Set basis factorization package. See set_BFP -noint Ignore integer restrictions -e <number> specifies the tolerance which is used to determine whether a floating point number is in fact an integer. Should be < 0.5 See set_epsint -g <number> -ga <number> specifies the absolute MIP gap for branch-and-bound. See set_mip_gap This specifies the absolute allowed tolerance on the object function. Can result in faster solving times. -gr <number> specifies the relative MIP gap for branch-and-bound. See set_mip_gap This specifies the relative allowed tolerance on the object function. Can result in faster solving times. -f specifies that branch-and-bound algorithm stops at first found solution See set_break_at_first -b <bound> specify a lower bound for the objective function See set_obj_bound to the program. If close enough, may speed up the calculations. -o <value> specifies that branch-and-bound algorithm stops when objective value is better than value See set_break_at_value -c -cc during branch-and-bound, take the ceiling branch first See set_bb_floorfirst -cf during branch-and-bound, take the floor branch first See set_bb_floorfirst -ca during branch-and-bound, the algorithm chooses branch See set_bb_floorfirst -depth <limit> set branch-and-bound depth limit See set_bb_depthlimit -n <solnr> specify which solution number to return See set_solutionlimit -B <rule> specify branch-and-bound rule See set_bb_rule -B0: Select Lowest indexed non-integer column (default) -B1: Selection based on distance from the current bounds -B2: Selection based on the largest current bound -B3: Selection based on largest fractional value -B4: Simple, unweighted pseudo-cost of a variable -B5: This is an extended pseudo-costing strategy based on minimizing the number of integer infeasibilities -B6: This is an extended pseudo-costing strategy based on maximizing the normal pseudo-cost divided by the number of infeasibilities. Similar to (the reciprocal of) a cost/benefit ratio These branch-and-bound rules can be combined with any of the following: -Bw WeightReverse branch-and-bound See set_bb_rule -Bb BranchReverse branch-and-bound See set_bb_rule -Bg Greedy branch-and-bound See set_bb_rule -Bp PseudoCost branch-and-bound See set_bb_rule -BR Extended PseudoCost branch-and-bound See set_bb_rule -Bf DepthFirst branch-and-bound See set_bb_rule -Br Randomize branch-and-bound See set_bb_rule -BG GubMode branch-and-bound See set_bb_rule -Bd Dynamic branch-and-bound See set_bb_rule -Bs RestartMode branch-and-bound See set_bb_rule -BB BreadthFirst branch-and-bound See set_bb_rule -Bo Order variables to improve branch-and-bound performance See set_bb_rule -Bc Do bound tightening during B&B based of reduced cost info See set_bb_rule -Bi Initialize pseudo-costs by strong branching See set_bb_rule -time Print CPU time to parse input and to calculate result. See time_elapsed -v <level> verbose mode, gives flow through the program. See set_verbose if level not provided (-v) then -v4 (NORMAL) is taken. -v0: NEUTRAL -v1: CRITICAL -v2: SEVERE -v3: IMPORTANT (default) -v4: NORMAL -v5: DETAILED -v6: FULL -t trace pivot selection See set_trace -d debug mode, all intermediate results are printed, and the branch-and-bound decisions See set_debug -R report information while solving the model See put_msgfunc See get_working_objective -Db <filename> Do a generic readable data dump of key lp_solve model variables before solve. See print_debugdump Principally for run difference and debugging purposes -Da <filename> Do a generic readable data dump of key lp_solve model variables after solve. See print_debugdump Principally for run difference and debugging purposes -i print all intermediate valid solutions. See set_print_sol Can give you useful solutions even if the total run time is too long -ia print all intermediate (only non-zero values) valid solutions. See set_print_sol Can give you useful solutions even if the total run time is too long -stat Print model statistics -S <detail> Print solution. If detail omitted, then -S2 is used. -S0: Print nothing -S1: Only objective value See print_objective See get_objective -S2: Obj value+variables (default) See print_solution See get_variables, get_ptr_variables -S3: Obj value+variables+constraints See print_constraints See get_constraints -S4: Obj value+variables+constraints+duals See print_duals See get_sensitivity_rhs, get_ptr_sensitivity_rhs, get_dual_solution, get_ptr_dual_solution, get_var_dualresult, See get_sensitivity_obj, get_ptr_sensitivity_obj, get_sensitivity_objex, get_ptr_sensitivity_objex -S5: Obj value+variables+constraints+duals+lp model See print_lp -S6: Obj value+variables+constraints+duals+lp model+scales See print_scales -S7: Obj value+variables+constraints+duals+lp model+scales+lp tableau See print_tableau
Enter the following in your favorite text editor (Windows users, don't use Word or Wordpad, that won't work. If you don't have an editor, use notepad).
max: 143 x + 60 y; 120 x + 210 y <= 15000; 110 x + 30 y <= 4000; x + y <= 75;
Save this on your hard disk with name model.lp (don't forget in which directory/folder you save it).
Now enter the following:
lp_solve -S3 model.lp
This gives:
Value of objective function: 6315.63 Actual values of the variables: x 21.875 y 53.125 Actual values of the constraints: R1 13781.2 R2 4000 R3 75
Note that this is the model presented in Formulation of an lp problem in lpsolve. The model is formulated in the lp format. See lp-format for a description of it.