-
Notifications
You must be signed in to change notification settings - Fork 7
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
TPA: Merge DAG nested loops #80
base: master
Are you sure you want to change the base?
Conversation
c04111e
to
51299f2
Compare
3d9ffb2
to
f33d78a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help we understand this by maybe providing some comments or pseudocode?
Also, can you build several benchmarks where you would compare the performance before and after?
src/engine/TPA.cc
Outdated
@@ -46,6 +47,16 @@ VerificationResult TPAEngine::solve(ChcDirectedHyperGraph const & graph) { | |||
auto translator = std::move(transformationResult.second); | |||
if (transformedGraph->isNormalGraph()) { | |||
auto normalGraph = transformedGraph->toNormalGraph(); | |||
if (options.hasOption(Options::SIMPLIFY_NESTED)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this into the solve
method that takes DirectedChcGraph
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
if (graph.getVertices().size() <= 3) { return loop; } | ||
auto graphRepresentation = AdjacencyListsGraphRepresentation::from(graph); | ||
auto vertices = reversePostOrder(graph, graphRepresentation); | ||
std::unordered_set<int> visitedVertices; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be SymRef
s, no? Not int
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can go and try create default constructor for SymRef, but I'm not sure if it is an appropriate solution here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You just need to provide SymRefHash
as additional template parameter.
std::unordered_set<SymRef, SymRefHash>
.
You have to tell the set how it is supposed to hash your custom type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
std::move(originalGraph), graph, std::move(locationVars), std::move(argVars), simplifiedNodes); | ||
} | ||
|
||
void strongConnection(std::unordered_set<int> & visitedVertices, std::unordered_set<int> & verticesOnStack, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a pseudocode or a reference, or an explanation?
It is not easy to follow what the algorithm is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
…ved code duplications
8955553
to
ba6b53f
Compare
This is an implementation of the merging of the nested loops into a single Transition System. It is done via the same approach as the transformation of the whole instance into the single System, but is adapted to only merge loops in the Graph structure into a single node.