lp_solve usage

Usage of lp_solve version 5.1.1.3:
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 in fixed format See read_MPS, See mps-format
-fmps           read from MPS file in free format See read_freeMPS, See mps-format
-rxli xliname filename
                read file with xli library See external language interface
-rxlidata datafilename
                data file name for xli library.
-rxliopt options
                options for xli library.
-rbas filename  read basis from filename See read_basis, See mps bas file format
-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.
-wbas filename  write basis to filename. See write_basis, See mps bas file format
-wafter         Write model after solve (useful if presolve used).
-parse_only     parse input file but do not solve
-nonames        Ignore variables and constraint 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
-s <mode> <scaleloop>   use automatic problem scaling. See set_scaling
          -s:
         -s0: Numerical range-based scaling
         -s1: Geometric scaling
         -s2: Curtis-reid scaling
         -s3: Scale to convergence using largest absolute value
         -s4: Numerical range-based scaling
         -s5: Scale to convergence using logarithmic mean of all values
         -s6: Scale based on the simple numerical range
         -s7: Scale quadratic
These scaling rules can be combined with any of the following:
-sp             also do power scaling. See set_scaling
-si             also do Integer scaling. See set_scaling
-se             also do equilibration to scale matrix vales to the -1..1 range. See set_scaling
-presolve       presolve problem before start optimizing 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
-C <mode>       basis crash mode See set_basiscrash
         -C0: No crash basis
         -C2: Most feasible 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
-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 (default)
         -improve4: Automatic inverse accuracy control in the dual simplex
-timeout <sec>  Timeout after sec seconds when not solution found. See set_timeout
-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              during branch-and-bound, take the ceiling 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
-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

-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
-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

The lp_solve program is a command line application that can use as good as all functionality of the library. Note for Windows users, that you can not just run the lp_solve program by dubbel clicking on it from Windows Explorer. The program needs arguments and this is best done from the command line (cmd.exe / command.com) or via batch files. lp_solve has many options as shown here above.

This program reads the MIP model from standard input or from a file and outputs the result back to the console or to a file. There are several possible input formats: The 'lp' format (See lp-format), and the 'mps' format (See mps-format) are build in, but other formats are also supported via the XLI functionality (See external language interface). For example a MathProg interface is developed via the XLI functionality (See external language interface for an example). These input formats have nothing to do with the API. So lp1 = make_lp(0,4) is a totally wrong input for the lp_solve program. The lp format is the default. Optionaly you can use the -lp option for it. To enable the mps format, use the -mps option. To enable the XLI, use the -rxli option. If lp_solve is started without an input file, then it gives a blinking cursor and waits for input. It is then possible to enter the model in the specified format (lp by default). But this is not very handy. You must enter the whole model each time you want to solve it and must be careful that you don't type any errors. To stop input mode, press Ctrl Z.
However it is much better to write your model in a disk file with your favourite editor (make sure it is in text format) and then provide this file to lp_solve. For example:

lp_solve input.lp

It is also possible to use input redirection:

lp_solve <input.lp

Or more sophisticated constructs like:

gen_model | lp_solve

gen_model is here a user written program that outputs the model to standard output and via the pipe character (|) this output is redirected to lp_solve. So no intermediate file is needed in this case.

Examples:

lp_solve input.lp

lp_solve -s input.lp

lp_solve -s input.lp >output.txt

lp_solve -s -mps input.mps >output.txt

lp_solve -s -S4 -mps input.mps >output.txt