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

#1051 - Add more list of constraints methods #1053

Merged
merged 24 commits into from
Jan 24, 2019
Merged

#1051 - Add more list of constraints methods #1053

merged 24 commits into from
Jan 24, 2019

Conversation

mforets
Copy link
Member

@mforets mforets commented Jan 22, 2019

Closes #1051.

@mforets mforets requested a review from schillic January 22, 2019 18:02
Copy link
Member

@schillic schillic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests!

src/HPolyhedron.jl Outdated Show resolved Hide resolved
@mforets mforets changed the title #1051 - Add new tosimplehrep and constraints_list methods for lists of constr… #1051 - Add more list of constraints methods Jan 22, 2019
src/HPolyhedron.jl Outdated Show resolved Hide resolved
src/HPolyhedron.jl Outdated Show resolved Hide resolved
src/HPolyhedron.jl Outdated Show resolved Hide resolved
src/LazySet.jl Outdated Show resolved Hide resolved
src/LazySet.jl Outdated Show resolved Hide resolved
Copy link
Member

@schillic schillic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a simple 1D test for each of the new functions?

  • tosimplehrep(constraints)
  • remove_redundant_constraints!(constraints)
  • remove_redundant_constraints(constraints)
  • constraints_list(::Intersection)
  • tosimplehrep(::LazySet) for a non-HPoly

@schillic
Copy link
Member

I fixed a bug and (I think) found another one.

julia> constraints = [HalfSpace(N[1], N(0)), HalfSpace(N[-1], N(-1))];

julia> remove_redundant_constraints!(constraints)
true

This polytope is empty and hence I expected the result false.

@mforets
Copy link
Member Author

mforets commented Jan 23, 2019

well, from the point of view of the algorithm true is the expected answer, because the second constraint does not imply the firsrt one (and the first one does not imply the second one). i haven't tried but would expect that calling isempty from master returns true, because it doesn't remove constraints.

@schillic
Copy link
Member

Then the documentation should be clarified.

and false if the constraints are infeasible

src/HPolyhedron.jl Outdated Show resolved Hide resolved
@mforets
Copy link
Member Author

mforets commented Jan 24, 2019

LazySets.Intersection: Error During Test at /Users/forets/.julia/dev/LazySets/test/unit_Intersection.jl:31
  Test threw exception
  Expression: ispermutation(constraints_list(I), [HalfSpace{Float64}(N[1, 0], N(2)), HalfSpace{Float64}(N[0, 1], N(2)), HalfSpace{Float64}(N[-1, 0], N(0)), H
alfSpace{Float64}(N[0, -1], N(0))])
  MethodError: no method matching ispermutation(::Array{HalfSpace{Rational{Int64}},1}, ::Array{HalfSpace{Float64},1})
  Closest candidates are:
    ispermutation(::AbstractArray{T,1}, !Matched::AbstractArray{T,1}) where T at /Users/forets/.julia/dev/LazySets/src/helper_functions.jl:65
  Stacktrace:
   [1] top-level scope at /Users/forets/.julia/dev/LazySets/test/unit_Intersection.jl:31
   [2] include at ./boot.jl:317 [inlined]
   [3] include_relative(::Module, ::String) at ./loading.jl:1044
   [4] include(::Module, ::String) at ./sysimg.jl:29

   [5] include(::String) at ./client.jl:392
   [6] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1079 [inlined]
   [7] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1070 [inlined]
   [8] macro expansion at /Users/forets/.julia/dev/LazySets/test/runtests.jl:69 [inlined]
   [9] macro expansion at ./util.jl:156 [inlined]
   [10] top-level scope at /Users/forets/.julia/dev/LazySets/test/runtests.jl:69 [inlined]
   [11] top-level scope at ./none:0
LazySets.Intersection: Error During Test at /Users/forets/.julia/dev/LazySets/test/unit_Intersection.jl:75
  Test threw exception
  Expression: ispermutation(constraints_list(IA), [HalfSpace{Float64}(N[1, 0], N(2)), HalfSpace{Float64}(N[0, 1], N(2)), HalfSpace{Float64}(N[-1, 0], N(0)),
HalfSpace{Float64}(N[0, -1], N(0))])
  MethodError: no method matching ispermutation(::Array{HalfSpace{Rational{Int64}},1}, ::Array{HalfSpace{Float64},1})
  Closest candidates are:
    ispermutation(::AbstractArray{T,1}, !Matched::AbstractArray{T,1}) where T at /Users/forets/.julia/dev/LazySets/src/helper_functions.jl:65
  Stacktrace:
   [1] top-level scope at /Users/forets/.julia/dev/LazySets/test/unit_Intersection.jl:75
   [2] include at ./boot.jl:317 [inlined]
   [3] include_relative(::Module, ::String) at ./loading.jl:1044
   [4] include(::Module, ::String) at ./sysimg.jl:29
   [5] include(::String) at ./client.jl:392
   [6] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1079 [inlined]
   [7] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1070 [inlined]
   [8] macro expansion at /Users/forets/.julia/dev/LazySets/test/runtests.jl:69 [inlined]
   [9] macro expansion at ./util.jl:156 [inlined]
   [10] top-level scope at /Users/forets/.julia/dev/LazySets/test/runtests.jl:69 [inlined]
   [11] top-level scope at ./none:0
LazySets.Intersection: Error During Test at /Users/forets/.julia/dev/LazySets/test/unit_Intersection.jl:31

@mforets
Copy link
Member Author

mforets commented Jan 24, 2019

Documenter: setting up build directory.
Documenter: expanding markdown templates.
Documenter: building cross-references.
 !! Unable to evaluate the type signature for '[`remove_redundant_constraints!(::Vector{LinearConstraint{N}})`](@ref)'. [src/lib/representations.md]

ERROR: UndefVarError(:N)

expression ':(remove_redundant_constraints!(::Vector{LinearConstraint{N}}))' in module 'LazySets'


 !! Unable to evaluate the type signature for '[`remove_redundant_constraints!(::Vector{LinearConstraint{N}})`](@ref)'. [src/lib/representations.md]

ERROR: UndefVarError(:N)

expression ':(remove_redundant_constraints!(::Vector{LinearConstraint{N}}))' in module 'LazySets'

Documenter: running document checks.
 > checking for missing docstrings.
 !! 1 docstring potentially missing:

    LazySets.constraints_list :: Union{Tuple{Intersection{N,S1,S2}}, Tuple{S2}, Tuple{S1}, Tuple{N}} where S2<:AbstractPolytope{N} where S1<:AbstractPolytope
{N} where N<:Real

 > running doctests.
 > checking footnote links.
Documenter: populating indices.
LazySets.doctests: Error During Test at /Users/forets/.julia/dev/LazySets/test/runtests.jl:162
  Got exception outside of a @test

@schillic schillic merged commit 73e742d into master Jan 24, 2019
@schillic schillic deleted the mforets/1051 branch January 24, 2019 20:33
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

Successfully merging this pull request may close these issues.

2 participants