Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in MILP computation #144

Closed
ThomasBreuer opened this issue May 28, 2019 · 5 comments
Closed

Segmentation fault in MILP computation #144

ThomasBreuer opened this issue May 28, 2019 · 5 comments

Comments

@ThomasBreuer
Copy link
Member

The following Polymake input follows some examples in polymake docs

$p = new Polytope( INEQUALITIES => [ [1,1,-1],[-1,0,1],[7,-1,-1] ] );
$obj = new Vector( [0,-1,-1] );
$intvar = new Set<Int>( [0,1,2] );
$milp = $p -> MILP( LINEAR_OBJECTIVE => $obj,
                    INTEGER_VARIABLES => $intvar );
$result = $milp -> MINIMAL_VALUE;
print $result;

and yields -7.
Using the syntax translation rules from the README of Polymake.jl,
I tried to do the same with Polymake.jl, as follows.

using Polymake
p = @pm Polytope.Polytope( :INEQUALITIES => [1 1 -1; -1 0 1; 7 -1 -1] )
obj = [0,-1,-1]
intvar = Set{Int}( [0,1,2] )
milp = p.MILP( :LINEAR_OBJECTIVE => obj,
               :INTEGER_VARIABLES => intvar )

Here I get the following error message.

polymake:  WARNING: available properties insufficient to compute 'MILP'
ERROR: Exception occured at Polymake side:
property MILP not created as expected at ...

With help from Sebastian Gutsche, I tried the following variant.

p = @pm Polytope.Polytope( :INEQUALITIES => [1 1 -1; -1 0 1; 7 -1 -1] )
lp = @pm Polytope.MixedIntegerLinearProgram(
    :LINEAR_OBJECTIVE => [0,-1,-1],
    :INTEGER_VARIABLES => [0,1,2] )
p.MILP = lp
p.MILP.MINIMAL_VALUE

Here I get a segmentation fault.

@kalmarek
Copy link
Contributor

tosimplex uses omp threads which for some reason (we're investigating right now) clashes with julia gc (?!);

as a workaround you can either OMP_NUM_THREADS=1 julia, or ENV["OMP_NUM_THREADS"] = 1 before using Polymake

julia> ENV["OMP_NUM_THREADS"] = 1
1

julia> using Polymake
polymake version 3.4
Copyright (c) 1997-2019
Ewgenij Gawrilow, Michael Joswig (TU Berlin)
https://polymake.org

This is free software licensed under GPL; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


julia> p = @pm Polytope.Polytope( :INEQUALITIES => [1 1 -1; -1 0 1; 7 -1 -1] )
type: Polytope<Rational>

INEQUALITIES
1 1 -1
-1 0 1
7 -1 -1
1 0 0



julia> obj = [0,-1,-1]
3-element Array{Int64,1}:
  0
 -1
 -1

julia> intvar = [0,1,2]
3-element Array{Int64,1}:
 0
 1
 2

julia> lp = @pm Polytope.MixedIntegerLinearProgram( LINEAR_OBJECTIVE = obj, INTEGER_VARIABLES = intvar)
type: MixedIntegerLinearProgram<Rational>

LINEAR_OBJECTIVE
0 -1 -1

INTEGER_VARIABLES
{0 1 2}


julia> p.MILP = lp
type: MixedIntegerLinearProgram<Rational>

LINEAR_OBJECTIVE
0 -1 -1

INTEGER_VARIABLES
{0 1 2}


julia> p.MILP.MINIMAL_VALUE
polymake: used package tosimplex
  Dual simplex algorithm implemented by Thomas Opfer

-7

@ThomasBreuer
Copy link
Member Author

Thanks a lot for this quick workaround.
Now it works, even in situations where the polytope does not contain lattice points.

@kalmarek
Copy link
Contributor

a patch for this has been written in June 2018:
JuliaLang/julia#27020
but has not been merged

@kalmarek
Copy link
Contributor

a new pull already approved is pending:
JuliaLang/julia#33284

@saschatimme
Copy link
Collaborator

This is resolved with Julia 1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants