Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OUTDATED Verse-library
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
AutonomyCourse_ECEIllinois
OUTDATED Verse-library
Commits
67b2c83b
Commit
67b2c83b
authored
2 years ago
by
crides
Browse files
Options
Downloads
Patches
Plain Diff
sim bug port
parent
825696d0
No related branches found
No related tags found
1 merge request
!9
Tutorial
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
verse/scenario/scenario.py
+15
-11
15 additions, 11 deletions
verse/scenario/scenario.py
with
15 additions
and
11 deletions
verse/scenario/scenario.py
+
15
−
11
View file @
67b2c83b
...
...
@@ -497,23 +497,25 @@ class Scenario:
# For each agent
agent_guard_dict
=
defaultdict
(
list
)
cached_guards
=
defaultdict
(
list
)
min_trans_ind
=
None
cached_trans
=
defaultdict
(
list
)
if
not
cache
:
paths
=
[(
agent
,
p
)
for
agent
in
node
.
agent
.
values
()
for
p
in
agent
.
controller
.
paths
]
else
:
# _transitions = [trans.transition for seg in cache.values() for trans in seg.transitions]
_transitions
=
[
trans
.
transition
for
seg
in
cache
.
values
()
for
trans
in
seg
.
transitions
if
reach_trans_suit
(
trans
.
inits
,
node
.
init
)
or
pp
((
"
not suit
"
,
trans
.
inits
,
node
.
init
))]
pp
((
"
cached trans
"
,
len
(
_transitions
)))
if
len
(
_transitions
)
==
0
:
return
None
,
[]
min_trans_ind
=
min
(
_transitions
)
cached_trans
=
[(
agent_id
,
tran
)
for
agent_id
,
seg
in
cache
.
items
()
for
tran
in
seg
.
transitions
if
tran
.
transition
==
min_trans_ind
]
# TODO: check for asserts
cached_trans
=
[(
aid
,
tran
.
mode
,
tran
.
dest
,
tran
.
reset
,
tran
.
reset_idx
,
tran
.
paths
)
for
aid
,
tran
in
dedup
(
cached_trans
,
lambda
p
:
(
p
[
0
],
p
[
1
].
mode
,
p
[
1
].
dest
))]
if
len
(
paths
)
==
0
:
# print(red("full cache"))
# _transitions = [trans.transition for seg in cache.values() for trans in seg.transitions]
_transitions
=
[
trans
.
transition
for
seg
in
cache
.
values
()
for
trans
in
seg
.
transitions
if
reach_trans_suit
(
trans
.
inits
,
node
.
init
)]
# or pp(("not suit", trans.inits, node.init))]
# pp(("cached trans", len(_transitions)))
if
len
(
_transitions
)
==
0
:
return
None
,
[]
transition
=
min
(
_transitions
)
transitions
=
[(
agent_id
,
tran
)
for
agent_id
,
seg
in
cache
.
items
()
for
tran
in
seg
.
transitions
if
tran
.
transition
==
transition
]
# TODO: check for asserts
transitions
=
[(
aid
,
tran
.
mode
,
tran
.
dest
,
tran
.
reset
,
tran
.
reset_idx
,
tran
.
paths
)
for
aid
,
tran
in
dedup
(
transitions
,
lambda
p
:
(
p
[
0
],
p
[
1
].
mode
,
p
[
1
].
dest
))]
return
None
,
transitions
return
None
,
cached_trans
path_transitions
=
defaultdict
(
int
)
for
seg
in
cache
.
values
():
...
...
@@ -573,6 +575,8 @@ class Scenario:
guard_hits
=
[]
guard_hit
=
False
for
idx
in
range
(
trace_length
):
if
min_trans_ind
!=
None
and
idx
>=
min_trans_ind
:
return
None
,
cached_trans
any_contained
=
False
hits
=
[]
state_dict
=
{
aid
:
(
node
.
trace
[
aid
][
idx
*
2
:
idx
*
2
+
2
],
node
.
mode
[
aid
],
node
.
static
[
aid
])
for
aid
in
node
.
agent
}
...
...
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