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
013d3b92
Commit
013d3b92
authored
Mar 28, 2019
by
serfrape
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow receival of predicates without args (values)
parent
00928232
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
bdi.py
spade_bdi/bdi.py
+11
-5
No files found.
spade_bdi/bdi.py
View file @
013d3b92
...
@@ -10,6 +10,7 @@ from spade.agent import Agent
...
@@ -10,6 +10,7 @@ from spade.agent import Agent
from
spade.template
import
Template
from
spade.template
import
Template
from
spade.message
import
Message
from
spade.message
import
Message
import
json
import
json
from
ast
import
literal_eval
PERCEPT_TAG
=
frozenset
(
PERCEPT_TAG
=
frozenset
(
[
pyson
.
Literal
(
"source"
,
(
pyson
.
Literal
(
"percept"
),
))])
[
pyson
.
Literal
(
"source"
,
(
pyson
.
Literal
(
"percept"
),
))])
...
@@ -98,7 +99,7 @@ class BDIAgent(Agent):
...
@@ -98,7 +99,7 @@ class BDIAgent(Agent):
def
get_belief
(
self
,
key
,
pyson_format
=
False
):
def
get_belief
(
self
,
key
,
pyson_format
=
False
):
"""Get an agent's existing belief. The first belief matching
"""Get an agent's existing belief. The first belief matching
<key> is returned. Keep <pyson_format> False to strip pyson
<key> is returned. Keep <pyson_format> False to strip pyson
formatting."""
formatting."""
key
=
str
(
key
)
key
=
str
(
key
)
for
beliefs
in
self
.
bdi_agent
.
beliefs
:
for
beliefs
in
self
.
bdi_agent
.
beliefs
:
...
@@ -122,7 +123,7 @@ class BDIAgent(Agent):
...
@@ -122,7 +123,7 @@ class BDIAgent(Agent):
return
None
return
None
def
get_beliefs
(
self
,
pyson_format
=
False
):
def
get_beliefs
(
self
,
pyson_format
=
False
):
"""Get agent's beliefs.Keep <pyson_format> False to strip pyson
"""Get agent's beliefs.Keep <pyson_format> False to strip pyson
formatting."""
formatting."""
belief_list
=
[]
belief_list
=
[]
for
beliefs
in
self
.
bdi_agent
.
beliefs
:
for
beliefs
in
self
.
bdi_agent
.
beliefs
:
...
@@ -137,7 +138,7 @@ class BDIAgent(Agent):
...
@@ -137,7 +138,7 @@ class BDIAgent(Agent):
return
belief_list
return
belief_list
def
print_beliefs
(
self
,
pyson_format
=
False
):
def
print_beliefs
(
self
,
pyson_format
=
False
):
"""Print agent's beliefs.Keep <pyson_format> False to strip pyson
"""Print agent's beliefs.Keep <pyson_format> False to strip pyson
formatting."""
formatting."""
print
(
"PRINTING BELIEFS"
)
print
(
"PRINTING BELIEFS"
)
for
beliefs
in
self
.
bdi_agent
.
beliefs
.
values
():
for
beliefs
in
self
.
bdi_agent
.
beliefs
.
values
():
...
@@ -180,8 +181,13 @@ class BDIAgent(Agent):
...
@@ -180,8 +181,13 @@ class BDIAgent(Agent):
raise
pyson
.
PysonError
(
raise
pyson
.
PysonError
(
"unknown illocutionary force:
%
s"
%
ilf_type
)
"unknown illocutionary force:
%
s"
%
ilf_type
)
intention
=
pyson
.
runtime
.
Intention
()
intention
=
pyson
.
runtime
.
Intention
()
message
=
pyson
.
Literal
(
args
=
literal_eval
(
received
[
"args"
])
received
[
"functor"
],
tuple
([
received
[
"args"
]]))
if
args
!=
tuple
():
message
=
pyson
.
Literal
(
received
[
"functor"
],
args
)
else
:
message
=
pyson
.
Literal
(
received
[
"functor"
])
message
=
pyson
.
freeze
(
message
,
intention
.
scope
,
{})
message
=
pyson
.
freeze
(
message
,
intention
.
scope
,
{})
tagged_message
=
message
.
with_annotation
(
tagged_message
=
message
.
with_annotation
(
pyson
.
Literal
(
"source"
,
(
pyson
.
Literal
(
str
(
msg
.
sender
)),
)))
pyson
.
Literal
(
"source"
,
(
pyson
.
Literal
(
str
(
msg
.
sender
)),
)))
...
...
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