Skip to content

Commit 4ba69e3

Browse files
committed
Merge remote-tracking branch 'origin/dev'
2 parents abd5953 + 36da14b commit 4ba69e3

File tree

71 files changed

+10358
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+10358
-305
lines changed

.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<classpath>
33
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
44
<attributes>
5+
<attribute name="module" value="true"/>
56
<attribute name="maven.pomderived" value="true"/>
67
</attributes>
78
</classpathentry>
@@ -19,7 +20,6 @@
1920
</attributes>
2021
</classpathentry>
2122
<classpathentry kind="src" path="src/test/asl"/>
22-
<classpathentry combineaccessrules="false" kind="src" path="/jason"/>
2323
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
2424
<attributes>
2525
<attribute name="maven.pomderived" value="true"/>

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ bin
22
target
33
/launcher.mas2j
44
*.csv
5-
*.log
5+
*.log
6+
*.class

lib/choco-solver-4.10.6.jar

1.48 MB
Binary file not shown.

lib/freehep-graphicsbase-2.4.jar

66.7 KB
Binary file not shown.
Binary file not shown.

lib/jason-o3a-1.0.jar

879 Bytes
Binary file not shown.

lib/jfxrt.jar

17.4 MB
Binary file not shown.

little_red_hen.mas2j

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ MAS little_red_hen {
88
environment: little_red_hen.FarmEnvironment
99

1010
agents:
11+
sample_agent;
12+
liz;
1113
hen test_agent;
1214
// hen general_animal[beliefs="is_communal(self)", goals="make_great_again(farm)"];
1315
// dog general_animal[beliefs="is_lazy(self)", goals="cazzegiare"];

src/asl/agent-desire_wish_management.asl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
@reject_request_2[atomic, affect(and(mood(dominance,high), personality(agreeableness,negative)))]
2222
+!obligation(help_with(Helpee, Plan)) : wish(Y) & is_work(help_with(Plan)) <-
2323
!reject(Helpee, Plan).
24-
// if none of these is true, do help
24+
//To prevent conscientiousness agents (which should help) from jumping to plan @obligation1 due to lack of annotations, here
25+
@accept_request_1[affect(personality(conscientiousness,high))]
26+
+!obligation(help_with(Helpee, Plan)) <-
27+
!accept(Helpee, Plan);
28+
!obligation(help_with(Helpee, Plan)).
29+
//if none of these is true, do help
30+
@accept_request_2
2531
+!obligation(help_with(Helpee, Plan)) <-
2632
!accept(Helpee, Plan);
2733
!obligation(help_with(Helpee, Plan)).
@@ -55,9 +61,9 @@
5561
@wish_rem[atomic]
5662
-wish(Plan) <-
5763
.drop_desire(wish(Plan));
58-
// .succeed_goal(wish(Plan));
59-
.drop_desire(Plan).
60-
// .succeed_goal(Plan).
64+
.succeed_goal(wish(Plan));
65+
.drop_desire(Plan);
66+
.succeed_goal(Plan).
6167

6268
// if conscientious do not follow (non-coping) wishes when an obligation is desired --> coping wishes, like !punish, don't fall under this
6369
@wish1[affect(personality(conscientiousness,high))]

src/asl/agent_folktale_animal.asl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ wish(relax).
6161
-hungry;
6262
-has(Food).
6363

64+
//If we fail to relax once due to too high arousal, stop the wish
65+
+relax[success(false)] <-
66+
-wish(relax).
67+
6468
/***** request answer management **********************************************/
6569
/******************************************************************************/
6670

@@ -123,7 +127,7 @@ wish(relax).
123127

124128
// Ask for help if extraverted, unless one feels powerless
125129
@general_help_acquisition_plan[affect(and(personality(extraversion,positive),not(mood(dominance,low))))]
126-
+!X[_] : is_work(X) & not complex_plan(X) & not already_asked(X) <-
130+
+!X[_] : is_work(X) & not complex_plan(X) & not already_asked(X) & not X=help_with(_,_) <-
127131
.my_name(Me);
128132
?present(Agents);
129133
+already_asked(X);
@@ -142,11 +146,11 @@ wish(relax).
142146
-has(wheat[_]);
143147
!create(bread).
144148

145-
+!create(bread) : at(wheat[state(growing)], farm) <-
149+
+!create(bread) : .my_name(Me) & at(wheat[state(growing),owner(Me)], farm) <-
146150
!tend(wheat);
147151
!create(bread).
148152

149-
+!create(bread) : at(wheat[state(ripe)], farm) <-
153+
+!create(bread) : .my_name(Me) & at(wheat[state(ripe),owner(Me)], farm) <-
150154
!harvest(wheat);
151155
+has(wheat[state(harvested)]); // TODO: get env to give this information?
152156
!create(bread).

src/asl/islandAgent.asl

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
// Agent islandAgent in project inBloom
2+
3+
/******************************************************************************/
4+
/************ knowledge base *************************************************/
5+
/******************************************************************************/
6+
// Here I can store my knowledge base externally if I want to (or if I have a knowledge base at all)
7+
// This rn is the farming knowledge base that obviously isn't that important for our agent, but is here for example reasons
8+
9+
{include("agent-knowledge_base.asl")}
10+
11+
/********************************************/
12+
/***** wishes and obligations ***********/
13+
/********************************************/
14+
// This is some imported code that helps managing wishes and obligations in a new way
15+
// The code is project independent, so I also import and use it
16+
17+
{include("agent-desire_wish_management.asl")}
18+
19+
//wish(seeTheWorld).
20+
//+self(farm_animal) <- +obligation(farm_work).
21+
22+
/******************************************************************************/
23+
/********** perception management *********************************************/
24+
/******************************************************************************/
25+
26+
27+
28+
29+
30+
/* Initial beliefs and rules */
31+
32+
33+
/* Initial goals */
34+
35+
!start.
36+
37+
/* Plans */
38+
39+
@go_on_cruise[affect(personality(openness,high))]
40+
+!start <- goOnCruise.
41+
42+
@go_on_cruise_default
43+
+!start <- stayHome.
44+
45+
+!happyEnd <- happyEnd;
46+
-wish(happyEnd).
47+
48+
+!getRescued <- goOnShip;
49+
-wish(getRescued).
50+
51+
@rescueSelf0[priority(2)]
52+
+!rescueSelf <- swimToIsland;
53+
-wish(rescueSelf).
54+
55+
56+
//@heal0[priority(1)]
57+
//+!heal <- if(has(healingPlant)) {
58+
// useHealingPlants;
59+
// -wish(heal);
60+
// } else {
61+
// findHealingPlants;
62+
// }.
63+
64+
@heal0[priority(1)]
65+
+!heal : not(has(healingPlant)) <-
66+
findHealingPlants;
67+
useHealingPlants;
68+
-wish(heal).
69+
70+
@heal1[priority(1)]
71+
+!heal : has(healingPlant) <-
72+
useHealingPlants;
73+
-wish(heal).
74+
75+
//@food_plan
76+
//+!eat <- if(has(food)) {
77+
// eat;
78+
// -wish(eat);
79+
// } else {
80+
// getFood;
81+
// }.
82+
83+
@eat0[priority(1)]
84+
+!eat : not(has(food)) <-
85+
getFood;
86+
eat;
87+
-wish(eat).
88+
89+
@eat1[priority(1)]
90+
+!eat : has(food) <-
91+
eat;
92+
-wish(eat).
93+
94+
//@sleep0[priority(1)]
95+
//+!sleep <- if(exists(hut)) {
96+
// sleep;
97+
// -wish(sleep);
98+
// // TODO - only if they wish to heal?
99+
// // 1. is it necessary?
100+
// // 2. how do I do knowledge abfrage?
101+
// // find out object of belief: ?belief(X)
102+
// // find out existence of belief: if(belief)
103+
// //-wish(heal);
104+
// } else {
105+
// buildHut;
106+
// }.
107+
108+
@sleep0[priority(1)]
109+
+!sleep : not(exists(hut)) <-
110+
buildHut;
111+
sleep;
112+
-wish(sleep).
113+
114+
@sleep1[priority(1)]
115+
+!sleep : exists(hut) <-
116+
sleep;
117+
-wish(sleep).
118+
119+
120+
@extinguish_fire0[priority(2)]
121+
+!extinguish_fire <- extinguishFire;
122+
-wish(extinguish_fire).
123+
124+
//+!complain <- if(has(friend)) {
125+
// complain;
126+
// -wish(complain);
127+
// } else {
128+
// findFriend;
129+
// }.
130+
131+
+!complain : not(has(friend)) <-
132+
findFriend;
133+
complain;
134+
-wish(complain).
135+
136+
+!complain : has(friend) <-
137+
complain;
138+
-wish(complain).
139+
140+
141+
/* React to new Belifes / Percepts */
142+
// Name of source is f.e. "percept"
143+
144+
+shipWrecked[source(Name)] <- +wish(rescueSelf).
145+
146+
+endStory[source(Name)] <- +wish(happyEnd).
147+
148+
+rescueEnd[source(Name)] <- +wish(getRescued).
149+
150+
+sick[source(Name)] <- +wish(heal).
151+
152+
+hungry[source(Name)] <- +wish(eat).
153+
154+
+fatigue[source(Name)] <- +wish(sleep).
155+
156+
// not used so far
157+
+stolen(food)[source(Name)] <- +hate(monkey).
158+
159+
// if f.e. friend is eaten, then agent has no friend anymore :(
160+
+eaten(X)[source(Name)] <- -has(X).
161+
162+
+homesick[source(Name)] <- +wish(complain).
163+
164+
+fire[source(Name)] <- +wish(extinguish_fire).
165+
166+
// TODO why does this not print anything?
167+
+happening[source(Name)] <- .print("A HAPPENING HAPPENED.").
168+
169+
170+
// ASL Debug mode -> Run Configurations, duplicate Launcher, add -debug

src/java/inBloom/ERcycle/PlotCycle.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.awt.BorderLayout;
44
import java.awt.FlowLayout;
5+
import java.awt.Font;
56
import java.awt.event.ActionEvent;
67
import java.awt.event.ActionListener;
78
import java.util.Collection;
@@ -82,6 +83,8 @@ private void initGui() {
8283
this.cycleFrame = new JFrame("Plot Cycle");
8384
this.cycleFrame.setLayout(new BorderLayout());
8485

86+
this.logTextArea.setFont(new Font("Menlo", Font.PLAIN, 12));
87+
8588
// setup text field
8689
JScrollPane scroll = new JScrollPane(this.logTextArea);
8790
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
@@ -274,7 +277,7 @@ public void run() {
274277

275278
while(rr.shouldContinue) {
276279
++currentCycle;
277-
this.log("Running cycle: " + currentCycle);
280+
this.log("\nRunning cycle: " + currentCycle);
278281
er = this.engage(rr);
279282
this.stories.add(er.getPlotGraph());
280283
if (SHOW_FULL_GRAPH){
@@ -297,7 +300,7 @@ protected void finish(EngageResult er) {
297300
* '\n' is appended automatically.
298301
* @param string Message to log
299302
*/
300-
protected void log(String string) {
303+
public void log(String string) {
301304
if(this.logTextArea != null) {
302305
this.logTextArea.append(string + "\n");
303306
this.logTextArea.setCaretPosition(this.logTextArea.getText().length());

src/java/inBloom/ERcycle/ReflectResult.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ public class ReflectResult {
1616
* Instance of the PlotLauncher for
1717
* the story in question.
1818
*/
19-
private PlotLauncher<?, ?> runner;
19+
protected PlotLauncher<?, ?> runner;
2020
/**
2121
* Agents that will be used by the runner
2222
* to generate characters. Personalities
2323
* should be set appropriately already.
2424
*/
25-
private List<LauncherAgent> agents;
25+
protected List<LauncherAgent> agents;
2626
/**
2727
* Instance of PlotModel for the
2828
* next simulation. Will add
2929
* agents automatically.
3030
*/
31-
private PlotModel<?> model;
31+
protected PlotModel<?> model;
3232
/**
3333
* If this is false, the cycle will not execute another
3434
* simulation and call finish().

src/java/inBloom/PlotControlsLauncher.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public class PlotControlsLauncher extends RunCentralisedMAS implements AnalysisR
4949
public void setShowGui(boolean showGui) {
5050
this.showGui = showGui;
5151
}
52+
public boolean getShowGui() {
53+
return this.showGui;
54+
}
5255

5356
@Override
5457
public synchronized void setupLogger() {
@@ -104,9 +107,9 @@ public synchronized void setupConsoleLogger() {
104107
Logger.getLogger("").setLevel(LOG_LEVEL);
105108
}
106109

107-
protected void pauseExecution() {
110+
public void pauseExecution() {
108111
MASConsoleGUI.get().setPause(true);
109-
if(this.showGui) {
112+
if(this.pauseButton != null) {
110113
this.pauseButton.setText("Continue");
111114
}
112115

@@ -166,12 +169,6 @@ public void resetGraphView() {
166169
this.drawButton.setText("Show Graphs");
167170
}
168171

169-
@Override
170-
public void finish() {
171-
this.pauseExecution();
172-
super.finish();
173-
}
174-
175172
@Override
176173
protected void createButtons() {
177174
this.createPauseButton();

0 commit comments

Comments
 (0)