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

Introduce common interfaces (abstract supertypes) for similar types #58

Closed
schillic opened this issue Dec 2, 2017 · 3 comments
Closed
Assignees
Labels
simplification 👶 Simplifies code

Comments

@schillic
Copy link
Member

schillic commented Dec 2, 2017

Initial motivation: supertype for HPolygon and HPolygonOpt:

  1. Avoid copy-pasting methods in both HPolygon and HPolygonOpt.
  2. Allows to restrict a type to a polygon irrespective of the implementation.

The idea also translates to other types such as BoxSet(?) for Hyperrectangle/BallInf.

Another idea is to have different implementations of array-type sets (MinkowskiSumArray etc.) that store their dimension for faster access.

So the general message here is:
Introduce interface types and usually only work with them.
A crucial implication is that we should never access member/field variables directly (because different implementations may not have those members).
Instead there should be a function that is usually just a getter.

@schillic schillic added discussion 🗣️ Requires human input simplification 👶 Simplifies code labels Dec 2, 2017
@schillic schillic changed the title Introduce common abstract supertypes for Polygon types Introduce common abstract supertypes for similar types Dec 5, 2017
@schillic schillic changed the title Introduce common abstract supertypes for similar types Introduce common interfaces (abstract supertypes) for similar types Dec 5, 2017
@schillic schillic mentioned this issue Dec 11, 2017
@schillic
Copy link
Member Author

schillic commented Dec 12, 2017

Proposal (I am open for different names):

ZeroSet, Singleton <: SingleSet  # provide: element(dim), element
HPolygon, HPolygonOpt <: HPolygonal  # common: many methods
HPolygonal, VPolygon <: Polygonal  # provide: tovrep, tohrep; inherit: dim
SingleSet, BallInf, Hyperrectangle <: Box  # provide: radius_b(dim), radius_b
Ball, Box, Zonotope <: PointSymmetric <: LazySet  # provide: center; inherit: dim
Ball1, Box, Polygonal, Zonotope <: Polytopic <: LazySet  # provide: vertices_list
[SingleSet, Ball1, Ball2, Ballp, BallInf <: Ball] -- removed for simplicity

radius_b should not be confused with the existing radius for general LazySets.

@schillic
Copy link
Member Author

Another possible extension is to have implementations for "centered in the origin" sets such as a Hyperrectangle0. These are more efficient to store and process (no center).
If we want this, we should introduce another layer of abstract types for each concrete type. Then we can provide different implementations for the same concepts. We already have this for HPolygon and HPolygonOpt.

We do not have to implement such sets right away, but with these changes this will be straight-forward to integrate them later.

@schillic schillic added this to the Set operations for learning application milestone Dec 13, 2017
@schillic schillic self-assigned this Dec 13, 2017
@schillic
Copy link
Member Author

Noooo, Julia does not support multiple supertypes (yet).

One can simulate multiple (abstract) supertypes with artificial combination types of course. Maybe I will just do that... 😈

schillic added a commit that referenced this issue Dec 14, 2017
schillic added a commit that referenced this issue Dec 14, 2017
schillic added a commit that referenced this issue Dec 14, 2017
schillic added a commit that referenced this issue Dec 14, 2017
schillic added a commit that referenced this issue Dec 14, 2017
schillic added a commit that referenced this issue Dec 14, 2017
schillic added a commit that referenced this issue Dec 15, 2017
schillic added a commit that referenced this issue Dec 15, 2017
@schillic schillic removed the discussion 🗣️ Requires human input label Dec 15, 2017
schillic added a commit that referenced this issue Dec 15, 2017
schillic added a commit that referenced this issue Dec 15, 2017
schillic added a commit that referenced this issue Dec 15, 2017
schillic added a commit that referenced this issue Dec 15, 2017
schillic added a commit that referenced this issue Dec 16, 2017
schillic added a commit that referenced this issue Dec 16, 2017
schillic added a commit that referenced this issue Dec 16, 2017
schillic added a commit that referenced this issue Dec 19, 2017
schillic added a commit that referenced this issue Dec 19, 2017
schillic added a commit that referenced this issue Dec 19, 2017
schillic added a commit that referenced this issue Dec 19, 2017
schillic added a commit that referenced this issue Dec 20, 2017
schillic added a commit that referenced this issue Dec 20, 2017
schillic added a commit that referenced this issue Dec 20, 2017
schillic added a commit that referenced this issue Dec 20, 2017
schillic added a commit that referenced this issue Dec 20, 2017
schillic added a commit that referenced this issue Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
simplification 👶 Simplifies code
Projects
None yet
Development

No branches or pull requests

1 participant