Dictionary with "Event" as key type
Hi @mhd91,
I checked online and it seems possible to create a dictionary that has as keys elements of (almost) any type. In particular, you could create the class Event
and use an instance of this class as key for the dictionary mu
.
For instance, the following code works:
class Event:
def __init__(self, name: str, isControllable: bool):
self.name = name
self.isControllable = isControllable
mu = {
Event("a",True): Matrix([[eps,1,3],[eps,eps,4],[eps,eps,eps]]),
Event("b",False): Matrix([[eps,eps,eps],[2,1,eps],[7,5,1]])
}
Here we have two events: the first of name "a", which is controllable, and the second one of name "b", which is uncontrollable. You can also define a variable for each event, e.g.,
event_a = Event("a",True)
event_b = Event("b",False)
mu = {
event_a: Matrix([[eps,1,3],[eps,eps,4],[eps,eps,eps]]),
event_b: Matrix([[eps,eps,eps],[2,1,eps],[7,5,1]])
}
I think this is the most elegant way to define events and specify their controllability status.