Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sogMBT
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PMC-SOG
sogMBT
Commits
15182503
Commit
15182503
authored
2 months ago
by
Jaime Arias
Browse files
Options
Downloads
Patches
Plain Diff
refactor: add AddArc method
parent
50e50b6e
No related branches found
No related tags found
No related merge requests found
Pipeline
#9311
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/petri_net_sog.cpp
+6
-16
6 additions, 16 deletions
src/petri_net_sog.cpp
src/sog.cpp
+3
-4
3 additions, 4 deletions
src/sog.cpp
src/sog.hpp
+5
-4
5 additions, 4 deletions
src/sog.hpp
with
14 additions
and
24 deletions
src/petri_net_sog.cpp
+
6
−
16
View file @
15182503
...
...
@@ -340,20 +340,17 @@ void PetriNetSOG::GenerateSOG(SOG &sog, map<int, int> trans_obs) const {
// if aggregate does not exist in the sog
if
(
!
pos
)
{
curr_aggr
.
aggregate
->
successors
.
insert
(
curr_aggr
.
aggregate
->
successors
.
begin
(),
Edge
(
succ_aggr
,
t
));
sog
.
AddState
(
succ_aggr
);
sog
.
Add
Predecessor
(
succ_aggr
,
Edge
(
curr_aggr
.
aggregate
,
t
)
);
sog
.
Add
Arc
(
curr_aggr
.
aggregate
,
succ_aggr
,
t
);
// if the successor has fireable transitions, it is added to the stack
// if the successor has fireable transitions, it is added to the
// stack
firable_trans
=
FirableObservableTrans
(
complete_succ_aggr
);
if
(
!
firable_trans
.
empty
())
{
st
.
emplace
(
succ_aggr
,
firable_trans
);
}
}
else
{
curr_aggr
.
aggregate
->
successors
.
insert
(
curr_aggr
.
aggregate
->
successors
.
begin
(),
Edge
(
pos
,
t
));
sog
.
AddPredecessor
(
pos
,
Edge
(
curr_aggr
.
aggregate
,
t
));
sog
.
AddArc
(
curr_aggr
.
aggregate
,
pos
,
t
);
delete
succ_aggr
;
}
}
...
...
@@ -427,13 +424,9 @@ Paths PetriNetSOG::ObservablePaths(SOG &sog, map<int, int> trans_obs) const {
if
(
!
pos
)
{
firable_trans
=
FirableObservableTrans
(
complete_aggr
);
// add transitions
elt
.
aggregate
->
successors
.
insert
(
elt
.
aggregate
->
successors
.
begin
(),
Edge
(
reached_aggr
,
t
));
// add the aggregate and its predecessors to the graph
sog
.
AddState
(
reached_aggr
);
sog
.
Add
Predecessor
(
reached_aggr
,
Edge
(
elt
.
aggregate
,
t
)
);
sog
.
Add
Arc
(
elt
.
aggregate
,
reached_aggr
,
t
);
// if the aggregate has no firable transitions
if
(
firable_trans
.
empty
())
{
...
...
@@ -453,11 +446,8 @@ Paths PetriNetSOG::ObservablePaths(SOG &sog, map<int, int> trans_obs) const {
ReinitCycle
(
current_trace
,
trans_obs
);
current_trace
.
pop_back
();
sog
.
AddArc
(
elt
.
aggregate
,
pos
,
t
);
delete
reached_aggr
;
elt
.
aggregate
->
successors
.
insert
(
elt
.
aggregate
->
successors
.
begin
(),
Edge
(
pos
,
t
));
sog
.
AddPredecessor
(
pos
,
Edge
(
elt
.
aggregate
,
t
));
old
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/sog.cpp
+
3
−
4
View file @
15182503
...
...
@@ -22,8 +22,6 @@ Aggregate *SOG::FindState(const Aggregate *state) const {
void
SOG
::
AddState
(
Aggregate
*
state
)
{
state
->
visited
=
false
;
this
->
states
.
push_back
(
state
);
nb_edges
+=
state
->
predecessors
.
size
();
nb_edges
+=
state
->
successors
.
size
();
nb_states
++
;
}
...
...
@@ -136,8 +134,9 @@ void SOG::PrintSuccessors(const Aggregate *state) const {
}
}
void
SOG
::
AddPredecessor
(
Aggregate
*
state
,
const
Edge
edge
)
{
state
->
predecessors
.
insert
(
state
->
predecessors
.
begin
(),
edge
);
void
SOG
::
AddArc
(
Aggregate
*
from
,
Aggregate
*
to
,
const
int
t
)
{
from
->
successors
.
insert
(
from
->
successors
.
begin
(),
Edge
(
to
,
t
));
to
->
predecessors
.
insert
(
to
->
predecessors
.
begin
(),
Edge
(
from
,
t
));
nb_edges
++
;
}
...
...
This diff is collapsed.
Click to expand it.
src/sog.hpp
+
5
−
4
View file @
15182503
...
...
@@ -53,11 +53,12 @@ class SOG {
void
PrintSuccessors
(
const
Aggregate
*
state
)
const
;
/**
* Add a predecessor to an state
* @param state state to add a predecessor
* @param edge the edge to add
* Add an arc to the graph
* @param from source state
* @param to target state
* @param t transition identifier
*/
void
Add
Predecessor
(
Aggregate
*
state
,
Edge
edge
);
void
Add
Arc
(
Aggregate
*
from
,
Aggregate
*
to
,
int
t
);
/**
* Print predecessors of an state
...
...
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