glpsol
The GLPK
package7
includes the program glpsol
, which is a stand-alone LP/MIP
solver. This program can be launched from the command line or from the
shell to solve models written in the GNU MathProg modeling language.
In order to tell the solver that the input file contains a model
description, you should specify the option --model
in the
command line. For example:
glpsol --model foo.mod
Sometimes it is necessary to use the data section placed in a separate file, in which case you may use the following command:
glpsol --model foo.mod --data foo.dat
Note that if the model file also contains the data section, that section is ignored.
If the model description contains some display and/or print statements, by default the output sends to the terminal. In order to redirect the output to a file you may use the following command:
glpsol --model foo.mod --display foo.out
If you need to look at the problem which has been generated by the
model translator, you may use the option --wcpxlp
as follows:
glpsol --model foo.mod --wcpxlp foo.lp
in which case the problem data is written to file foo.lp
in
CPLEX LP format suitable for visual analysis.
Sometimes it is needed merely to check the model description not
solving the generated problem. In this case you may specify the option
--check
, for example:
glpsol --check --model foo.mod --wcpxlp foo.lp
In order to write a numeric solution obtained by the solver you may use the following command:
glpsol --model foo.mod --output foo.sol
in which case the solution is written to the file foo.sol
in
plain text format.
Complete list of the glpsol
options can be found in the
reference manual included in the GLPK distribution.