Skip to content

Commit eb30e1d

Browse files
authored
Merge pull request #19 from AAAI-DISIM-UnivAQ/dev
tested
2 parents a899c82 + 62353d0 commit eb30e1d

14 files changed

Lines changed: 156 additions & 74 deletions

File tree

Examples/Double_Events.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
Double Events Example
3+
=============
4+
5+
6+
The example shows that it is possible to have conjunctions of external events
7+
in the antecedents of the DALI reactive rule.
8+
If you want to enter more than one external event, you must enter the Simultaneity
9+
Interval before the reactive rule is defined.
10+
The result of the reactive rule will only be executed if all external events
11+
arrive in the simultaneity interval.
12+
13+
In the advanced example, the files contained in the mas/types folder have been modified:
14+
=============
15+
16+
agentType1.txt
17+
18+
alarm1E:>write('Activate fire suppression and Send security guard '),nl.
19+
20+
=============
21+
22+
agentType2.txt
23+
24+
alarmE:>write('Call fire department'),nl.
25+
26+
=============
27+
28+
agentType3.txt
29+
30+
:-dynamic notified/1.
31+
notified(false).
32+
t60.
33+
heat_sensedE(X,T),smoke_detectedE(X,T):>fire_responceA(X,T).
34+
check_fire(X,T):-fire_responceP(X,T).
35+
check_fireI(X,T):>choose_fire(X,T).
36+
choose_fire(X,T):-notified(false),T<11,activate_fire_suppressionA,send_security_guardA,retract(notified(false)).
37+
choose_fire(X,T):-notified(false),T>10,call_fire_departmentA,retract(notified(false)).
38+
alarm1(X,T):-activate_fire_suppressionP,send_security_guardP.
39+
alarm1I(X,T):>messageA(agent1,send_message(alarm1,agent3),agent3),nl.
40+
alarm2(X,T):-call_fire_departmentP.
41+
alarm2I(X,T):>messageA(agent2,send_message(alarm,agent3),agent3),nl.
42+
send_security_guard(X,T):< security_guard_available(X,T).

Examples/advanced/build/null

Lines changed: 0 additions & 1 deletion
This file was deleted.

Examples/advanced/conf/mas/null

Lines changed: 0 additions & 1 deletion
This file was deleted.

Examples/advanced/mas/types/agentType1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
eventE:> write('which event?').
44

5-
goE:> write('received.'), messageA(agent2,send_message(go,agent1)).
5+
goE:> write('received.'), messageA(agent2,send_message(go, Me)).

Examples/advanced/server.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
'mbp-g.local':3010.
1+
'asus-gdg':3010.

Examples/advanced/startmas.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,49 @@
22
#exec 1>/dev/null # @echo off
33
clear # cls
44
#title "MAS"
5-
sicstus_home=/usr/local/sicstus4.3.5
6-
#sicstus_home=/usr/local/sicstus4.2.3
7-
main_home=../..
8-
dali_home=../../src
9-
conf_dir=conf
10-
prolog="$sicstus_home/bin/sicstus"
5+
SICSTUS_HOME=/usr/local/sicstus4.4.1
6+
MAIN_HOME=../..
7+
DALI_HOME=../../src
8+
CONF_DIR=conf
9+
PROLOG="$SICSTUS_HOME/bin/sicstus"
1110
WAIT="ping -c 4 127.0.0.1"
12-
instances_home=mas/instances
13-
types_home=mas/types
14-
build_home=build
11+
INSTANCES_HOME=mas/instances
12+
TYPES_HOME=mas/types
13+
BUILD_HOME=build
14+
XTERM=xterm
1515

1616
rm -rf tmp/*
1717
rm -rf build/*
1818
rm -f work/* # remove everything if you want to clear agent history
1919
rm -rf conf/mas/*
2020

2121
# Build agents by creating a file with the instance name containing the type content for each instance.
22-
for instance_filename in $instances_home/*.txt
22+
for instance_filename in $INSTANCES_HOME/*.txt
2323
do
2424
type=$(<$instance_filename) # agent type name is the content of the instance file
25-
type_filename="$types_home/$type.txt"
25+
type_filename="$TYPES_HOME/$type.txt"
2626
instance_base="${instance_filename##*/}" # e.g. 'mas/instances/agent1.txt' -> 'agent1.txt'
2727
echo $type_filename
28-
cat $type_filename >> "$build_home/$instance_base"
28+
cat $type_filename >> "$BUILD_HOME/$instance_base"
2929
done
3030

31-
cp $build_home/*.txt work
31+
cp $BUILD_HOME/*.txt work
3232

33-
xterm -hold -e "$prolog -l $dali_home/active_server_wi.pl --goal \"go(3010,'server.txt').\"" & #start /B "" "%prolog%" -l "%dali_home%/active_server_wi.pl" --goal go(3010,'%daliH%/server.txt').
33+
$XTERM -hold -e "$PROLOG -l $DALI_HOME/active_server_wi.pl --goal \"go(3010,'server.txt').\"" & #start /B "" "%PROLOG%" -l "%DALI_HOME%/active_server_wi.pl" --goal go(3010,'%daliH%/server.txt').
3434
echo Server ready. Starting the MAS....
3535
$WAIT > /dev/null # %WAIT% >nul
3636

37-
xterm -hold -e "$prolog -l $dali_home/active_user_wi.pl --goal utente." & # start /B "" "%prolog%" -l "%dali_home%/active_user_wi.pl" --goal utente.
37+
$XTERM -hold -e "$PROLOG -l $DALI_HOME/active_user_wi.pl --goal utente." & # start /B "" "%PROLOG%" -l "%DALI_HOME%/active_user_wi.pl" --goal utente.
3838
echo Launching agents instances...
3939
$WAIT > /dev/null # %WAIT% > nul
4040

4141
# Launch agents
42-
for agent_filename in $build_home/*
42+
for agent_filename in $BUILD_HOME/*
4343
do
4444
agent_base="${agent_filename##*/}"
4545
echo "Agente: $agent_base"
46-
xterm -e "./conf/makeconf.sh $agent_base $dali_home" &
47-
xterm -T "$agent_base" -hold -e "./conf/startagent.sh $agent_base $prolog $dali_home" &
46+
$XTERM -e "./conf/makeconf.sh $agent_base $DALI_HOME" &
47+
$XTERM -T "$agent_base" -hold -e "./conf/startagent.sh $agent_base $PROLOG $DALI_HOME" &
4848
sleep 2s
4949
$WAIT > /dev/null # %WAIT% >nul
5050
done

Examples/advanced/work/null

Lines changed: 0 additions & 1 deletion
This file was deleted.

Examples/basic/mas/agent1.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
:- write('Hello world!').
2-
3-
eventE:> write('which event?').
4-
5-
goE:> write('received.'), messageA(agent2,send_message(go,agent1)).
1+
:- write('Hello world!').
2+
3+
eventE:> write('which event?').
4+
5+
goE:> write('received.'), messageA(agent2,send_message(go,Me)).

Examples/more/DALI-Auction-example

Submodule DALI-Auction-example deleted from 40c2eed

Examples/more/Knapsack-example

Submodule Knapsack-example deleted from 24d449d

0 commit comments

Comments
 (0)