Difference between revisions of "Package zerodim"

From ApCoCoAWiki
(Created page with "{{Version|2|ApCoCoA-1:SB.Sagbi and ApCoCoA-1:SB.ReducedSagbi}} <command> <title>SB.SAGBI</title> <short_description>Computes a finite SAGBI-basis of a subalgebra i...")
 
Line 1: Line 1:
{{Version|2|[[ApCoCoA-1:SB.Sagbi]] and [[ApCoCoA-1:SB.ReducedSagbi]]}}
+
{{Version|2|[[:Category:ApCoCoA-1:Package glpk]]}}
<command>
+
This page describes the glpk package. For a complete list of functions, see [[:Category:Package glpk]].
  <title>SB.SAGBI</title>
 
  <short_description>Computes a finite SAGBI-basis of a subalgebra if existing.</short_description>
 
  
  <syntax>SB.SAGBI(G:LIST of POLY):LIST of POLY</syntax>
+
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.
  <description>
 
This function computes a finite SAGBI-basis of a subalgebra <tt>S</tt> generated by the polynomials of the list <tt>G</tt>, if a finite SAGBI-basis of <tt>S</tt> exists. Then a list of polynomials is returned which form a SAGBI-basis of <tt>S</tt>. Otherwise the computation runs until it is interrupted.
 
    <itemize>
 
      <item>@param <em>G</em> A list of polynomials which generates a subalgebra.</item>
 
      <item>@return A list of polynomials which form a finite SAGBI-basis of the subalgebra generated by <tt>G</tt>.</item>
 
    </itemize>
 
  
    <example>
+
<em>Important</em>: For usage under linux, the GLPK-Program glpsol must be in the ApCoCoA package directory under <code>packages/binaries/glpk/examples/glpsol</code> and you must have the permissions to read and write in this directory. For Windows, the glsol.exe has to be in the folder <code>packages\binaries\glpk\w64\glpsol.exe</code>. If you installed ApCoCoA-2 together with the GUI, this should already be the case.
Use QQ[x,y,z], DegRevLex;
 
:= SB.SAGBI([x^2 -z^2,  x*y +z^2, y^2 -2*z^2]);
 
indent(S);
 
-- [
 
--  y^2 -2*z^2,
 
--  x*y +z^2,
 
--  x^2 -z^2,
 
--  x^2*z^2 +x*y*z^2 +(1/2)*y^2*z^2 +(-1/2)*z^4
 
-- ]</example>
 
  </description>
 
  
  <seealso>
