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

#326 - Template directions #330

Merged
merged 6 commits into from
May 16, 2018
Merged

#326 - Template directions #330

merged 6 commits into from
May 16, 2018

Conversation

schillic
Copy link
Member

@schillic schillic commented May 15, 2018

Closes #326.

@schillic
Copy link
Member Author

schillic commented May 16, 2018

using LazySets, LazySets.Approximations
B = Ball2([0., 0.], 2.);
box = overapproximate(B, BoxDirections(2));
oct = overapproximate(B, OctDirections(2));

using Plots
plot(oct, 1e-4, alpha=.5)
plot!(box, 1e-4, alpha=.5)
plot!(B, 1e-4)

boxoct

EDIT:
Previously I could not plot HPolytopes, so I needed two workarounds. But now suddenly it worked (so confused now). Below is the old comment.

  1. HPolytope cannot be plotted, so we use HPolygon. (We have to use addconstraint! because the constraints are not sorted.)
  2. HPolygon uses Line, which uses Vector (see Revisit Line #332) (hence the convert).
using LazySets, LazySets.Approximations, Polyhedra
B = Ball2([0., 0.], 2.)
box = HPolygon()
for c in overapproximate(B, BoxDirections(2)).constraints
    addconstraint!(box, LinearConstraint(convert(Vector{Float64}, c.a), c.b))
end
oct = HPolygon()
for c in overapproximate(B, OctDirections(2)).constraints
    addconstraint!(oct, LinearConstraint(convert(Vector{Float64}, c.a), c.b))
end

using Plots
plot(oct, alpha=.5)
plot!(box, alpha=.5)
plot!(B, 1e-4)

@schillic schillic requested a review from mforets May 16, 2018 08:25
@schillic schillic changed the title [WIP #326] Template directions #326 - Template directions May 16, 2018
Copy link
Member

@mforets mforets left a comment

Choose a reason for hiding this comment

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

LGTM. I'm moving the 2 new tasks to issues.

@mforets mforets merged commit 448f84f into master May 16, 2018
@schillic schillic deleted the schillic/326 branch May 17, 2018 09:19
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.

Overapproximation with template directions
2 participants