Page 1 of 1

Trouble interpreting the output (facets of a polytope)

Posted: 12 Apr 2021, 22:55
by Sangha52
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!

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

Posted: 13 Apr 2021, 10:24
by joswig
Please send your full input and output, at least for a minimal example which exhibits the problem.

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

Posted: 13 Apr 2021, 17:31
by Sangha52
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!

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

Posted: 14 Apr 2021, 00:38
by gawrilow
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.

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

Posted: 16 Apr 2021, 18:57
by Sangha52
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!

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

Posted: 17 Apr 2021, 02:40
by gawrilow
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!

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

Posted: 19 May 2021, 20:11
by Sangha52
Thank you so much for all the timely & helpful replies! Appreciate your time :D