Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benoit Barbot
WordGen
Commits
9e0ac4eb
Commit
9e0ac4eb
authored
Apr 23, 2021
by
Benoit Barbot
Browse files
add test
parent
91a0517d
Pipeline
#2096
passed with stages
in 2 minutes and 9 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Semantic.ml
View file @
9e0ac4eb
...
...
@@ -265,7 +265,7 @@ struct
P
.
to_float
@@
rgp2
.
statelist
.
(
rgp2
.
init
)
.
loc_weight
|>>>
(
fun
x
->
x
<
0
.
0
)
|>>|
true
then
(
-.
target
-.
1
.
0
,
0
.
0
)
then
(
0
,
-.
target
-.
1
.
0
,
0
.
0
)
else
Samp
.
sample
~
out_style
:
target
~
max_iter
:
100
~
boltz
?
seed
~
sampler
:
Low_disc_sampler
.
random
rgp2
...
...
@@ -276,7 +276,8 @@ struct
let
b
,
v
=
Math
.
bisect_increasing
~
factor
:
0
.
001
~
relax
:
0
.
1
~
up_bound
:
false
~
low
:
(
0
.
0
,
-.
target
)
(
0
.
0
,
1
.
0
)
(
fun
b
->
let
size
,
_
=
make_estimate
10000
b
in
let
n
,
size
,
_
=
make_estimate
10000
b
in
if
verbose
>
0
then
Format
.
printf
"|%i@?"
n
;
if
verbose
>
2
then
Format
.
printf
" samples with z:%g -> %g@."
b
(
size
+.
target
);
(
size
,
0
.
0
))
...
...
src/sampling.ml
View file @
9e0ac4eb
...
...
@@ -387,10 +387,7 @@ module MakeSMCMonitor
(
W
:
Polynomial
.
WeightStructure
)
(
St
:
STATE
with
type
p
=
W
.
t
)
=
struct
type
t
=
Format
.
formatter
*
float
*
((
int
*
float
)
*
(
int
*
float
*
float
*
float
*
float
))
ref
type
t
=
float
*
((
int
*
float
)
*
(
int
*
float
*
float
*
float
*
float
))
ref
type
style
=
float
...
...
@@ -400,17 +397,17 @@ struct
type
weight
=
W
.
t
type
out
=
float
*
float
type
out
=
int
*
float
*
float
let
alpha
=
0
.
01
let
init
o
_
target
_
=
(
o
,
target
,
ref
((
0
,
0
.
0
)
,
(
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
)))
let
init
_
_
target
_
=
(
target
,
ref
((
0
,
0
.
0
)
,
(
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
)))
let
new_traj
(
_
,
_
,
mon_state
)
=
let
new_traj
(
_
,
mon_state
)
=
let
_
,
glob
=
!
mon_state
in
mon_state
:=
((
0
,
0
.
0
)
,
glob
)
let
up_trans
(
_
,
_
,
mon_state
)
time
_
_
=
let
up_trans
(
_
,
mon_state
)
time
_
_
=
let
(
size
,
duration
)
,
glob
=
!
mon_state
in
mon_state
:=
((
size
+
1
,
duration
+.
time
)
,
glob
)
...
...
@@ -418,7 +415,7 @@ struct
let
up_state_elapsed
_
_
_
=
()
let
end_traj
(
_
,
target
,
mon_state
)
_
=
let
end_traj
(
target
,
mon_state
)
_
=
let
(
size
,
dur
)
,
(
n
,
msize
,
msize2
,
mduration
,
mduration2
)
=
!
mon_state
in
let
fsize
=
float
size
in
...
...
@@ -438,11 +435,11 @@ struct
&&
n
>=
10
then
raise
Exit
let
end_sampling
(
o
,
target
,
mon_state
)
=
let
end_sampling
(
target
,
mon_state
)
=
let
_
,
(
n
,
size
,
_
,
duration
,
_
)
=
!
mon_state
in
(*let cilow, ciup = Math.comp_gaussian_ci alpha size size2 n in
Format.fprintf o "run : %i, size: %g [%g;%g] ,%g@?" n size cilow ciup
(duration /. float n);*)
Format
.
fprintf
o
"|%i@?"
n
;
(
size
-.
target
,
duration
/.
float
n
)
(
n
,
size
-.
target
,
duration
/.
float
n
)
end
test.t/run.t
View file @
9e0ac4eb
...
...
@@ -59,12 +59,11 @@ Simple interaction
Timed
test
without
s nor z
$ wordgen twoears.prism -v 0 --traj 1 --template "0.5[0.1]0.25[b]0.65[0.2]"
0.454917[a] 0.394449[b] 0.650000[a]
$ wordgen twoears.prism --seed 42 twoears.data --gnuplo
t
-
driver
png
--
output
-
format
state_list_full
|
sed
'
s/[[][0-9]*[.][0-9]*s[]]//g
'
Precomputation
file
found
!
[
0.00
]
Reading
Distribution
[
floating
point
;
Poly
;
no
s; clocks:{y; x;
};
vars:
{
t
;
z
;
s; }] -> 3
Reading
Prism
automaton
file
.
Computing
forward
reachability
graph
...
3
states
found
.
Splitting
reachability
graph
...
4
states
found
.
Computing
Distribution
[
floating
point
;
Poly
;
no
s; clocks:{y; x;
};
vars:
{
t
;
z
;
s; }] -> 3: [|||]
Sampling: []
$ wordgen nfm19.prism --seed 42 --traj 5 --output-format state_list_full --sampler halton -v 3 | sed 's/[[][0-9]*[.][0-9]*s[]]//g'
...
...
@@ -514,6 +513,8 @@ Test with s<>0
0.945546 99
1.350803 100
$ wordgen twoears.prism -v 0 --traj 1 --expected-size 10 --template "0.5[b]0.25[b]0.65[0.2]0.3[0.1]" --output-format void
Test uppal input
...
...
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