Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SPADE-BDI
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
serfrape
SPADE-BDI
Commits
51937a71
Commit
51937a71
authored
Jul 04, 2019
by
serfrape
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow .send to a list of receivers.
parent
49ce97cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
bdi.py
spade_bdi/bdi.py
+5
-2
No files found.
spade_bdi/bdi.py
View file @
51937a71
...
@@ -69,14 +69,17 @@ class BDIAgent(Agent):
...
@@ -69,14 +69,17 @@ class BDIAgent(Agent):
def
add_actions
(
self
):
def
add_actions
(
self
):
@self.agent.bdi_actions.add
(
".send"
,
3
)
@self.agent.bdi_actions.add
(
".send"
,
3
)
def
_send
(
agent
,
term
,
intention
):
def
_send
(
agent
,
term
,
intention
):
receiver
=
str
(
asp
.
grounded
(
term
.
args
[
0
],
intention
.
scope
))
receivers
=
asp
.
grounded
(
term
.
args
[
0
],
intention
.
scope
)
if
isinstance
(
receivers
,
str
):
receivers
=
(
receivers
,)
ilf
=
asp
.
grounded
(
term
.
args
[
1
],
intention
.
scope
)
ilf
=
asp
.
grounded
(
term
.
args
[
1
],
intention
.
scope
)
if
not
asp
.
is_atom
(
ilf
):
if
not
asp
.
is_atom
(
ilf
):
return
return
ilf_type
=
ilf
.
functor
ilf_type
=
ilf
.
functor
mdata
=
{
"performative"
:
"BDI"
,
"ilf_type"
:
ilf_type
,
}
mdata
=
{
"performative"
:
"BDI"
,
"ilf_type"
:
ilf_type
,
}
for
receiver
in
receivers
:
body
=
asp
.
asl_str
(
asp
.
freeze
(
term
.
args
[
2
],
intention
.
scope
,
{}))
body
=
asp
.
asl_str
(
asp
.
freeze
(
term
.
args
[
2
],
intention
.
scope
,
{}))
msg
=
Message
(
to
=
receiver
,
body
=
body
,
metadata
=
mdata
)
msg
=
Message
(
to
=
str
(
receiver
)
,
body
=
body
,
metadata
=
mdata
)
self
.
agent
.
submit
(
self
.
send
(
msg
))
self
.
agent
.
submit
(
self
.
send
(
msg
))
yield
yield
...
...
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