Trouble interpreting the output (facets of a polytope)

Questions and problems about using polymake go here.
Sangha52
Posts: 10
Joined: 25 Feb 2021, 00:01

Trouble interpreting the output (facets of a polytope)

Postby Sangha52 » 12 Apr 2021, 22:55

I'm working on interpreting the facets of the polytope. I entered the polytope using the "lp2poly" command and it gave me the facets in the forms of 0s & 1s. Is there a way I can get the output (facets) in the form of same variables as I input in the formulation?
FYI, I tried using

Code: Select all

print_constraints($x->FACETS);
but it won't output the facets in the form of the variables I used to construct the lp formulation. Here, 'x' contains the polytope.
Thanks in advance!

User avatar
joswig
Main Author
Posts: 279
Joined: 24 Dec 2010, 11:10

Re: Trouble interpreting the output (facets of a polytope)

Postby joswig » 13 Apr 2021, 10:24

Please send your full input and output, at least for a minimal example which exhibits the problem.

Sangha52
Posts: 10
Joined: 25 Feb 2021, 00:01

Re: Trouble interpreting the output (facets of a polytope)

Postby Sangha52 » 13 Apr 2021, 17:31

My apologies for not being clear enough in the first place. PFA the input and output files as requested.

Please note that I'm using this example just to describe the problem I'm facing with the interpretation.

I sincerely appreciate your time once again!
Attachments
untitled (experiment) output.lp
Output files with facets.
(5.68 KiB) Downloaded 228 times
untitled (experiment).lp
Input '.lp' file with the formulation.
(2.12 KiB) Downloaded 232 times

User avatar
gawrilow
Main Author
Posts: 422
Joined: 25 Dec 2010, 17:40

Re: Trouble interpreting the output (facets of a polytope)

Postby gawrilow » 14 Apr 2021, 00:38

Theoretically, you could use the opposite conversion function, 'poly2lp'. In reality, however, it won't work for you right now, because your LP is in fact a MILP, which recently became a separate data type in polymake. But we forgot to extend 'poly2lp' to cover both types of linear programs. This is clearly our fault and this will be fixed in the next release.
For the time being, you would have to enforce the LP type during file import:

Code: Select all

$x=lp2poly("input.lp", create_lp => true); $x->FACETS; poly2lp($x, $x->LP, false, "output.lp");
Remember to revert to the default (MILP) import mode if you are interested in the integral solution.

Sangha52
Posts: 10
Joined: 25 Feb 2021, 00:01

Re: Trouble interpreting the output (facets of a polytope)

Postby Sangha52 » 16 Apr 2021, 18:57

this will be fixed in the next release.
Can I please know when should I accept the next release?
For the time being, you would have to enforce the LP type during file import
I have tried this but facets as reflected in the "output.lp" file still aren't in terms of the originally used variables (x#13, x#31... so..on) as in the input file. Is there any other way I can transform these facets into my original variables?

Thanks & sincerely appreciate your help!

User avatar
gawrilow
Main Author
Posts: 422
Joined: 25 Dec 2010, 17:40

Re: Trouble interpreting the output (facets of a polytope)

Postby gawrilow » 17 Apr 2021, 02:40

Can I please know when should I accept the next release?
This will be announced on the News page of this very website.
There is no fixed release date decided yet, but it should happen in a rather short term, I reckon.
Is there any other way I can transform these facets into my original variables?
You need to execute more perl magic before calling poly2lp:

Code: Select all

@names=@{$x->COORDINATE_LABELS}; shift @names; $x->LP->attach("VARIABLE_NAMES", \@names);
This mess will obviously be fixed too. It seems nobody has used poly2lp for real-world tasks for quite a long time...
Sorry for the inconvenience!

Sangha52
Posts: 10
Joined: 25 Feb 2021, 00:01

Re: Trouble interpreting the output (facets of a polytope)

Postby Sangha52 » 19 May 2021, 20:11

Thank you so much for all the timely & helpful replies! Appreciate your time :D


Return to “Helpdesk”