Output format of FACETS

Questions and problems about using polymake go here.
mitch.ondra
Posts: 2
Joined: 12 Mar 2024, 15:53

Output format of FACETS

Postby mitch.ondra » 12 Mar 2024, 16:05

Hi,
when I print facets of a polytope, according to documentation I should get a matrix of numbers, each rows represents one inequality with the numbers being the coeficients in the respective inequality. However, I get this:

Code: Select all

> $c = cube(3,0); > print $c->FACETS; (4) (1 1) 1 -1 0 0 (4) (2 1) 1 0 -1 0 (4) (3 1) 1 0 0 -1
How should I interpret this output and why does it look like this? Is it possible to force the output to adhere to the format from the docs?

For the context, I need to use polymake to convert polytopes from V-repre to H-repre, where the H-repre will need to be saved as CPLEX .lp format and lrs/cdd .ine format (but I can convert to these manually if I have the matrix representation).

blorenz
Developer
Posts: 141
Joined: 10 Jan 2011, 17:21

Re: Output format of FACETS

Postby blorenz » 12 Mar 2024, 16:16

The (dim) (key value) ... style is for sparse vectors / matrices where the first entry is the length and each following pair is index and value. You can force the default output with dense:

Code: Select all

polytope > print dense($c->FACETS); 0 1 0 0 1 -1 0 0 0 0 1 0 1 0 -1 0 0 0 0 1 1 0 0 -1
Regarding .lp output you can also have a look at poly2lp: https://polymake.org/doku.php/documenta ... pe#poly2lp

Best
Benjamin

mitch.ondra
Posts: 2
Joined: 12 Mar 2024, 15:53

Re: Output format of FACETS

Postby mitch.ondra » 12 Mar 2024, 17:31

Thank you!

I tried both poly2lp and and poly2porta (since I kinda work with it too) and they didn't work.
Running

Code: Select all

poly2lp($c)
gave me

Code: Select all

polymake: WARNING: available properties insufficient to compute 'LP'
while poly2porta gives

Code: Select all

polymake: ERROR: Undefined subroutine &Polymake::User::poly2porta called

blorenz
Developer
Posts: 141
Joined: 10 Jan 2011, 17:21

Re: Output format of FACETS

Postby blorenz » 12 Mar 2024, 18:15

poly2lp requires an LP for the objective function, either as a subobject or as a second argument, e.g.:

Code: Select all

polytope > $c = cube(3); polytope > $lp = $c->LP(LINEAR_OBJECTIVE=>[0,1,1,1]); polytope > poly2lp($c, $lp); MINIMIZE obj: +1 x1 +1 x2 +1 x3 Subject To ie0: +1 x1 >= -1 ie1: -1 x1 >= -1 ie2: +1 x2 >= -1 ie3: -1 x2 >= -1 ie4: +1 x3 >= -1 ie5: -1 x3 >= -1 BOUNDS x1 free x2 free x3 free END

For poly2porta you need to make sure the porta.rules are active:

Code: Select all

polytope > reconfigure "porta.rules"; Could not find the program `xporta' anywhere along your PATH. Please enter the full path or an empty string to abort. [program path] > xporta polytope > poly2porta($c,"portafile"); polytope > exit; $ cat portafile DIM=3 CONV_SECTION -1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 END


Return to “Helpdesk”