Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_core
Commits
4e953d8a
Commit
4e953d8a
authored
1 year ago
by
Cyril Moineau
Browse files
Options
Downloads
Patches
Plain Diff
[FsmGraph] Fix issue with badly updated set.
parent
43e06e57
No related branches found
No related tags found
1 merge request
!31
Build fix
Pipeline
#32946
passed
1 year ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/graphRegex/matchFsm/FsmGraph.cpp
+13
-11
13 additions, 11 deletions
src/graphRegex/matchFsm/FsmGraph.cpp
with
13 additions
and
11 deletions
src/graphRegex/matchFsm/FsmGraph.cpp
+
13
−
11
View file @
4e953d8a
#include
"aidge/graphRegex/matchFsm/FsmGraph.hpp"
#include
"aidge/graphRegex/matchFsm/FsmGraph.hpp"
using
namespace
Aidge
;
using
namespace
Aidge
;
...
@@ -14,7 +14,7 @@ FsmGraph::FsmGraph(/* args */){
...
@@ -14,7 +14,7 @@ FsmGraph::FsmGraph(/* args */){
if
(
startNodes
.
size
()
!=
startNodesFsm
.
size
()){
if
(
startNodes
.
size
()
!=
startNodesFsm
.
size
()){
throw
std
::
runtime_error
(
"bad number of Start nodes"
);
throw
std
::
runtime_error
(
"bad number of Start nodes"
);
}
}
std
::
vector
<
std
::
shared_ptr
<
FsmRunTimeContext
>>
walks
;
std
::
vector
<
std
::
shared_ptr
<
FsmRunTimeContext
>>
walks
;
for
(
std
::
size_t
i
=
0
;
i
<
startNodes
.
size
();
i
++
){
for
(
std
::
size_t
i
=
0
;
i
<
startNodes
.
size
();
i
++
){
walks
.
push_back
(
std
::
make_shared
<
FsmRunTimeContext
>
(
startNodesFsm
[
i
],
startNodes
[
i
]));
walks
.
push_back
(
std
::
make_shared
<
FsmRunTimeContext
>
(
startNodesFsm
[
i
],
startNodes
[
i
]));
...
@@ -32,16 +32,16 @@ FsmGraph::FsmGraph(/* args */){
...
@@ -32,16 +32,16 @@ FsmGraph::FsmGraph(/* args */){
for
(
auto
fsmContext
:
walks
){
for
(
auto
fsmContext
:
walks
){
allContextSee
.
push_back
(
fsmContext
);
allContextSee
.
push_back
(
fsmContext
);
//if we are in a valid st we save it
//if we are in a valid st we save it
//it's one solution of the posible solution of the matching
//it's one solution of the posible solution of the matching
if
(
fsmContext
->
isOnValidState
()){
if
(
fsmContext
->
isOnValidState
()){
//not save 2 time the same end point
//not save 2 time the same end point
if
(
!
std
::
any_of
(
allValidContext
.
begin
(),
allValidContext
.
end
(),
if
(
!
std
::
any_of
(
allValidContext
.
begin
(),
allValidContext
.
end
(),
[
&
](
std
::
shared_ptr
<
Aidge
::
FsmRunTimeContext
>
oldValid
)
{
[
&
](
std
::
shared_ptr
<
Aidge
::
FsmRunTimeContext
>
oldValid
)
{
return
fsmContext
->
areEqual
(
oldValid
);
return
fsmContext
->
areEqual
(
oldValid
);
})){
})){
allValidContext
.
push_back
(
fsmContext
);
allValidContext
.
push_back
(
fsmContext
);
}
}
}
}
//dont test 2 time a fsmContext
//dont test 2 time a fsmContext
...
@@ -60,15 +60,15 @@ FsmGraph::FsmGraph(/* args */){
...
@@ -60,15 +60,15 @@ FsmGraph::FsmGraph(/* args */){
walks
.
swap
(
nextWalks
);
walks
.
swap
(
nextWalks
);
nextWalks
.
clear
();
nextWalks
.
clear
();
}
}
return
std
::
make_shared
<
MatchResult
>
(
allValidContext
,
getNbSubFsm
());
return
std
::
make_shared
<
MatchResult
>
(
allValidContext
,
getNbSubFsm
());
}
}
///////////////
///////////////
// FSM construction
// FSM construction
///////////////
///////////////
const
std
::
set
<
std
::
shared_ptr
<
FsmEdge
>>&
FsmGraph
::
getEdge
(
void
){
const
std
::
set
<
std
::
shared_ptr
<
FsmEdge
>>&
FsmGraph
::
getEdge
(
void
){
return
mEdges
;
return
mEdges
;
...
@@ -140,7 +140,7 @@ void FsmGraph::mergeOneStartOneValid(const std::shared_ptr<FsmGraph> fsmGraph){
...
@@ -140,7 +140,7 @@ void FsmGraph::mergeOneStartOneValid(const std::shared_ptr<FsmGraph> fsmGraph){
}
}
unionG
(
fsmGraph
);
unionG
(
fsmGraph
);
//for loop useless but for future merge it's coudl be used
//for loop useless but for future merge it's coudl be used
for
(
auto
valid
:
validNodes
){
for
(
auto
valid
:
validNodes
){
valid
->
unValid
();
valid
->
unValid
();
for
(
auto
start
:
startNodes
){
for
(
auto
start
:
startNodes
){
...
@@ -159,9 +159,11 @@ void FsmGraph::incOrigineAllNodeBy(std::size_t incr){
...
@@ -159,9 +159,11 @@ void FsmGraph::incOrigineAllNodeBy(std::size_t incr){
for
(
auto
node
:
nodes
){
for
(
auto
node
:
nodes
){
node
->
incOrigine
(
incr
);
node
->
incOrigine
(
incr
);
}
}
std
::
set
<
std
::
size_t
>
updatedOrigin
;
for
(
auto
origin
:
mAllOrigine
){
for
(
auto
origin
:
mAllOrigine
){
origin
+
=
incr
;
updatedOrigin
.
insert
(
origin
+
incr
)
;
}
}
mAllOrigine
.
swap
(
updatedOrigin
);
}
}
void
FsmGraph
::
_mergeNode
(
std
::
shared_ptr
<
FsmNode
>
source
,
std
::
shared_ptr
<
FsmNode
>
dest
){
void
FsmGraph
::
_mergeNode
(
std
::
shared_ptr
<
FsmNode
>
source
,
std
::
shared_ptr
<
FsmNode
>
dest
){
...
@@ -189,7 +191,7 @@ void FsmGraph::_mergeNode(std::shared_ptr<FsmNode> source,std::shared_ptr<FsmNod
...
@@ -189,7 +191,7 @@ void FsmGraph::_mergeNode(std::shared_ptr<FsmNode> source,std::shared_ptr<FsmNod
}
}
}
}
//check is source is not in graph
//check is source is not in graph
nodes
=
getNodes
();
nodes
=
getNodes
();
if
(
nodes
.
find
(
source
)
!=
nodes
.
end
()
){
if
(
nodes
.
find
(
source
)
!=
nodes
.
end
()
){
throw
std
::
runtime_error
(
"FsmGraph merge node not effective"
);
throw
std
::
runtime_error
(
"FsmGraph merge node not effective"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment