Undefined subroutine

Questions and problems about using polymake go here.
pratibha_saini
Posts: 4
Joined: 13 Oct 2013, 23:19

Undefined subroutine

Postby pratibha_saini » 13 Oct 2013, 23:48

Hi

This is the code what i have written:

polytope: $M =new Matrix<Integer>([[1,1,0,0],[1,0,1,0],[1,0,0,1]]);
polytope: print is_totally_unimodular($M);
polymake: ERROR: Undefined subroutine &Polymake::User::is_totally_unimodular called at input line 1.

Don't know where, i am going wrong.
can anyone help me out with this ??

Thanks

User avatar
assarf
Developer
Posts: 74
Joined: 12 Oct 2011, 15:52

Re: Undefined subroutine

Postby assarf » 14 Oct 2013, 08:56

hey,

that is because there is no such method called "is_totally_unimodular". The correct command is just "totally_unimodular".

If you are not sure weather or not you have the right command name, polymake does support tab completion. Typing "is_" and hitting tab you will see all methods which start with "is_".

Or you can look at the documentation of the latest release: http://www.polymake.org/release_docs/2.12/

best wishes
Benjamin
no signature

paffenholz
Developer
Posts: 213
Joined: 24 Dec 2010, 13:47

Re: Undefined subroutine

Postby paffenholz » 14 Oct 2013, 10:15

There is, however, an extension to polymake that defines a function "is_totally_unimodular", written by Matthias Walter. You can download it here. Unpack this tarball into some directory and call the function

Code: Select all

import_extension("/path/to/directory");
from within polymake, where /path/to/directory/ should be replaced by the base directory of the unpacked tarball. This extension provides the command used in the optimization tutorial in our wiki.

pratibha_saini
Posts: 4
Joined: 13 Oct 2013, 23:19

Re: Undefined subroutine

Postby pratibha_saini » 14 Oct 2013, 11:00

Hi again

Actually I want to test a matrix of size 18x28 is totally unimodular or not. I am using the online version of polymake. Do I need to install polymake to use the "is_totally_unimodular" command ??


Thanks
Pratibha

User avatar
assarf
Developer
Posts: 74
Joined: 12 Oct 2011, 15:52

Re: Undefined subroutine

Postby assarf » 16 Oct 2013, 10:04

If you want to use ''is_totally_unimodular'', then yes (at least for now). But as I said you can use the function ''totally_unimodular''

The comment of this function is:

Code: Select all

# The matrix //A// is totally unimodular if the determinant of each square submatrix equals 0, 1, or -1. # This is the naive test (exponential in the size of the matrix). # @param Matrix A # @return Bool
so it gives you a boolean which tells you weather or not the matrix is unimodular or not. And this should be what you want.
no signature

pratibha_saini
Posts: 4
Joined: 13 Oct 2013, 23:19

Re: Undefined subroutine

Postby pratibha_saini » 18 Oct 2013, 16:29

Hey paffenholz

is_totally_unimodular function is working. Thanx for that. I have one more question, this function returns 1 when the matrix is totally unimodular. Does it shows blank space when the matrix is not TUM. I am saying this on the basis of the following code:

polytope > $f=lp2poly('LPMTfc.lp');

polytope > $p = new Polytope<Rational>($f);

polytope > $A = new Matrix<Integer>($p->INEQUALITIES->minor(All, ~[0]));

polytope > print is_totally_unimodular($A);
1
polytope > $f=lp2poly('LPMTcL.lp');

polytope > $p = new Polytope<Rational>($f);

polytope > $A = new Matrix<Integer>($p->INEQUALITIES->minor(All, ~[0]));

polytope > print is_totally_unimodular($A);

polytope >

I have one more question, what is the maximum size of the matrix for which "is_totally_unimodular" function works ??

Thanks,
Pratibha

paffenholz
Developer
Posts: 213
Joined: 24 Dec 2010, 13:47

Re: Undefined subroutine

Postby paffenholz » 18 Oct 2013, 17:32

You are right, an empty line for a boolean result means "false", a "1" means "true".

polymake does not restrict the size of the input. However, at some point the computation might need to much space or time. I don't have any estimates what reasonable sizes are in this respect. The actual algorithm is described here. Maybe the paper contains some hints.

pratibha_saini
Posts: 4
Joined: 13 Oct 2013, 23:19

Re: Undefined subroutine

Postby pratibha_saini » 22 Oct 2013, 12:31

Hey

how can we check running status of a process in Polymake ?

Consider the following code:

polytope > $f=lp2poly('LPMTjt.lp');

I typed this command and it is stuck there. The Linear program in LPMTjt.lp consists of 760 variables. Can you tell me if there is some sort of input restriction for the above command ? and if not, then how can we see whether the process is running or not ?

Thanks & Regards
Pratibha Saini

paffenholz
Developer
Posts: 213
Joined: 24 Dec 2010, 13:47

Re: Undefined subroutine

Postby paffenholz » 28 Oct 2013, 18:39

Hey

how can we check running status of a process in Polymake ?

Consider the following code:

polytope > $f=lp2poly('LPMTjt.lp');

I typed this command and it is stuck there. The Linear program in LPMTjt.lp consists of 760 variables. Can you tell me if there is some sort of input restriction for the above command ? and if not, then how can we see whether the process is running or not ?

Thanks & Regards
Pratibha Saini
Basically you can't, unless some external program is involved. Which is not the case when reading a linear program.

There is no technical restriction on the size of the input, but 760 variables means your polyhedron lives in 760-dimensional space (though its dimension may be lower, that depends on your input), and that is quite large for any but trivial computations. There is some input checking involded in reading an lp-file. Either computations take that long, or you ran out of memory.

lp-file conversion is in a perl-subroutine. As long as polymake has not crashed this will be working.

Best
Andreas


Return to “Helpdesk”