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
e2cf5bf3
Commit
e2cf5bf3
authored
Jun 17, 2019
by
serfrape
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change to English the control example.
parent
94bf57a4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
control.py
examples/control.py
+7
-7
master.asl
examples/master.asl
+11
-11
slave.asl
examples/slave.asl
+11
-11
No files found.
examples/control.py
View file @
e2cf5bf3
...
@@ -21,18 +21,18 @@ class MasterAgent(BDIAgent):
...
@@ -21,18 +21,18 @@ class MasterAgent(BDIAgent):
async
def
run
(
self
):
async
def
run
(
self
):
if
self
.
agent
.
bdi_enabled
:
if
self
.
agent
.
bdi_enabled
:
try
:
try
:
tipo
=
self
.
agent
.
bdi
.
get_belief_value
(
"tipo
"
)[
0
]
count_type
=
self
.
agent
.
bdi
.
get_belief_value
(
"type
"
)[
0
]
if
tipo
==
'inc'
:
if
count_type
==
'inc'
:
self
.
agent
.
bdi
.
set_belief
(
't
ipo
'
,
'dec'
)
self
.
agent
.
bdi
.
set_belief
(
't
ype
'
,
'dec'
)
else
:
else
:
self
.
agent
.
bdi
.
set_belief
(
't
ipo
'
,
'inc'
)
self
.
agent
.
bdi
.
set_belief
(
't
ype
'
,
'inc'
)
except
Exception
as
e
:
except
Exception
as
e
:
self
.
kill
()
self
.
kill
()
class
Behav4
(
TimeoutBehaviour
):
class
Behav4
(
TimeoutBehaviour
):
async
def
run
(
self
):
async
def
run
(
self
):
self
.
agent
.
bdi
.
remove_belief
(
't
ipo
'
,
'inc'
)
self
.
agent
.
bdi
.
remove_belief
(
't
ype
'
,
'inc'
)
self
.
agent
.
bdi
.
remove_belief
(
't
ipo
'
,
'dec'
)
self
.
agent
.
bdi
.
remove_belief
(
't
ype
'
,
'dec'
)
def
main
(
server
,
password
):
def
main
(
server
,
password
):
...
@@ -49,7 +49,7 @@ def main(server, password):
...
@@ -49,7 +49,7 @@ def main(server, password):
a
=
MasterAgent
(
"master@{}"
.
format
(
server
),
password
,
"master.asl"
)
a
=
MasterAgent
(
"master@{}"
.
format
(
server
),
password
,
"master.asl"
)
a
.
bdi
.
set_belief
(
"slave1"
,
"slave_1@{}"
.
format
(
server
))
a
.
bdi
.
set_belief
(
"slave1"
,
"slave_1@{}"
.
format
(
server
))
a
.
bdi
.
set_belief
(
"slave2"
,
"slave_2@{}"
.
format
(
server
))
a
.
bdi
.
set_belief
(
"slave2"
,
"slave_2@{}"
.
format
(
server
))
a
.
bdi
.
set_belief
(
't
ipo
'
,
'dec'
)
a
.
bdi
.
set_belief
(
't
ype
'
,
'dec'
)
future
=
a
.
start
()
future
=
a
.
start
()
future
.
result
()
future
.
result
()
...
...
examples/master.asl
View file @
e2cf5bf3
...
@@ -5,30 +5,30 @@
...
@@ -5,30 +5,30 @@
-start;
-start;
!obj2.
!obj2.
+!obj2: t
ipo
(inc)
+!obj2: t
ype
(inc)
<-
<-
?slave1(X);
?slave1(X);
?slave2(Y);
?slave2(Y);
.send(X, tell, incre
mentar
(2));
.send(X, tell, incre
ase
(2));
.send(Y, tell, incre
mentar
(5));
.send(Y, tell, incre
ase
(5));
.wait(2000);
.wait(2000);
!obj2.
!obj2.
+!obj2: t
ipo
(dec)
+!obj2: t
ype
(dec)
<-
<-
?slave1(X);
?slave1(X);
?slave2(Y);
?slave2(Y);
.send(X, tell, decre
mentar
(2));
.send(X, tell, decre
ase
(2));
.send(Y, tell, decre
mentar
(5));
.send(Y, tell, decre
ase
(5));
.wait(2000);
.wait(2000);
!obj2.
!obj2.
+!obj2: not t
ipo
(_)
+!obj2: not t
ype
(_)
<-
<-
?slave1(X);
?slave1(X);
?slave2(Y);
?slave2(Y);
.print("Finishing");
.print("Finishing");
.send(X, untell, incre
mentar
(2));
.send(X, untell, incre
ase
(2));
.send(Y, untell, incre
mentar
(5));
.send(Y, untell, incre
ase
(5));
.send(X, untell, decre
mentar
(2));
.send(X, untell, decre
ase
(2));
.send(Y, untell, decre
mentar
(5)).
.send(Y, untell, decre
ase
(5)).
examples/slave.asl
View file @
e2cf5bf3
co
ntado
r(0).
co
unte
r(0).
+incre
mentar
(Inc)[source(S)]: master(M) & .substring(M,S,R)
+incre
ase
(Inc)[source(S)]: master(M) & .substring(M,S,R)
<-
<-
.print("increasing");
.print("increasing");
?co
ntado
r(X);
?co
unte
r(X);
.print(X);
.print(X);
-+co
ntado
r(X+Inc).
-+co
unte
r(X+Inc).
+decre
mentar
(Dec)[source(S)]: master(M) & .substring(M,S,R)
+decre
ase
(Dec)[source(S)]: master(M) & .substring(M,S,R)
<-
<-
.print("decreasing");
.print("decreasing");
?co
ntado
r(X);
?co
unte
r(X);
.print(X);
.print(X);
-+co
ntado
r(X-Dec).
-+co
unte
r(X-Dec).
-incre
mentar
(Inc)[source(S)]: master(M) & .substring(M,S,R)
-incre
ase
(Inc)[source(S)]: master(M) & .substring(M,S,R)
<-
<-
.print("DELETING incre
mentar
BELIEF from an untell message").
.print("DELETING incre
ase
BELIEF from an untell message").
-decre
mentar
(Dec)[source(S)]: master(M) & .substring(M,S,R)
-decre
ase
(Dec)[source(S)]: master(M) & .substring(M,S,R)
<-
<-
.print("DELETING decre
mentar
BELIEF from an untell message").
.print("DELETING decre
ase
BELIEF from an untell message").
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