Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMC-SOG
experiments
hybrid
Commits
0b20cb7c
Commit
0b20cb7c
authored
Apr 24, 2020
by
Jaime Arias
Browse files
fix: add quotes to ap in pmc-sog formulas
parent
765da79c
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/formula_generator.py
View file @
0b20cb7c
...
...
@@ -75,7 +75,8 @@ def generate_spot_formulas(model_name, model_instance, n, paths):
f
'
{
model_instance
}
.pnml'
)
atomic_propositions
=
get_atomic_propositions
(
pnml_file
)
atomic_propositions
=
'==1 '
.
join
(
atomic_propositions
[
'places'
])
atomic_propositions
=
" "
.
join
(
[
f
"
{
ap
}
==1"
for
ap
in
atomic_propositions
[
'places'
]])
command
=
f
'
{
paths
[
"randltl"
]
}
-L -s -p -n
{
n
}
--ltl-priorities="
{
ignored_operators
}
"
{
atomic_propositions
}
'
...
...
@@ -144,7 +145,11 @@ def write_formula(model_name, model_instance, formula, identifier):
with
open
(
os
.
path
.
join
(
base
,
filename_ltsmin
),
'w'
)
as
ltsmin
,
\
open
(
os
.
path
.
join
(
base
,
filename_pmcsog
),
'w'
)
as
pmcsog
:
pmcsog_formula
=
formula
.
replace
(
'==1'
,
''
)
# remove ==1 and add " to atomic propositions
pmcsog_formula
=
re
.
sub
(
pattern
=
r
'\((\w*\d*)==1\)'
,
repl
=
'("
\\
1")'
,
string
=
formula
)
ltsmin
.
write
(
formula
)
pmcsog
.
write
(
pmcsog_formula
)
...
...
@@ -155,7 +160,7 @@ def generate_formulas(model_name,
timeout
,
paths
,
save
=
True
):
"""Generates N satified and N violated formulas"""
"""Generates N sati
s
fied and N violated formulas"""
true_formulas
=
[]
false_formulas
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment