Documentation / tutorial for beginners?

Questions and problems about using polymake go here.
gordonfroyle
Posts: 15
Joined: 15 Feb 2011, 08:07

Documentation / tutorial for beginners?

Postby gordonfroyle » 07 Jul 2012, 08:31

I have a task for polymake but cannot find how to do it with the supplied documentation, mostly because all the documentation seems to assume "common shared knowledge" about how things are done.

In particular, I'm trying to find out how to define a polytope via halfspaces.

The documentation tells me what command to use:

Code: Select all

$inequalities=new Matrix<Rational>([[1,1,0],[1,0,1],[1,-1,0],[1,0,-1],[17,1,1]]); $p=new Polytope<Rational>(INEQUALITIES=>$inequalities);
but I can't seem to find anywhere the semantics of this command - in other words, exactly how are inequalities coded into a matrix? Does [1,1,1] mean x+y>1 or x+y+z>0 or 1+x+y > 1 or ... somehow I can't actually find this specified anywhere.

Perhaps a simple example: here is a trivial polytope

x+y >= 1
x >= 0
y >= 0

What matrix of inequalities would yield this?

I'd appreciate knowing just this one fact, but even more, I'd appreciate knowing how to find out the precise semantics of a command from the documentation!

Thanks

Gordon

PS In case it matters, all the polytopes I need to work with are specified as follows:

- lots of 0/1 linear combination of the variables >= 1
- all variables >= 0

herr
Developer
Posts: 40
Joined: 30 Dec 2010, 13:15

Re: Documentation / tutorial for beginners?

Postby herr » 07 Jul 2012, 14:16

The documentation tells me what command to use:

Code: Select all

$inequalities=new Matrix<Rational>([[1,1,0],[1,0,1],[1,-1,0],[1,0,-1],[17,1,1]]); $p=new Polytope<Rational>(INEQUALITIES=>$inequalities);
but I can't seem to find anywhere the semantics of this command - in other words, exactly how are inequalities coded into a matrix? Does [1,1,1] mean x+y>1 or x+y+z>0 or 1+x+y > 1 or ... somehow I can't actually find this specified anywhere.
Thank you for pointing to such problems. I assume you found this piece of code in the Tutorial on Polytopes. Actually, the line right below the example would have answered your question:
"The last inequality [17,1,1] means 17+x1+x2 ≥ 0, hence it does not represent a facet of the polytope."
But you are absolutely right, this explanation needs to get more prominent. Thanks again! I will revise this part of the tutorial.
Perhaps a simple example: here is a trivial polytope

x+y >= 1
x >= 0
y >= 0

What matrix of inequalities would yield this?
The matrix would be

Code: Select all

$m=new Matrix([[-1,1,1],[0,1,0],[0,0,1]]);
You can check your system of inequalities by using the command "print_constraints":

Code: Select all

polytope > $m=new Matrix([[-1,1,1],[0,1,0],[0,0,1]]); polytope > print_constraints($m); 0: x1 + x2 >= 1 1: x1 >= 0 2: x2 >= 0

herr
Developer
Posts: 40
Joined: 30 Dec 2010, 13:15

Re: Documentation / tutorial for beginners?

Postby herr » 07 Jul 2012, 14:36

PS In case it matters, all the polytopes I need to work with are specified as follows:

- lots of 0/1 linear combination of the variables >= 1
- all variables >= 0
One way to define the inequality system for "all variables >= 0" would be:

Code: Select all

$ineqs=zero_vector(3)|unit_matrix(3); polytope > print_constraints($ineqs); 0: x1 >= 0 1: x2 >= 0 2: x3 >= 0
If $m contains the inequalities for the 0/1 linear combinations, you can glue the matrices together via

Code: Select all

$all_ineqs=$m/$ineqs;
More information on polymake-perl syntax is provided in the tutorial Using Perl within polymake.

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

Re: Documentation / tutorial for beginners?

Postby joswig » 07 Jul 2012, 16:37



Return to “Helpdesk”