-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathilluminance_controller_agent.asl
50 lines (39 loc) · 2.33 KB
/
illuminance_controller_agent.asl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//illuminance controller agent
/*
* The URL of the W3C Web of Things Thing Description (WoT TD) of a lab environment
* Simulated lab WoT TD: "https://raw.githubusercontent.com/Interactions-HSG/example-tds/was/tds/interactions-lab.ttl"
* Real lab WoT TD: Get in touch with us by email to acquire access to it!
*/
/* Initial beliefs and rules */
// the agent has a belief about the location of the W3C Web of Thing (WoT) Thing Description (TD)
// that describes a lab environment to be learnt
learning_lab_environment("https://raw.githubusercontent.com/Interactions-HSG/example-tds/was/tds/interactions-lab.ttl").
// the agent believes that the task that takes place in the 1st workstation requires an indoor illuminance
// level of Rank 2, and the task that takes place in the 2nd workstation requires an indoor illumincance
// level of Rank 3. Modify the belief so that the agent can learn to handle different goals.
task_requirements([2,3]).
/* Initial goals */
!start. // the agent has the goal to start
/*
* Plan for reacting to the addition of the goal !start
* Triggering event: addition of goal !start
* Context: the agent believes that there is a WoT TD of a lab environment located at Url, and that
* the tasks taking place in the workstations require indoor illuminance levels of Rank Z1Level and Z2Level
* respectively
* Body: (currently) creates a QLearnerArtifact and a ThingArtifact for learning and acting on the lab environment.
*/
@start
+!start : learning_lab_environment(Url)
& task_requirements([Z1Level, Z2Level]) <-
.print("Hello world");
.print("I want to achieve Z1Level=", Z1Level, " and Z2Level=",Z2Level);
// creates a QLearner artifact for learning the lab Thing described by the W3C WoT TD located at URL
makeArtifact("qlearner", "tools.QLearner", [Url], QLArtId);
// creates a ThingArtifact artifact for reading and acting on the state of the lab Thing
makeArtifact("lab", "org.hyperagents.jacamo.artifacts.wot.ThingArtifact", [Url], LabArtId);
// example use of the getActionFromState operation of the QLearner artifact
// relevant for Task 2.3
getActionFromState([1,1], [0, 0, false, false, false, false, 3], ActionTag, PayloadTags, Payload);
// example use of the invokeAction operation of the ThingArtifact
//invokeAction(ActionTag, PayloadTags, Payload)
.