Conversation
4032199 to
64e3612
Compare
50958e6 to
ddbd80e
Compare
ddbd80e to
4f3da1c
Compare
| // Physical + x | ||
| {std::make_pair<ConnectionType, ConnectionType>(Physical, Normal), Physical}, | ||
| {std::make_pair<ConnectionType, ConnectionType>(Physical, Delayed), Invalid}, // !!! | ||
| {std::make_pair<ConnectionType, ConnectionType>(Physical, Enclaved), PhysicalEnclaved}, |
There was a problem hiding this comment.
I think all these cases should be invalid for now (except for Phycical + Normal)
| // PhysicalEnclaved + x | ||
| {std::make_pair<ConnectionType, ConnectionType>(PhysicalEnclaved, Normal), PhysicalEnclaved}, | ||
| {std::make_pair<ConnectionType, ConnectionType>(PhysicalEnclaved, Delayed), Invalid}, // !!! | ||
| {std::make_pair<ConnectionType, ConnectionType>(PhysicalEnclaved, Enclaved), PhysicalEnclaved}, |
There was a problem hiding this comment.
I think all these cases should be invalid for now (except for PhycicalEnclaved + Normal)
|
|
||
| // not copyable, but movable | ||
| ReactorElement(const ReactorElement&) = delete; | ||
| ReactorElement(const ReactorElement&) = default; |
There was a problem hiding this comment.
The copy constructor is deleted on purpose and we should try to avoid enabling it
| SOVERSION 1) | ||
|
|
||
| option(GRAPH_OPTIMIZATIONS "Graph optimizations" ON) | ||
| if(GRAPH_OPTIMIZATIONS) |
There was a problem hiding this comment.
this can be handled more conveniently in config.hh.in
| void Environment::optimize() { | ||
| // no optimizations | ||
| optimized_graph_ = graph_; | ||
| #if GRAPH_OPTIMIZATIONS |
There was a problem hiding this comment.
Easier:
constexpr bool enable_optimizations = (GRAPH_OPTIMIZATIONS == 1);
| @@ -39,10 +39,10 @@ ReactorElement::ReactorElement(const std::string& name, ReactorElement::Type typ | |||
| container->register_action(reinterpret_cast<BaseAction*>(this)); // NOLINT | |||
There was a problem hiding this comment.
| container->register_action(reinterpret_cast<BaseAction*>(this)); // NOLINT | |
| container->register_action(static_cast<BaseAction*>(this)); // NOLINT |
| container->register_output(static_cast<BasePort*>(this)); // NOLINT | ||
| break; | ||
| case Type::Reaction: | ||
| container->register_reaction(reinterpret_cast<Reaction*>(this)); // NOLINT |
There was a problem hiding this comment.
| container->register_reaction(reinterpret_cast<Reaction*>(this)); // NOLINT | |
| container->register_reaction(static_cast<Reaction*>(this)); // NOLINT |
| std::copy_if(keys.begin(), keys.end(), std::back_inserter(has_upstreams), | ||
| [](auto element) { return element->connected_to_upstream_actions(); }); | ||
|
|
||
| // generating all the possible destinations for all sources |
There was a problem hiding this comment.
I think it would be really helpful to have a more lengthy comment explaining the high level idea of the algorithm.
|
|
||
| for (auto edge : path) { | ||
| auto property = std::get<1>(edge); | ||
| // auto source_port = std::get<0>(edge); |
|
TODO: Mermaid Function fixen |
831323e to
fd8fda0
Compare
About
This pull requests add functionality, so the port graph can be first optimized before instantiating.
Current Algorithm
Create a spanning tree for every port and then squash the edges together so ideally only a tree of depth 1 remains.
Challanges
Given a port-graph like this:
graph TD; A-->B; X((R1)) --> A; B-->D; B-->C; C-->Y((R2));The current graph optimizer would create something like this:
graph TD; X((R1)) --> A; A-->B; A-->C; B-->C; B-->D; A-->D; C-->Y((R2));If B just forwards data and
Dead Path Elimination
Paths: (A-->D, A-->B and B-->C) can be eliminated with the following reasoning:
graph TD; X((R1)) --> A; A-->C; C-->Y((R2));