Package glpk: Difference between revisions

From ApCoCoAWiki
Created page with "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 o..."
(No difference)

Revision as of 11:02, 1 November 2020

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: The GLPK-Program glpsol must be in the ApCoCoA package directory /binaries/glpk/examples and you must have the permissions to read and write in this directory.

The source code of GLPK can be downloaded at [1].

Usage

Let n and P=[x1,,xn]. Let f1,,fs1,g1,,gs2,h1,,hs3,cP be linear polynomials and let l1,,ln,u1,,un{,}. Let S be the system of polynomial (in)equations

{f1(b)=0fs1(b)=0g1(b)0gs2(b)0h1(b)0hs3(b)0.

Then the function GLPK.LPSolve can be used to find solution b[l1,u1]××[ln,un] to S such that c(b)=min{c(x)x[l1,u1]××[ln,un] is a solution to S} in the following way.

  • Let EQ be the list {f1,,fs1}, let LE be the list {g1,,gs2}, and let GE be the list {h1,,hs3}.
  • Let l and u be lists with l[i]=li if li (resp. u[i]=ui if ui) and l[i] = "" if li= (resp. u[i] = "" if ui=). Furthermore, we set B := [ [l[1],u[1]], [l[2],u[2]], ..., [l[n],u[n]] ].
  • Choose a string Method from [ "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 MinMax from [ "Min", "Max" ] depending on whether you want b to fulfill c(b)=min{c(x)x[l1,u1]××[ln,un] is a solution to S} or c(b)=max{c(x)x[l1,u1]××[ln,un] is a solution to S}.

Then call

LPSolve(c,EQ,LE,GE,B,Method,MinMax)

to get the desired solution as a list b = [b1,...,bn].