Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tiamo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Maximilien COLANGE
tiamo
Commits
a0eda0df
Commit
a0eda0df
authored
Apr 06, 2016
by
Maximilien Colange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize LU bounds computation.
parent
832da45c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
45 deletions
+17
-45
src/uppaalta.ml
src/uppaalta.ml
+17
-45
No files found.
src/uppaalta.ml
View file @
a0eda0df
...
...
@@ -607,24 +607,6 @@ struct
(********** LOADING FUNCTIONS **********)
(** given a set of expressions, simplify it to retain only its maximal
* constant and all non-constant *)
(* TODO check that the input does not contain ConstVariable or constant ConstArray *)
let
simplify_max
exprs
=
let
new_max
=
function
|
None
->
(
function
|
Constant
k
->
Some
k
|
_
->
None
)
|
Some
m
as
e
->
(
function
|
Constant
k
when
k
>
m
->
Some
k
|
_
->
e
)
in
match
List
.
fold_left
new_max
None
exprs
with
|
None
->
exprs
|
Some
k
->
List
.
filter
(
function
|
Constant
l
when
l
<
k
->
false
|
_
->
true
)
exprs
(* given a process, a location l and a clock c, compute the set of expressions
* against which c is compared from l until it is reset.
* Formally, the result S is the smallest set of expressions such that:
...
...
@@ -645,39 +627,29 @@ struct
let
n
=
VarContext
.
size
ta
.
clocks
in
let
lb
,
ub
=
Array
.
make
n
0
,
Array
.
make
n
0
in
let
eval
=
eval_exp
ta
state
.
stateVars
in
for
cl
=
0
to
n
-
1
do
let
lexpr
,
uexpr
=
Array
.
fold_left
(
fun
(
lacc
,
uacc
)
loc
->
for
cl
=
1
to
n
-
1
do
Array
.
iter
(
fun
loc
->
let
ltmp
,
utmp
=
loc
.
compExpr
.
(
cl
)
in
(
lacc
@
ltmp
,
uacc
@
utmp
))
([]
,
[]
)
(* instantiate found expressions, and retain only the maximal constant *)
List
.
iter
(
fun
e
->
match
eval
e
with
|
Constant
k
when
k
>
lb
.
(
cl
)
->
lb
.
(
cl
)
<-
k
|
Constant
_
->
()
|
_
->
failwith
"expression does not evaluate to constant"
)
ltmp
;
List
.
iter
(
fun
e
->
match
eval
e
with
|
Constant
k
when
k
>
ub
.
(
cl
)
->
ub
.
(
cl
)
<-
k
|
Constant
_
->
()
|
_
->
failwith
"expression does not evaluate to constant"
)
utmp
)
state
.
stateLocs
in
(* instantiate found expressions, and retain only the maximal constant *)
let
lcst
,
ucst
=
simplify_max
(
List
.
map
eval
lexpr
)
,
simplify_max
(
List
.
map
eval
uexpr
)
in
begin
match
lcst
with
|
(
Constant
k
)
::_
->
lb
.
(
cl
)
<-
max
lb
.
(
cl
)
k
|
_
->
(* TODO can it happen? *)
()
end
;
begin
match
ucst
with
|
(
Constant
k
)
::_
->
ub
.
(
cl
)
<-
max
ub
.
(
cl
)
k
|
_
->
(* TODO can it happen? *)
()
end
;
done
;
lb
,
ub
let
lubounds
ta
state
=
try
DSHashtbl
.
find
ta
.
lubounds_tbl
state
with
|
Not_found
->
let
res
=
_lubounds
ta
state
in
DSHashtbl
.
add
ta
.
lubounds_tbl
state
res
;
res
_lubounds
ta
state
(* tells whether a given clock is set by a given update *)
(* the difficult part is when the lhs of the update is an array cell *)
...
...
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