+
The source code of GLPK can be downloaded at [http://www.gnu.org/software/glpk/].
    <see>Package sagbi/SB.TruncSAGBI</see>
 
    <see>Package sagbi/SB.SAGBITimeout</see>
 
    <see>Package sagbi/SB.IsSAGBIOf</see>
 
    <see>Package sagbi/SB.GetSAGBI</see>
 
    <see>Package sagbi/SB.GetTruncSAGBI</see>
 
  </seealso>
 
  
   <types>
+
== Optimizing Linear Systems Of Equations ==
    <type>sagbi</type>
+
:''See also: [[/GLPK.LPSolve/]]
    <type>poly</type>
+
Let <math>n \in \mathbb{N}</math> and <math>P = \mathbb{Q}[x_1,\ldots,x_n]</math>. Let <math>f_1,\ldots,f_{s_1},g_1,\ldots,g_{s_2},h_1,\ldots,h_{s_3},c \in P</math> be linear polynomials and let <math>l_1,\ldots,l_n,u_1,\ldots,u_n \in \mathbb{Q} \cup \{- \infty,\infty\}</math>. Let <math>S</math> be the system of polynomial (in)equations
  </types>
+
:<math>\left\{ \begin{array}{ccc}
 +
  f_1(b) & = & 0 \\
 +
  \vdots & \vdots & \vdots \\
 +
  f_{s_1}(b) & = & 0 \\
 +
  g_1(b) & \leq & 0 \\
 +
  \vdots & \vdots & \vdots \\
 +
  g_{s_2}(b) & \leq & 0 \\
 +
  h_1(b) & \geq & 0 \\
 +
   \vdots & \vdots & \vdots \\
 +
  h_{s_3}(b) & \geq & 0.
 +
\end{array}\right.</math>
 +
Then the function <code>[[/GLPK.LPSolve/]]</code> can be used to find solution <math>b = (b_1,\ldots,b_n) \in [l_1,u_1] \times \cdots \times [l_n,u_n]</math> to <math>S</math> such that <math>c(b) = \min\{c(x) \mid x \in [l_1,u_1] \times \cdots \times [l_n,u_n] \text{ is a solution to } S\}</math> in the following way.
  
  <key>SAGBI</key>
+
*Let <code>EQ</code> be the list <math>\{f_1,\ldots,f_{s_1}\}</math>, let <code>LE</code> be the list <math>\{g_1,\ldots,g_{s_2}\}</math>, and let <code>GE</code> be the list <math>\{h_1,\ldots,h_{s_3}\}</math>.
  <key>SB.SAGBI</key>
+
*Let <code>l</code> and <code>u</code> be the lists containing the upper and lower bounds for the <math>b_i</math> with <code>l[i]</code><math> = l_i</math> and <code>u[i]</code><math> = u_i</math>, if both are rational numbers. Instead of <math>\infty</math> and <math>- \infty</math>, write <code>l[i] = ""</code> or <code>u[i] = ""</code>. Set <code>B := [ [l[1],u[1]], [l[2],u[2]], ..., [l[n],u[n]] ]</code>.
  <key>apcocoa/sagbi.SAGBI</key>
+
*Choose a string <code>Method</code> from <code>[ "InterP", "Simplex" ]</code> depending on the method you want GLPK to use for solving the problem (<code>"InterP"</code> stands for the inter-point-method and <code>"Simplex"</code> for the simplex method)
 +
*Choose a string <code>MinMax</code> from <code>[ "Min", "Max" ]</code> depending on whether you want <math>b</math> to fulfill <math>c(b) = \min\{c(x) \mid x \in [l_1,u_1] \times \cdots \times [l_n,u_n] \text{ is a solution to } S\}</math> or <math>c(b) = \max\{c(x) \mid x \in [l_1,u_1] \times \cdots \times [l_n,u_n] \text{ is a solution to } S\}</math>.
 +
Then call
 +
<pre>GLPK.LPSolve(c,EQ,LE,GE,B,Method,MinMax)</pre>
 +
to get the desired solution as a list <code>b = [b1,...,bn]</code> or the empty list <code>[]</code> if the given system of (in)equalities is unsatisfiable.
  
  <wiki-category>Package sagbi</wiki-category>
+
== Solving Mixed Integer Problems ==
</command>
+
:''See also: [[/GLPK.MIPSolve/]]
 +
Let <math>I, J \subseteq \{1,\ldots,n\}</math> be disjoint sets. If additionally, a solution <math>b = (b_1,\ldots,b_n)</math> with <math>b_i \in \mathbb{N}</math> for <math>i \in I</math> and <math>b_j \in \{0,1\}</math> for <math>j \in J</math> is searched, then one can use the function <code>[[/GLPK.MIPSolve/]]</code>. Together with <code>c</code>, <code>EQ</code>, <code>LE</code>, <code>GE</code>, <code>B</code> and <code>MinMax</code> from above, the code
 +
<pre>GLPK.MIPSolve(c,EQ,LE,GE,B,I,J,MinMax)</pre>
 +
produces the desired solution or <code>[]</code> if the given system has no such solution.
 +
 
 +
[[Category:ApCoCoA Packages]]
 +
[[Category:Package glpk]]

Revision as of 18:37, 17 November 2022

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 [1].

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.

  • Let EQ be the list , let LE be the list , and let GE be the list .
  • Let l and u be the lists containing the upper and lower bounds for the with l[i] and u[i], if both are rational numbers. Instead of and , write l[i] = "" or u[i] = "". 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 to fulfill or .

Then call

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

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 c, EQ, LE, GE, B and MinMax from above, the code

GLPK.MIPSolve(c,EQ,LE,GE,B,I,J,MinMax)

produces the desired solution or [] if the given system has no such solution.