Add support for optional parameters
The domain model specifies parameters that are optional or mutually exclusive in actions and modifiers. This means that those parameters can have no value. An example would be action assign_position
, which has three parameters
, position
, route_point
and odr_point
, but only one of them must be used. Another is the modifier position, which has the parameter ahead_of
that specifies a reference vehicle if used. If not, no reference vehicle exists, and the position is specified in a different way.
However, the language currently doesn't support this. When an instance is created, all parameters must get a valid value. If a parameter is unconstrained, it gets assigned a random value. That means that the domain model is incompatible with the language in that sense.
My suggestion is to add a new specifier for parameters to be able to define them as optional. For example
action my_action:
a: int
b: int
c: int is optional
d: int is optional
scenario my_scenario:
do serial:
my_action(a: 1, c: 2)
In the action invocation, a will be constrained to a value of 1, b gets a randomized value, c again gets a value of 2, and d is considered to have no value at all, because it is optional and unconstrained.