Calling Polymake and converting its output

This method calls the polymake program (see ) with the option option. You may use several keywords such as "FACETS VERTICES" as an option. The returned value is cut into blocks starting with keywords (which are taken from output and not looked up in option). Each block is then interpreted and translated into &GAP; readable form. This translation is done using the functions given in .

The first line of each block of polymake output is taken as a keyword and the according entry in is called to convert the block into &GAP; readable form. If no conversion function is known, an info string is printed and fail is returned.

If only one keyword has been given as option, Polymake returns the result of the conversion operation. If more than one keyword has been given or the output consists of more than one block, Polymake returns fail.

In any case, the calculated values for each block are stored as known properties of the PolymakeObject poly as long as they are not fail.

If Polymake is called with an option that corresponds to a name of a known property of poly, the known property is returned. In this case, there is no call of the external program. (see below for suppression of this feature).

Note that the command Polymake returns fail if nothing is returned by the program polymake or more than one block of data is returned. For example, the returned value of Polymake(poly,"VISUAL") is always fail. Likewise, Polymake(poly,"POINTS VERTICES") will return fail (but may add new known properties to poly).

For a description of the conversion functions, see chapter .

If the option PolymakeNolookup is set to anything else than false, the polymake program is called even if poly already has a known property with name option.

Note that whenever returns fail, a description of the problem is stored in . If you call with more than one keyword, is changed before polymake is called. So any further reason to return fail will overwrite it.

An Example

Let's generate a three dimensional permutahedron.

gap> S:=SymmetricGroup(3); Sym( [ 1 .. 3 ] ) gap> v:=[1,2,3]; [ 1, 2, 3 ] gap> points:=Orbit(S,v,Permuted);; gap> permutahedron:=CreatePolymakeObject(); <polymake object. No properties known> gap> AppendPointlistToPolymakeObject(permutahedron,points); gap> Polymake(permutahedron,"VOLUME"); 3 gap> Polymake(permutahedron,"N_VERTICES"); 6 #Now <permutahedron> knows its number of vertices, but not the vertices: gap> PropertyOfPolymakeObject(permutahedron,"VERTICES"); fail gap> NamesKnownPropertiesOfPolymakeObject(permutahedron); [ "VOLUME", "N_VERTICES" ] #Let's look at the object! gap> Polymake(permutahedron,"VISUAL"); #I There was no or wrong polymake output fail gap> Polymake(permutahedron,"DIM"); 2