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

Handle systems with incomplete constraints #180

Open
mforets opened this issue Feb 21, 2020 · 3 comments
Open

Handle systems with incomplete constraints #180

mforets opened this issue Feb 21, 2020 · 3 comments

Comments

@mforets
Copy link
Member

mforets commented Feb 21, 2020

There are combinations of systems that are not available; my favorite example is a ConstrainedLinearControlContinuousSystem where the input is constrained but the state set is unconstrained.

Here are three alternatives:

  1. Add a new system type with the corresponding variation, eg. StateConstrainedLinearControlContinuousSystem, InputConstrainedLinearControlContinuousSystem (keeping ConstrainedLinearControlContinuousSystem to mean that both input and state sets are constrained).

  2. Create instances with nothing in the corresponding fields.

  3. Create instances with a universe using a thin layer: MathematicalSets.UniversalSet and adding type restrictions for the set constraints to be <: MathematicalSets.AbstractSet.


From discussin on gitter, option 1 is a bit heavy on types because of the different combinations. Option 3 is the best (to me) but we would need to update MathematicalSets so it is not immediate. So we would rather go with option 2. Note that downstream packages can dispatch on Nothing in that case.

NB: why i think that 3 is better than 2 is that you don't need to bother with small unions, Union{Nothing, LazySet}, since LazySets.Universe will take the role of MathematicalSets.UniversalSet. And also, generic algorithms do not have to consider the missing information as a special case becuase LazySets.Universe behaves as a set ;)

@schillic
Copy link
Member

NB: why i think that 3 is better than 2 is that you don't need to bother with small unions, Union{Nothing, LazySet}, since LazySets.Universe will take the role of MathematicalSets.UniversalSet. And also, generic algorithms do not have to consider the missing information as a special case becuase LazySets.Universe behaves as a set ;)

Not every package uses LazySets nor MathematicalSets. I would not rely on those.

The difference between 2. and 3. is just in cases where we want to automatically create a system. A user who wants to create a system can always choose their representation of a Universe. So I guess your motivation is the @system macro. For that you can add a way to define a function that creates an n-dimensional universe. Then @system can use that.

julia> my_universe(n) = LazySets.Universe(n);  # example function

julia> @universe my_universe  # assigns my_universe to an internal function _universe

julia> @system ...  # internally calls _universe to create universes

@mforets
Copy link
Member Author

mforets commented Feb 21, 2020

Exactly, the idea of using MathematicalSets was that it should provide the necessary functionality; then eg. LazySets implements the higher-level interface defining its universe function.

@ueliwechsler
Copy link
Collaborator

I also would select either option 2 or 3.

Could we make MathematicalSets or LazySets an optional dependency that creates its own universe function as soon as it is loaded which overwrites the default my_universe function that returns nothing?

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