Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
mbe-tools
TTool
Commits
c8134e3a
Commit
c8134e3a
authored
4 years ago
by
tempiaa
Browse files
Options
Downloads
Patches
Plain Diff
Optimized synchronization of signals for better performance
parent
8a2db960
No related branches found
No related tags found
1 merge request
!325
Avatar model-checker improvements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/avatartranslator/modelchecker/AvatarModelChecker.java
+48
-15
48 additions, 15 deletions
...ava/avatartranslator/modelchecker/AvatarModelChecker.java
with
48 additions
and
15 deletions
src/main/java/avatartranslator/modelchecker/AvatarModelChecker.java
+
48
−
15
View file @
c8134e3a
...
@@ -72,6 +72,7 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
...
@@ -72,6 +72,7 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
private
Map
<
Long
,
SpecificationState
>
statesByID
;
private
Map
<
Long
,
SpecificationState
>
statesByID
;
private
List
<
SpecificationState
>
pendingStates
;
private
List
<
SpecificationState
>
pendingStates
;
private
List
<
SpecificationState
>
safetyLeadStates
;
private
List
<
SpecificationState
>
safetyLeadStates
;
private
Map
<
AvatarTransition
,
Set
<
AvatarTransition
>>
signalRelation
;
//private List<SpecificationLink> links;
//private List<SpecificationLink> links;
private
int
nbOfLinks
;
private
int
nbOfLinks
;
private
long
stateID
=
0
;
private
long
stateID
=
0
;
...
@@ -1244,7 +1245,7 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
...
@@ -1244,7 +1245,7 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
// Compute the id of each transition
// Compute the id of each transition
// Assumes the allStates list has been computed in AvatarStateMachine
// Assumes the allStates list has been computed in AvatarStateMachine
// Assumes that it is only after states that transitions have non empty
// Assumes that it is only after states that transitions have non empty
signalRelation
=
new
HashMap
<
AvatarTransition
,
Set
<
AvatarTransition
>>();
for
(
AvatarBlock
block
:
spec
.
getListOfBlocks
())
{
for
(
AvatarBlock
block
:
spec
.
getListOfBlocks
())
{
AvatarStateMachine
asm
=
block
.
getStateMachine
();
AvatarStateMachine
asm
=
block
.
getStateMachine
();
...
@@ -1263,6 +1264,7 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
...
@@ -1263,6 +1264,7 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
at
.
type
=
AvatarTransition
.
TYPE_RECV_SYNC
;
at
.
type
=
AvatarTransition
.
TYPE_RECV_SYNC
;
}
else
{
}
else
{
at
.
type
=
AvatarTransition
.
TYPE_SEND_SYNC
;
at
.
type
=
AvatarTransition
.
TYPE_SEND_SYNC
;
synchronizeSignalRelation
(
at
,
sig
);
}
}
}
}
}
else
{
}
else
{
...
@@ -1294,6 +1296,31 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
...
@@ -1294,6 +1296,31 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
ab
.
setBlockIndex
(
i
++);
ab
.
setBlockIndex
(
i
++);
}
}
}
}
private
void
synchronizeSignalRelation
(
AvatarTransition
sender
,
AvatarSignal
sig
)
{
HashSet
<
AvatarTransition
>
set
=
new
HashSet
<>();
for
(
AvatarBlock
block
:
spec
.
getListOfBlocks
())
{
AvatarStateMachine
asm
=
block
.
getStateMachine
();
if
(
asm
!=
null
)
{
for
(
int
i
=
0
;
i
<
asm
.
allStates
.
length
;
i
++)
{
for
(
int
j
=
0
;
j
<
asm
.
allStates
[
i
].
nbOfNexts
();
j
++)
{
AvatarStateMachineElement
e
=
asm
.
allStates
[
i
].
getNext
(
j
);
if
(
e
instanceof
AvatarTransition
)
{
AvatarStateMachineElement
n
=
e
.
getNext
(
0
);
if
(
n
!=
null
&&
n
instanceof
AvatarActionOnSignal
)
{
AvatarSignal
asr
=
((
AvatarActionOnSignal
)
n
).
getSignal
();
if
(
asr
.
isIn
()
&&
spec
.
areSynchronized
(
sig
,
asr
))
{
set
.
add
((
AvatarTransition
)
e
);
}
}
}
}
}
}
}
signalRelation
.
put
(
sender
,
set
);
}
public
boolean
oldEvaluateBoolExpression
(
String
_expr
,
AvatarBlock
_block
,
SpecificationBlock
_sb
)
{
public
boolean
oldEvaluateBoolExpression
(
String
_expr
,
AvatarBlock
_block
,
SpecificationBlock
_sb
)
{
String
act
=
_expr
;
String
act
=
_expr
;
...
@@ -1395,20 +1422,26 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
...
@@ -1395,20 +1422,26 @@ public class AvatarModelChecker implements Runnable, myutil.Graph {
}
}
private
SpecificationTransition
computeSynchronousTransition
(
SpecificationTransition
sender
,
SpecificationTransition
receiver
)
{
private
SpecificationTransition
computeSynchronousTransition
(
SpecificationTransition
sender
,
SpecificationTransition
receiver
)
{
AvatarTransition
trs
=
sender
.
transitions
[
0
];
// AvatarTransition trs = sender.transitions[0];
AvatarTransition
trr
=
receiver
.
transitions
[
0
];
// AvatarTransition trr = receiver.transitions[0];
//
AvatarStateMachineElement
asmes
,
asmer
;
// AvatarStateMachineElement asmes, asmer;
asmes
=
trs
.
getNext
(
0
);
// asmes = trs.getNext(0);
asmer
=
trr
.
getNext
(
0
);
// asmer = trr.getNext(0);
if
((
asmes
==
null
)
||
(
asmer
==
null
))
return
null
;
// if ((asmes == null) || (asmer == null)) return null;
if
(!(
asmes
instanceof
AvatarActionOnSignal
))
return
null
;
// if (!(asmes instanceof AvatarActionOnSignal)) return null;
if
(!(
asmer
instanceof
AvatarActionOnSignal
))
return
null
;
// if (!(asmer instanceof AvatarActionOnSignal)) return null;
//
AvatarSignal
ass
=
((
AvatarActionOnSignal
)
asmes
).
getSignal
();
// AvatarSignal ass = ((AvatarActionOnSignal) asmes).getSignal();
AvatarSignal
asr
=
((
AvatarActionOnSignal
)
asmer
).
getSignal
();
// AvatarSignal asr = ((AvatarActionOnSignal) asmer).getSignal();
//
if
(
spec
.
areSynchronized
(
ass
,
asr
))
{
// if (spec.areSynchronized(ass, asr)) {
// SpecificationTransition st = new SpecificationTransition();
// st.makeFromTwoSynchronous(sender, receiver);
// return st;
// }
if
(
signalRelation
.
get
(
sender
.
transitions
[
0
]).
contains
(
receiver
.
transitions
[
0
]))
{
SpecificationTransition
st
=
new
SpecificationTransition
();
SpecificationTransition
st
=
new
SpecificationTransition
();
st
.
makeFromTwoSynchronous
(
sender
,
receiver
);
st
.
makeFromTwoSynchronous
(
sender
,
receiver
);
return
st
;
return
st
;
...
...
This diff is collapsed.
Click to expand it.
Ludovic Apvrille
@ludovic.apvrille
mentioned in commit
05297783
·
4 years ago
mentioned in commit
05297783
mentioned in commit 05297783d09ce0fbdf26b9bd0fdd66c643f5e7c6
Toggle commit list
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