|This article is about a function from ApCoCoA-2. If you are looking for the ApCoCoA-1 version of it, see Category:ApCoCoA-1:Package glpk.|
This page describes the glpk package. For a complete list of functions, see Category:Package glpk.
The basic idea behind this package is to make the linear optimization program GLPK usable in/with ApCoCoA. The package GLPK contains various functions that let you make use of the GLPK library, rather the stand-alone LP/MIP Solver glpsol.
Important: For usage under linux, the GLPK-Program glpsol must be in the ApCoCoA package directory under
packages/binaries/glpk/examples/glpsol and you must have the permissions to read and write in this directory. For Windows, the glsol.exe has to be in the folder
packages\binaries\glpk\w64\glpsol.exe. If you installed ApCoCoA-2 together with the GUI, this should already be the case.
The source code of GLPK can be downloaded at .
Optimizing Linear Systems Of Equations
- See also: GLPK.LPSolve
Let and . Let be linear polynomials and let . Let be the system of polynomial (in)equations
Then the function
GLPK.LPSolve can be used to find solution to such that in the following way.
EQbe the list , let
LEbe the list , and let
GEbe the list .
ube the lists containing the upper and lower bounds for the with
u[i], if both are rational numbers. Instead of and , write
l[i] = ""or
u[i] = "". Set
B := [ [l,u], [l,u], ..., [l[n],u[n]] ].
- Choose a string
[ "InterP", "Simplex" ]depending on the method you want GLPK to use for solving the problem (
"InterP"stands for the inter-point-method and
"Simplex"for the simplex method)
- Choose a string
[ "Min", "Max" ]depending on whether you want to fulfill or .
to get the desired solution as a list
b = [b1,...,bn] or the empty list
 if the given system of (in)equalities is unsatisfiable.
Solving Mixed Integer Problems
- See also: GLPK.MIPSolve
Let be disjoint sets. If additionally, a solution with for and for is searched, then one can use the function
GLPK.MIPSolve. Together with
MinMax from above, the code
produces the desired solution or
 if the given system has no such solution.