Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sogMBT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
27010ee0
Commit
27010ee0
authored
3 days ago
by
Jaime Arias
Browse files
Options
Downloads
Patches
Plain Diff
refactor: some refactoring in the main.cpp
parent
dced2859
No related branches found
No related tags found
No related merge requests found
Pipeline
#10781
passed
3 days ago
Stage: external
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/main.cpp
+18
-17
18 additions, 17 deletions
app/main.cpp
with
18 additions
and
17 deletions
app/main.cpp
+
18
−
17
View file @
27010ee0
...
...
@@ -10,7 +10,6 @@
#include
"Net.hpp"
#include
"bdd.h"
#include
"bvec.h"
#include
"petri_net_sog.hpp"
// BDD initial values
...
...
@@ -104,11 +103,11 @@ void SaveSOG(const SOG& sog, const string& sog_file) {
* @param weight_obs_paths vector of weights for the observable paths
* @param output_file_prefix file where the information will be saved
*/
void
PrintOutputObsWeights
(
const
RdP
::
net
&
model
,
SOG
&
sog
,
const
map
<
int
,
int
>&
obs_transitions
,
const
std
::
vector
<
std
::
vector
<
std
::
string
>>
obs_paths
,
const
std
::
vector
<
int
>&
weight_obs_paths
,
const
string
&
output_file_prefix
)
{
void
PrintOutputObsWeights
(
const
RdP
::
net
&
model
,
SOG
&
sog
,
const
map
<
int
,
int
>&
obs_transitions
,
const
std
::
vector
<
std
::
vector
<
std
::
string
>>
&
obs_paths
,
const
std
::
vector
<
int
>&
weight_obs_paths
,
const
string
&
output_file_prefix
)
{
sog
.
PrintCompleteInformation
();
cout
<<
"
\n
# transition: "
<<
model
.
transitions
.
size
()
<<
'\n'
;
cout
<<
"# places: "
<<
model
.
places
.
size
()
<<
'\n'
;
...
...
@@ -117,26 +116,28 @@ void PrintOutputObsWeights(const RdP::net& model, SOG& sog,
std
::
string
output_file
=
output_file_prefix
+
"_weights.txt"
;
cout
<<
"
\n
Saving weights in "
<<
output_file
<<
'\n'
;
// save weights in the file
ofstream
weight_file
(
output_file
);
weight_file
<<
"# path weights: "
<<
weight_obs_paths
.
size
()
<<
'\n'
;
for
(
auto
w_path
:
weight_obs_paths
)
{
if
(
w_path
!=
0
)
weight_file
<<
w_path
<<
'\n'
;
if
(
w_path
!=
0
)
{
weight_file
<<
w_path
<<
'\n'
;
}
}
//weight_file << '\n';
// save observable paths in the folder
std
::
string
output_obs_paths
=
output_file_prefix
+
"_obs_paths.txt"
;
ofstream
obs_paths_file
(
output_obs_paths
);
obs_paths_file
<<
"# obs. paths: "
<<
obs_paths
.
size
();
//<< '\n';
obs_paths_file
<<
"# obs. paths: "
<<
obs_paths
.
size
();
for
(
const
auto
&
obs_p
:
obs_paths
)
{
if
(
obs_p
.
size
()
!=
0
)
{
for
(
auto
t_label
:
obs_p
)
{
obs_paths_file
<<
t_label
<<
'_'
;
cout
<<
t_label
<<
"_"
;
}
if
(
!
obs_p
.
empty
())
{
for
(
const
auto
&
t_label
:
obs_p
)
{
obs_paths_file
<<
t_label
<<
'_'
;
cout
<<
t_label
<<
"_"
;
}
}
obs_paths_file
<<
'\n'
;
cout
<<
'\n'
;
}
...
...
@@ -239,7 +240,7 @@ void LoadTransitions(const RdP::net& model, const string& file,
* @param[out] obs_trans set of observable transitions
* @param[out] unobs_trans set of unobservable transitions
*/
void
FindObservableTransitions
(
RdP
::
net
&
model
,
map
<
int
,
int
>&
obs_trans
,
void
FindObservableTransitions
(
const
RdP
::
net
&
model
,
map
<
int
,
int
>&
obs_trans
,
set
<
int
>&
unobs_trans
)
{
// compute the unobservable transitions of the model using the pattern
unobs_trans
=
model
.
calcul1
();
...
...
@@ -405,7 +406,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();
// 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
;
...
...
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