NamedDPs (Diagrams)¶
NamedDPs are objects that describe the elements of a co-design diagram; a graph that interconnects DPs.
They could be interpreted more as an "operad" built on DP.
Common NamedDP interface¶
NamedDP
dataclass
¶
Bases: Generic[FT, RT]
Generic interface of a NamedDP.
Attributes:
| Name | Type | Description |
|---|---|---|
functionalities |
dict[str, Poset[FT]]
|
a dictionary of functionalities. The order is significant. |
resources |
dict[str, Poset[RT]]
|
a dictionary of resources. The order is significant. |
Source code in src/act4e_mcdp/nameddps.py
SimpleWrap¶
The function of SimpleWrap is to wrap a PrimiviteDP in the graph.
SimpleWrap
dataclass
¶
Bases: NamedDP[FT, RT]
A simple wrapper that wraps a PrimitiveDP.
Note that a PrimitiveDP does not have a notion of "functionality names" and "resource names". When we wrap it in a SimpleWrap, we can associate names to them.
Attributes:
| Name | Type | Description |
|---|---|---|
functionalities |
dict[str, Poset]
|
a dictionary of functionalities. The order is significant. |
resources |
dict[str, Poset]
|
a dictionary of resources. The order is significant. |
dp |
PrimitiveDP[tuple[FT, ...], tuple[RT, ...]]
|
the wrapped DP. |
Source code in src/act4e_mcdp/nameddps.py
CompositeNamedDP¶
The function of CompositeNamedDP is to interconnect a number of NamedDPs in a graph.
Each node of the graph is a NamedDP -- either a SimpleWrap, which wraps one DP, or another CompositeNamedDP, thus allowing recursion.
CompositeNamedDP
dataclass
¶
Bases: Generic[FT, RT], NamedDP[FT, RT]
Description of a composite NamedDP.
The nodes are in nodes dictionary and the connections are in connections list.
See the class Connection for more details about the
interconnections.
This is how you would describe an empty diagram:
This corresponds to the DP from 1 to 1 which is always true.
This is how you would describe a diagram with two empty nodes:
two_inside = CompositeNamedDP(
functionalities={}, resources={},
nodes={
'one': empty,
'two': empty,
}, connections=[])
This is how you would describe a diagram with one functionality and resource connected directly (identity):
P = FinitePoset({'a', 'b'}, {('a', 'b')})
two_inside = CompositeNamedDP(
functionalities={'f1': P},
resources={'r1': P},
nodes={},
connections=[
Connection(
source=ModelFunctionality('f1'),
target=ModelResource('r1')
)]
)
Attributes:
| Name | Type | Description |
|---|---|---|
functionalities |
dict[str, Poset]
|
a dictionary of functionalities |
resources |
dict[str, Poset]
|
a dictionary of resources |
nodes |
dict[str, NamedDP[Any, Any]]
|
the nodes inside the graph |
connections |
list[Connection]
|
the connections between nodes |
Source code in src/act4e_mcdp/nameddps.py
The connections are described by a list of Connection objects.
Connection
dataclass
¶
A connection in a co-design graph.
Note that the source of a connection can be either:
- a ModelFunctionality: a functionality of the entire diagram
- a NodeResource: a resource of a node.
Note that the target of a connection can be either:
- a ModelResource: a resource of the entire diagram
- a NodeFunctionality: a functionality of a node.
Attributes:
| Name | Type | Description |
|---|---|---|
source |
ModelFunctionality | NodeResource
|
the source of the connection |
target |
ModelResource | NodeFunctionality
|
the target of the connection |
Source code in src/act4e_mcdp/nameddps.py
These are the utility classes that describe the interconnection.
ModelResource
dataclass
¶
A resource of the entire diagram. Used by the Connection class.
Attributes:
| Name | Type | Description |
|---|---|---|
resource |
str
|
the resource name |
Source code in src/act4e_mcdp/nameddps.py
ModelFunctionality
dataclass
¶
A functionality of the entire diagram. Used by the Connection class.
Attributes:
| Name | Type | Description |
|---|---|---|
functionality |
str
|
the functionality name |
Source code in src/act4e_mcdp/nameddps.py
NodeResource
dataclass
¶
A resource of a node. Used by the Connection class.
Attributes:
| Name | Type | Description |
|---|---|---|
node |
str
|
the node name |
resource |
str
|
the resource name |
Source code in src/act4e_mcdp/nameddps.py
NodeFunctionality
dataclass
¶
A functionality of a node. Used by the Connection class.
Attributes:
| Name | Type | Description |
|---|---|---|
node |
str
|
the node name |
functionality |
str
|
the functionality name |