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

Add model parsing and tests for distributions #2

Merged
merged 4 commits into from
Nov 20, 2024

Conversation

minhnh
Copy link
Member

@minhnh minhnh commented Nov 19, 2024

  • support (and dependent on) Add metamodel of distribution and corresponding SHACL constraint metamodels#13
  • add DistributionModel for parsing univariate and multivariate versions of the uniform and normal distributions, as well as a distribution for generating uniform random rotations in 3D space.
  • add method to sample using info from DistributionModel
  • add distrib_from_sampled_quantity to get the distribution model from a SampledQuantity node
  • add unit test on a valid model that check sampling of all supported distributions
  • minor: use check_shacl_constraints func in test_python_model
  • minor: remove black precommit hook since conflicting with ruff

- support secorolab/metamodels#13
- add DistributionModel that for parsing univariate and multivariate
  versions of the uniform and normal distributions, as well as uniform
  rotation (3D) distribution
- add method to sample using info from DistributionModel
- add SampledQuantityModel that cache sample when requested
- add unit test on a valid model that check sampling of all supported
  distributions
- minor: use check_shacl_constraints func in test_python_model
- minor: remove black precommit hook since conflicting with ruff
@minhnh minhnh self-assigned this Nov 19, 2024
@minhnh minhnh changed the title WIP: add model parsing and tests for distributions Add model parsing and tests for distributions Nov 19, 2024
minhnh added a commit to minhnh/metamodels-bdd that referenced this pull request Nov 19, 2024
@minhnh minhnh changed the title Add model parsing and tests for distributions WIP: Add model parsing and tests for distributions Nov 19, 2024
- For compatibility with Python 3.11 and older, use single quote inside
  f-string
- add dependency to numpy
- test against Python versions in Ubuntu 22.04, 24.04, and latest
- add a function to create distribution for a SampledQuantity node
- add optional deps for distrib models, update workflow
- clean up double quote f-string in test
@minhnh minhnh changed the title WIP: Add model parsing and tests for distributions Add model parsing and tests for distributions Nov 20, 2024
@minhnh minhnh merged commit 763acde into secorolab:main Nov 20, 2024
3 checks passed
@minhnh minhnh deleted the feature/distrib-model branch November 20, 2024 11:06
minhnh added a commit to minhnh/metamodels-bdd that referenced this pull request Feb 27, 2025
## Changelog

### BDD

- Differentiate types of variations with `TableVariation` & `CartesianProductVariation`
- Add `WhenBehaviour`
- Add set quantifiers `ForAll` & `ThereExists`
- Add concepts to link fluents, behaviours to their implementations
- Add `ScenarioExecution` and more specific concepts to compose impl. concepts
- Remove `Fluent` in favour of adding predicates types to `FluentClause` for simplification
- Update SHACL constraints for BDD MM

### Other MMs

- Add `Pick` & `Place` as behaviour types, allowing composition, which may need some further conceptual brainstorming
- Add Simulation MM & SHACL to link elements to corresponding simulation resources
- Add more specific concepts to link time constraints to event, add `DuringEventsConstraint`,
  update SHACL for time MM
- Add concepts to link objects, workspaces, agents to their models
- Add SHACL for environment & agent MM

## Related PRs

- Distribution MM migrated in secorolab/metamodels#13
- Extensions to geometry metamodels will be migrated with secorolab/metamodels#22

## Commits

* add simulation metamodel

- add concepts for specifying simulation resources
- add SHACL constraints for these concepts

* add geometry extension and distribution MM

- add a concept for composing a pose coordinate from
  position and orientation
- add concept for different types of orientation coordinates
- add concept for sampled quantities and some default distributions
- add SHACL constraints for the metamodels
- the distribution concepts are migrated from the probability metamodel
  in secorolab/models

* add concepts for scenario exec, scenario variant

- ScenarioVariant was not explicitly defined
- add concepts for specifying the execution environment, as well as
  implementations for behaviour and fluents

* add type, ns for USD, Isaacsim

* move object model concepts to environment mm

* change SimulatedObject to ModelledObject

- move SimulatedObject in simulation MM to ModelledObject in environment.
  Semantically, this means object models can exist independent of
  simulation. An object can be associated with many models.
- change sim:object-model to env:has-object-model
- add SHACL constraints for environment MM, migrate constraints from
  simulation SHACL

* add modelled agent concepts similar to modelled object

* remove of-constraint path constraint in favour of multi-type

* add different types of variations

- remove `:can-be` concept used for variation per each variable
- add CartesianProductVariation to denote variations as the
  cartesian product of sets of possible values for a specified list of
  variables. This is a reification of the previous behaviour, introduced
  to allow different types of variations.
- add TableVariation concept to specify variations as a table, where
  each row contains values of a specified list of variables for a single
  execution.
- add Combination to specify selecting a list of distinct members from
  a set (as opposed to Permutation)
- update SHACL constrants for the new concepts

* migrate distribution MM to secorolab/metamodels

- dependent on secorolab/metamodels#13
- dependent on secorolab/rdf-utils#2

* add Permutation, change dim to length

* add metamodel for quantifiers, adapt SHACL

* update quantifier & scenario variant constraints

- :ForAll must link to a :When
- :ThereExists must link to a :Given or :Then
- :ScenarioVariant can have 0 or 1 :has-clause property
- :ScenarioTemplate, :ForAll, :ThereExists must have exactly 1
  :has-clause property

* add domain-specific behaviours, WhenBehaviour

- add WhenBehaviour concept that compose a behavour with relevant
  parameters to represent a complete "when behaviour" clause
- add domain-specific concepts for pick and place behaviours
- adapt SHACL constraint accordingly

* add target-agent predicate

* disallow container in in-set

* remove pickplace behaviour and properties

pick and place behaviours will be handled as one with both
:Pick and :Place types, and pick workspace is removed as a specialized
property

* add MoveSafelyPredicate, DuringEventsConstraint

- change :ref-event predicate to :before-event & :after-event
- update SHACL time constraints
- add predicate to represent the agent is moving safely

* remove Fluent in flavour of multi-type FluentClause

* migrate geometry metamodels

migration planned in secorolab/metamodels#22
minhnh added a commit to minhnh/bdd-dsl that referenced this pull request Mar 4, 2025
minhnh added a commit to minhnh/bdd-dsl that referenced this pull request Mar 5, 2025
- probability model processing was migrated in secorolab/rdf-utils#2
- geometry model processing will be migrated in secorolab/rdf-utils#4
minhnh added a commit to minhnh/bdd-dsl that referenced this pull request Mar 6, 2025
minhnh added a commit to minhnh/bdd-dsl that referenced this pull request Mar 6, 2025
- probability model processing was migrated in secorolab/rdf-utils#2
- geometry model processing will be migrated in secorolab/rdf-utils#4
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.

3 participants