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
cda9fc53
Commit
cda9fc53
authored
6 days ago
by
Kais Klai
Browse files
Options
Downloads
Patches
Plain Diff
modif update lg
parent
437908fa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#10700
passed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/main.cpp
+5
-2
5 additions, 2 deletions
app/main.cpp
src/petri_net_sog.cpp
+19
-13
19 additions, 13 deletions
src/petri_net_sog.cpp
src/sog.cpp
+44
-3
44 additions, 3 deletions
src/sog.cpp
with
68 additions
and
18 deletions
app/main.cpp
+
5
−
2
View file @
cda9fc53
...
...
@@ -307,7 +307,9 @@ void ComputeAbstractPaths(const std::string& net_file, int bound, bool only_sog,
pn_sog
.
GenerateSOG
(
sog
);
auto
sog_time
=
GetTime
()
-
start_sog_time
;
std
::
cout
<<
" done
\n
Time for computing SOG: "
<<
sog_time
<<
" seconds
\n
"
;
std
::
cout
<<
"--------------------"
<<
std
::
endl
;
sog
.
PrintCompleteInformation
();
std
::
cout
<<
"--------------------"
<<
std
::
endl
;
auto
elapsed_time
=
GetTime
()
-
start_time
;
std
::
cout
<<
"
\n
Total time: "
<<
elapsed_time
<<
" seconds
\n
"
;
...
...
@@ -400,7 +402,7 @@ void SaveObsPathsAndWeights(const string& net_file, int bound,
auto
sog_time
=
GetTime
()
-
start_sog_time
;
cout
<<
" done
\n
Time for computing SOG: "
<<
sog_time
<<
" seconds
\n
"
;
sog
.
PrintCompleteInformation
();
std
::
cout
<<
"
\n
Generating regex from the SOG ... "
;
auto
start_regex_time
=
GetTime
();
const
std
::
string
language
=
pn_sog
.
GenerateRegExp
(
&
sog
).
begin
()
->
first
;
...
...
@@ -442,6 +444,7 @@ void SaveObsPathsAndWeights(const string& net_file, int bound,
// print output
PrintOutputObsWeights
(
model
,
sog
,
obs_trans
,
obs_paths
,
weight_obs_paths
,
output_file_prefix
);
}
/******************************************************************************
...
...
This diff is collapsed.
Click to expand it.
src/petri_net_sog.cpp
+
19
−
13
View file @
cda9fc53
...
...
@@ -394,7 +394,6 @@ int PetriNetSOG::ComputeSingleMaxWeight(const Aggregate *aggr, const int in,
<<
transitions
[
out
].
name
<<
'\n'
;
bdd
source
=
SearchExitPoints
(
aggr
->
bdd_state
,
out
);
const
bdd
dest
=
relation
[
in
]((
aggr
->
GetPredecessorsOfTrans
(
in
))
->
bdd_state
);
// backtracking from source until dest
bdd
inputPoints
=
dest
&
source
;
int
counter
=
0
;
...
...
@@ -668,17 +667,21 @@ std::string JoinSequencesOfLg(const Lg &lg) {
void
UpdateLanguage
(
const
Aggregate
*
s
,
const
int
s0
,
std
::
map
<
int
,
Lg
>
&
lg_map
,
std
::
set
<
int
>
&
visited
)
{
if
(
visited
.
find
(
s
->
id
())
!=
visited
.
end
())
{
Lg
updated_lg
=
{};
for
(
const
LgElement
&
e
:
lg_map
[
s
->
id
()])
{
const
std
::
string
seq_e
=
e
.
first
;
const
Aggregate
*
state_e
=
e
.
second
;
if
(
state_e
!=
nullptr
&&
state_e
->
id
()
!=
s0
)
{
UpdateLanguage
(
state_e
,
s0
,
lg_map
,
visited
);
ConcatSequences
(
seq_e
,
lg_map
[
state_e
->
id
()],
updated_lg
);
}
else
{
updated_lg
.
push_back
(
e
);
}
if
(
visited
.
find
(
state_e
->
id
())
!=
visited
.
end
())
{
if
(
state_e
!=
nullptr
&&
state_e
->
id
()
!=
s0
)
{
UpdateLanguage
(
state_e
,
s0
,
lg_map
,
visited
);
ConcatSequences
(
seq_e
,
lg_map
[
state_e
->
id
()],
updated_lg
);
}
else
{
updated_lg
.
push_back
(
e
);
}
}
}
lg_map
[
s
->
id
()]
=
updated_lg
;
}
...
...
@@ -730,11 +733,15 @@ Lg PetriNetSOG::RegularExpressionGeneration(std::vector<Aggregate *> &st,
if
(
!
cy
.
empty
())
{
std
::
string
seq
=
JoinSequencesOfLg
(
cy
);
if
(
!
cy_compl
.
empty
())
{
Lg
updated_lg
=
{};
for
(
const
LgElement
&
e
:
cy_compl
)
{
updated_lg
.
push_back
({
seq
+
e
.
first
,
e
.
second
});
}
lg_map
[
cur
->
id
()]
=
updated_lg
;
lg_map
[
cur
->
id
()]
=
{};
//Lg updated_lg = {};
//for (const LgElement &e : cy_compl) {
// updated_lg.push_back({seq + e.first, e.second});
//}
for
(
const
LgElement
&
e
:
cy_compl
)
{
lg_map
[
cur
->
id
()].
push_back
({
seq
+
e
.
first
,
e
.
second
});
}
//lg_map[cur->id()] = updated_lg;
}
else
{
lg_map
[
cur
->
id
()]
=
{{
seq
,
nullptr
}};
}
...
...
@@ -746,7 +753,6 @@ Lg PetriNetSOG::RegularExpressionGeneration(std::vector<Aggregate *> &st,
st
.
pop_back
();
visited
.
insert
(
cur
->
id
());
return
lg_map
[
cur
->
id
()];
}
...
...
This diff is collapsed.
Click to expand it.
src/sog.cpp
+
44
−
3
View file @
cda9fc53
...
...
@@ -67,7 +67,7 @@ void SOG::ResetVisitedFlag(Aggregate *state, size_t counter) {
}
}
void
SOG
::
PrintGraph
(
Aggregate
*
state
,
size_t
counter
)
{
/*
void SOG::PrintGraph(Aggregate *state, size_t counter) {
if (counter <= nb_states) {
std::cout << "\nSTATE NUMBER " << counter << " : \n";
state->visited = true;
...
...
@@ -83,6 +83,23 @@ void SOG::PrintGraph(Aggregate *state, size_t counter) {
}
}
}
}*/
void
SOG
::
PrintGraph
(
Aggregate
*
state
,
size_t
counter
)
{
if
(
counter
<=
nb_states
)
{
std
::
cout
<<
"
\n
STATE NUMBER "
<<
state
->
id
()
<<
" :
\n
"
;
state
->
visited
=
true
;
PrintSuccessors
(
state
);
getchar
();
PrintPredecessors
(
state
);
getchar
();
for
(
const
auto
&
successor
:
state
->
successors
)
{
if
(
!
successor
.
state
->
visited
)
{
counter
++
;
PrintGraph
(
successor
.
state
,
counter
);
}
}
}
}
void
SOG
::
ExportGraphToDotFile
(
const
std
::
string
&
filename
)
const
{
...
...
@@ -113,7 +130,7 @@ void SOG::ExportGraphToDotFile(const std::string &filename) const {
file
.
close
();
}
void
SOG
::
PrintSuccessors
(
const
Aggregate
*
state
)
const
{
/*
void SOG::PrintSuccessors(const Aggregate *state) const {
std::cout << bddtable << state->bdd_state << '\n';
std::cout << "\n\tIts successors are ( " << state->successors.size()
...
...
@@ -125,6 +142,19 @@ void SOG::PrintSuccessors(const Aggregate *state) const {
<< successor.state->bdd_state << '\n';
getchar();
}
}*/
void
SOG
::
PrintSuccessors
(
const
Aggregate
*
state
)
const
{
std
::
cout
<<
bddtable
<<
state
->
id
()
<<
'\n'
;
std
::
cout
<<
"
\n\t
Its successors are ( "
<<
state
->
successors
.
size
()
<<
" ):
\n\n
"
;
getchar
();
for
(
const
auto
&
successor
:
state
->
successors
)
{
std
::
cout
<<
"
\t
- t"
<<
successor
.
transition
<<
" -> "
<<
bddtable
<<
successor
.
state
->
id
()
<<
'\n'
;
getchar
();
}
}
void
SOG
::
AddArc
(
Aggregate
*
from
,
Aggregate
*
to
,
const
int
t
)
{
...
...
@@ -133,7 +163,7 @@ void SOG::AddArc(Aggregate *from, Aggregate *to, const int t) {
nb_edges
++
;
}
void
SOG
::
PrintPredecessors
(
const
Aggregate
*
state
)
const
{
/*
void SOG::PrintPredecessors(const Aggregate *state) const {
std::cout << "\n\tIts predecessors are ( " << state->predecessors.size()
<< " ):\n\n";
getchar();
...
...
@@ -143,4 +173,15 @@ void SOG::PrintPredecessors(const Aggregate *state) const {
<< predecessor.state->bdd_state << '\n';
getchar();
}
}*/
void
SOG
::
PrintPredecessors
(
const
Aggregate
*
state
)
const
{
std
::
cout
<<
"
\n\t
Its predecessors are ( "
<<
state
->
predecessors
.
size
()
<<
" ):
\n\n
"
;
getchar
();
for
(
const
auto
&
predecessor
:
state
->
predecessors
)
{
std
::
cout
<<
"
\t
- t"
<<
predecessor
.
transition
<<
" ->"
<<
bddtable
<<
predecessor
.
state
->
id
()
<<
'\n'
;
getchar
();
}
}
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