From f3640f3cf4ef63df67ec830a1f4dbabb5ad6fc15 Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Thu, 3 Sep 2020 11:49:28 -0300 Subject: [PATCH 01/11] First version of planning codelet. --- .../unicamp/cst/planning/PlanningCodelet.java | 43 +++++++++++++++++++ .../cst/planning/PlanningMemoryNames.java | 8 ++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/java/br/unicamp/cst/planning/PlanningCodelet.java create mode 100644 src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java new file mode 100644 index 00000000..b1ed2d3f --- /dev/null +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -0,0 +1,43 @@ +package br.unicamp.cst.planning; + +import br.unicamp.cst.core.entities.Codelet; +import br.unicamp.cst.core.entities.Memory; +import br.unicamp.cst.core.exceptions.CodeletActivationBoundsException; + +public abstract class PlanningCodelet extends Codelet { + + private Memory inputCurrentState; + private Memory inputGoal; + private Memory inputActions; + private Memory outputPlan; + + @Override + public void accessMemoryObjects() { + if(inputCurrentState == null + && inputGoal == null + && inputActions == null + && outputPlan == null + ){ + inputCurrentState = getInput(PlanningMemoryNames.INPUT_CURRENT_STATE_MEMORY.toString()); + inputGoal = getInput(PlanningMemoryNames.INPUT_GOAL_MEMORY.toString()); + inputActions = getInput(PlanningMemoryNames.INPUT_ACTIONS_MEMORY.toString()); + outputPlan = getOutput(PlanningMemoryNames.OUTPUT_PLAN_MEMORY.toString()); + } + } + + @Override + public void calculateActivation() { + try { + setActivation(0d); + } catch (CodeletActivationBoundsException e) { + e.printStackTrace(); + } + } + + @Override + public void proc() { + outputPlan.setI(planning(inputCurrentState, inputGoal, inputActions).getI()); + } + + public abstract Memory planning(Memory currentState, Memory goal, Memory actions); +} diff --git a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java new file mode 100644 index 00000000..12beeee9 --- /dev/null +++ b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java @@ -0,0 +1,8 @@ +package br.unicamp.cst.planning; + +public enum PlanningMemoryNames { + INPUT_CURRENT_STATE_MEMORY, + INPUT_GOAL_MEMORY, + INPUT_ACTIONS_MEMORY, + OUTPUT_PLAN_MEMORY +} From 21b0ff0eb1aff94ffcbf42bab153189d7f527eea Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Thu, 10 Sep 2020 00:24:22 -0300 Subject: [PATCH 02/11] First version of Planning Codelet. --- build.gradle | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 5 +++-- .../unicamp/cst/planning/PlanningCodelet.java | 19 ++++++++++++------- .../cst/planning/PlanningMemoryNames.java | 5 +++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 9ba3dae0..359a4bce 100644 --- a/build.gradle +++ b/build.gradle @@ -8,9 +8,9 @@ group = 'com.github.CST-Group' description = "CST is the Cognitive Systems Toolkit, a toolkit for the construction of Cognitive Systems and Cognitive Architectures" -sourceCompatibility = 1.8 -targetCompatibility = 1.8 -version = '0.5.1' +sourceCompatibility = 1.11 +targetCompatibility = 1.11 +version = '0.5.2-beta' repositories { flatDir { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 622ab64a..b9fe08c3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Wed Sep 09 22:32:12 BRT 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index b1ed2d3f..9f80bc37 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -6,21 +6,26 @@ public abstract class PlanningCodelet extends Codelet { - private Memory inputCurrentState; - private Memory inputGoal; + private Memory inputInitialState; + + private Memory inputGoals; private Memory inputActions; + private Memory inputTransitionFunctions; + private Memory outputPlan; @Override public void accessMemoryObjects() { - if(inputCurrentState == null - && inputGoal == null + if(inputInitialState == null + && inputGoals == null && inputActions == null + && inputTransitionFunctions == null && outputPlan == null ){ - inputCurrentState = getInput(PlanningMemoryNames.INPUT_CURRENT_STATE_MEMORY.toString()); - inputGoal = getInput(PlanningMemoryNames.INPUT_GOAL_MEMORY.toString()); + inputInitialState = getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MAMORY.toString()); + inputGoals = getInput(PlanningMemoryNames.INPUT_GOALS_MEMORY.toString()); inputActions = getInput(PlanningMemoryNames.INPUT_ACTIONS_MEMORY.toString()); + inputTransitionFunctions = getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS_MEMORY.toString()); outputPlan = getOutput(PlanningMemoryNames.OUTPUT_PLAN_MEMORY.toString()); } } @@ -36,7 +41,7 @@ public void calculateActivation() { @Override public void proc() { - outputPlan.setI(planning(inputCurrentState, inputGoal, inputActions).getI()); + outputPlan.setI(planning(inputInitialState, inputGoals, inputActions).getI()); } public abstract Memory planning(Memory currentState, Memory goal, Memory actions); diff --git a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java index 12beeee9..d8956cf0 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java @@ -1,8 +1,9 @@ package br.unicamp.cst.planning; public enum PlanningMemoryNames { - INPUT_CURRENT_STATE_MEMORY, - INPUT_GOAL_MEMORY, + INPUT_INITIAL_STATE_MAMORY, + INPUT_GOALS_MEMORY, INPUT_ACTIONS_MEMORY, + INPUT_TRANSITION_FUNCTIONS_MEMORY, OUTPUT_PLAN_MEMORY } From 877394eef1488e1a560b5f838378a4a3cdcd90dc Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Mon, 14 Sep 2020 21:51:16 -0300 Subject: [PATCH 03/11] Revert java version to jdk 8 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 359a4bce..9f56d71a 100644 --- a/build.gradle +++ b/build.gradle @@ -8,8 +8,8 @@ group = 'com.github.CST-Group' description = "CST is the Cognitive Systems Toolkit, a toolkit for the construction of Cognitive Systems and Cognitive Architectures" -sourceCompatibility = 1.11 -targetCompatibility = 1.11 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 version = '0.5.2-beta' repositories { From 716235aa14515dbfd06532c9a32d9d6ef7f2c6d4 Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Mon, 14 Sep 2020 22:01:41 -0300 Subject: [PATCH 04/11] Added id attribute in planning codelet. --- .../br/unicamp/cst/planning/PlanningCodelet.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index 9f80bc37..b40454db 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -6,6 +6,8 @@ public abstract class PlanningCodelet extends Codelet { + private String id; + private Memory inputInitialState; private Memory inputGoals; @@ -14,6 +16,10 @@ public abstract class PlanningCodelet extends Codelet { private Memory outputPlan; + public PlanningCodelet(String id) { + setId(id); + } + @Override public void accessMemoryObjects() { if(inputInitialState == null @@ -45,4 +51,12 @@ public void proc() { } public abstract Memory planning(Memory currentState, Memory goal, Memory actions); + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } } From fc63c9265c5a420d2cea53f8f89274421f3284ad Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Mon, 14 Sep 2020 23:58:10 -0300 Subject: [PATCH 05/11] Renamed the memory objects attributes. --- .../unicamp/cst/planning/PlanningCodelet.java | 32 +++++++++---------- .../cst/planning/PlanningMemoryNames.java | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index b40454db..69572d1c 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -8,13 +8,13 @@ public abstract class PlanningCodelet extends Codelet { private String id; - private Memory inputInitialState; + private Memory inputInitialStateMO; - private Memory inputGoals; - private Memory inputActions; - private Memory inputTransitionFunctions; + private Memory inputGoalsMO; + private Memory inputActionsMO; + private Memory inputTransitionFunctionsMO; - private Memory outputPlan; + private Memory outputPlanMO; public PlanningCodelet(String id) { setId(id); @@ -22,17 +22,17 @@ public PlanningCodelet(String id) { @Override public void accessMemoryObjects() { - if(inputInitialState == null - && inputGoals == null - && inputActions == null - && inputTransitionFunctions == null - && outputPlan == null + if(inputInitialStateMO == null + && inputGoalsMO == null + && inputActionsMO == null + && inputTransitionFunctionsMO == null + && outputPlanMO == null ){ - inputInitialState = getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MAMORY.toString()); - inputGoals = getInput(PlanningMemoryNames.INPUT_GOALS_MEMORY.toString()); - inputActions = getInput(PlanningMemoryNames.INPUT_ACTIONS_MEMORY.toString()); - inputTransitionFunctions = getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS_MEMORY.toString()); - outputPlan = getOutput(PlanningMemoryNames.OUTPUT_PLAN_MEMORY.toString()); + inputInitialStateMO = getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MEMORY.toString()); + inputGoalsMO = getInput(PlanningMemoryNames.INPUT_GOALS_MEMORY.toString()); + inputActionsMO = getInput(PlanningMemoryNames.INPUT_ACTIONS_MEMORY.toString()); + inputTransitionFunctionsMO = getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS_MEMORY.toString()); + outputPlanMO = getOutput(PlanningMemoryNames.OUTPUT_PLAN_MEMORY.toString()); } } @@ -47,7 +47,7 @@ public void calculateActivation() { @Override public void proc() { - outputPlan.setI(planning(inputInitialState, inputGoals, inputActions).getI()); + outputPlanMO.setI(planning(inputInitialStateMO, inputGoalsMO, inputActionsMO).getI()); } public abstract Memory planning(Memory currentState, Memory goal, Memory actions); diff --git a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java index d8956cf0..97f5c0bd 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java @@ -1,7 +1,7 @@ package br.unicamp.cst.planning; public enum PlanningMemoryNames { - INPUT_INITIAL_STATE_MAMORY, + INPUT_INITIAL_STATE_MEMORY, INPUT_GOALS_MEMORY, INPUT_ACTIONS_MEMORY, INPUT_TRANSITION_FUNCTIONS_MEMORY, From d98dc1ee852bf92b86eb28237bd35a35bb8f436d Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Tue, 15 Sep 2020 10:14:11 -0300 Subject: [PATCH 06/11] Fixed bugs in planning codelet --- .../unicamp/cst/planning/PlanningCodelet.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index 69572d1c..84ba207a 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -4,6 +4,8 @@ import br.unicamp.cst.core.entities.Memory; import br.unicamp.cst.core.exceptions.CodeletActivationBoundsException; +import java.util.Optional; + public abstract class PlanningCodelet extends Codelet { private String id; @@ -22,18 +24,20 @@ public PlanningCodelet(String id) { @Override public void accessMemoryObjects() { - if(inputInitialStateMO == null - && inputGoalsMO == null - && inputActionsMO == null - && inputTransitionFunctionsMO == null - && outputPlanMO == null - ){ - inputInitialStateMO = getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MEMORY.toString()); - inputGoalsMO = getInput(PlanningMemoryNames.INPUT_GOALS_MEMORY.toString()); - inputActionsMO = getInput(PlanningMemoryNames.INPUT_ACTIONS_MEMORY.toString()); - inputTransitionFunctionsMO = getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS_MEMORY.toString()); - outputPlanMO = getOutput(PlanningMemoryNames.OUTPUT_PLAN_MEMORY.toString()); - } + inputInitialStateMO = Optional.ofNullable(inputGoalsMO) + .orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MEMORY.toString())); + + inputGoalsMO = Optional.ofNullable(inputGoalsMO) + .orElse(getInput(PlanningMemoryNames.INPUT_GOALS_MEMORY.toString())); + + inputActionsMO = Optional.ofNullable(inputActionsMO) + .orElse(getInput(PlanningMemoryNames.INPUT_ACTIONS_MEMORY.toString())); + + inputTransitionFunctionsMO = Optional.ofNullable(inputTransitionFunctionsMO) + .orElse(getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS_MEMORY.toString())); + + outputPlanMO = Optional.ofNullable(outputPlanMO) + .orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MEMORY.toString())); } @Override From 4bebbd2ce710e637b9ec149c43b75a1404a55b59 Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Tue, 15 Sep 2020 21:22:59 -0300 Subject: [PATCH 07/11] Fixed bugs in planning codelet --- build.gradle | 2 +- src/main/java/br/unicamp/cst/planning/PlanningCodelet.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 9f56d71a..2f8abfe9 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ description = "CST is the Cognitive Systems Toolkit, a toolkit for the construct sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = '0.5.2-beta' +version = '0.6.0' repositories { flatDir { diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index 84ba207a..a00054eb 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -37,7 +37,7 @@ public void accessMemoryObjects() { .orElse(getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS_MEMORY.toString())); outputPlanMO = Optional.ofNullable(outputPlanMO) - .orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MEMORY.toString())); + .orElse(getInput(PlanningMemoryNames.OUTPUT_PLAN_MEMORY.toString())); } @Override @@ -51,10 +51,10 @@ public void calculateActivation() { @Override public void proc() { - outputPlanMO.setI(planning(inputInitialStateMO, inputGoalsMO, inputActionsMO).getI()); + outputPlanMO.setI(planning(inputInitialStateMO, inputGoalsMO, inputActionsMO, inputTransitionFunctionsMO).getI()); } - public abstract Memory planning(Memory currentState, Memory goal, Memory actions); + public abstract Memory planning(Memory currentState, Memory goal, Memory actions, Memory transitionFunctions); public String getId() { return id; From ec5a58995a8c0a8a5136d95a769c7df300302292 Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Wed, 16 Sep 2020 10:38:22 -0300 Subject: [PATCH 08/11] Added new memory in the planning codelet. --- .../unicamp/cst/planning/PlanningCodelet.java | 40 +++++++++++-------- .../cst/planning/PlanningMemoryNames.java | 11 ++--- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index a00054eb..bf9750a6 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -10,13 +10,14 @@ public abstract class PlanningCodelet extends Codelet { private String id; - private Memory inputInitialStateMO; + private Memory inputInitialState; - private Memory inputGoalsMO; - private Memory inputActionsMO; - private Memory inputTransitionFunctionsMO; + private Memory inputGoals; + private Memory inputActions; + private Memory inputTransitionFunctions; + private Memory inputPlanningRequest; - private Memory outputPlanMO; + private Memory outputPlan; public PlanningCodelet(String id) { setId(id); @@ -24,20 +25,23 @@ public PlanningCodelet(String id) { @Override public void accessMemoryObjects() { - inputInitialStateMO = Optional.ofNullable(inputGoalsMO) - .orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE_MEMORY.toString())); + inputInitialState = Optional.ofNullable(inputGoals) + .orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE.toString())); - inputGoalsMO = Optional.ofNullable(inputGoalsMO) - .orElse(getInput(PlanningMemoryNames.INPUT_GOALS_MEMORY.toString())); + inputGoals = Optional.ofNullable(inputGoals) + .orElse(getInput(PlanningMemoryNames.INPUT_GOALS.toString())); - inputActionsMO = Optional.ofNullable(inputActionsMO) - .orElse(getInput(PlanningMemoryNames.INPUT_ACTIONS_MEMORY.toString())); + inputActions = Optional.ofNullable(inputActions) + .orElse(getInput(PlanningMemoryNames.INPUT_ACTIONS.toString())); - inputTransitionFunctionsMO = Optional.ofNullable(inputTransitionFunctionsMO) - .orElse(getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS_MEMORY.toString())); + inputTransitionFunctions = Optional.ofNullable(inputTransitionFunctions) + .orElse(getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS.toString())); - outputPlanMO = Optional.ofNullable(outputPlanMO) - .orElse(getInput(PlanningMemoryNames.OUTPUT_PLAN_MEMORY.toString())); + inputPlanningRequest = Optional.ofNullable(inputPlanningRequest) + .orElse(getInput(PlanningMemoryNames.INPUT_PLANNING_REQUEST.toString())); + + outputPlan = Optional.ofNullable(outputPlan) + .orElse(getInput(PlanningMemoryNames.OUTPUT_PLAN.toString())); } @Override @@ -51,10 +55,12 @@ public void calculateActivation() { @Override public void proc() { - outputPlanMO.setI(planning(inputInitialStateMO, inputGoalsMO, inputActionsMO, inputTransitionFunctionsMO).getI()); + Optional.ofNullable(outputPlan).ifPresent(memory -> { + memory.setI(planning(inputInitialState, inputGoals, inputActions, inputTransitionFunctions, inputPlanningRequest).getI()); + }); } - public abstract Memory planning(Memory currentState, Memory goal, Memory actions, Memory transitionFunctions); + public abstract Memory planning(Memory currentState, Memory goals, Memory actions, Memory transitionFunctions, Memory planningRequest); public String getId() { return id; diff --git a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java index 97f5c0bd..f04d1df8 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java @@ -1,9 +1,10 @@ package br.unicamp.cst.planning; public enum PlanningMemoryNames { - INPUT_INITIAL_STATE_MEMORY, - INPUT_GOALS_MEMORY, - INPUT_ACTIONS_MEMORY, - INPUT_TRANSITION_FUNCTIONS_MEMORY, - OUTPUT_PLAN_MEMORY + INPUT_INITIAL_STATE, + INPUT_GOALS, + INPUT_ACTIONS, + INPUT_TRANSITION_FUNCTIONS, + INPUT_PLANNING_REQUEST, + OUTPUT_PLAN } From 5e4c0580080274d3e5724e4010051dfab242d6a7 Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Mon, 21 Sep 2020 23:26:08 -0300 Subject: [PATCH 09/11] Added procedural memory in planning codelet. --- .../br/unicamp/cst/planning/PlanningCodelet.java | 13 ++++++++----- .../unicamp/cst/planning/PlanningMemoryNames.java | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index bf9750a6..a4864fb3 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -11,10 +11,13 @@ public abstract class PlanningCodelet extends Codelet { private String id; private Memory inputInitialState; - + private Memory inputGoals; - private Memory inputActions; + + private Memory inputProceduralMemory; + private Memory inputTransitionFunctions; + private Memory inputPlanningRequest; private Memory outputPlan; @@ -31,8 +34,8 @@ public void accessMemoryObjects() { inputGoals = Optional.ofNullable(inputGoals) .orElse(getInput(PlanningMemoryNames.INPUT_GOALS.toString())); - inputActions = Optional.ofNullable(inputActions) - .orElse(getInput(PlanningMemoryNames.INPUT_ACTIONS.toString())); + inputProceduralMemory = Optional.ofNullable(inputProceduralMemory) + .orElse(getInput(PlanningMemoryNames.INPUT_PROCEDURAL_MEMORY.toString())); inputTransitionFunctions = Optional.ofNullable(inputTransitionFunctions) .orElse(getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS.toString())); @@ -56,7 +59,7 @@ public void calculateActivation() { @Override public void proc() { Optional.ofNullable(outputPlan).ifPresent(memory -> { - memory.setI(planning(inputInitialState, inputGoals, inputActions, inputTransitionFunctions, inputPlanningRequest).getI()); + memory.setI(planning(inputInitialState, inputGoals, inputProceduralMemory, inputTransitionFunctions, inputPlanningRequest).getI()); }); } diff --git a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java index f04d1df8..d99e1ddd 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java @@ -3,7 +3,7 @@ public enum PlanningMemoryNames { INPUT_INITIAL_STATE, INPUT_GOALS, - INPUT_ACTIONS, + INPUT_PROCEDURAL_MEMORY, INPUT_TRANSITION_FUNCTIONS, INPUT_PLANNING_REQUEST, OUTPUT_PLAN From 0b9b51b45ddce9c2df85cec78acda4778f8db119 Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Tue, 29 Sep 2020 23:22:05 -0300 Subject: [PATCH 10/11] Added current state memory in planning codelet. --- .../java/br/unicamp/cst/planning/PlanningCodelet.java | 11 ++++++++--- .../br/unicamp/cst/planning/PlanningMemoryNames.java | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index a4864fb3..61dd94a0 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -12,6 +12,8 @@ public abstract class PlanningCodelet extends Codelet { private Memory inputInitialState; + private Memory inputCurrentState; + private Memory inputGoals; private Memory inputProceduralMemory; @@ -28,9 +30,12 @@ public PlanningCodelet(String id) { @Override public void accessMemoryObjects() { - inputInitialState = Optional.ofNullable(inputGoals) + inputInitialState = Optional.ofNullable(inputInitialState) .orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE.toString())); + inputCurrentState = Optional.ofNullable(inputCurrentState) + .orElse(getInput(PlanningMemoryNames.INPUT_CURRENT_STATE.toString())); + inputGoals = Optional.ofNullable(inputGoals) .orElse(getInput(PlanningMemoryNames.INPUT_GOALS.toString())); @@ -59,11 +64,11 @@ public void calculateActivation() { @Override public void proc() { Optional.ofNullable(outputPlan).ifPresent(memory -> { - memory.setI(planning(inputInitialState, inputGoals, inputProceduralMemory, inputTransitionFunctions, inputPlanningRequest).getI()); + memory.setI(planning(inputInitialState, inputCurrentState, inputGoals, inputProceduralMemory, inputTransitionFunctions, inputPlanningRequest).getI()); }); } - public abstract Memory planning(Memory currentState, Memory goals, Memory actions, Memory transitionFunctions, Memory planningRequest); + public abstract Memory planning(Memory initialState, Memory currentState, Memory goals, Memory proceduralMemory, Memory transitionFunctions, Memory planningRequest); public String getId() { return id; diff --git a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java index d99e1ddd..d6423608 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java @@ -2,6 +2,7 @@ public enum PlanningMemoryNames { INPUT_INITIAL_STATE, + INPUT_CURRENT_STATE, INPUT_GOALS, INPUT_PROCEDURAL_MEMORY, INPUT_TRANSITION_FUNCTIONS, From 2609b29630ce740906931b9f3e8d6cfd46ba844e Mon Sep 17 00:00:00 2001 From: Eduardo de Moraes Froes Date: Tue, 29 Sep 2020 23:30:08 -0300 Subject: [PATCH 11/11] Renamed memory attributes in planning codelet class. --- .../java/br/unicamp/cst/planning/PlanningCodelet.java | 10 +++++----- .../br/unicamp/cst/planning/PlanningMemoryNames.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java index 61dd94a0..9c5ce39f 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningCodelet.java @@ -12,7 +12,7 @@ public abstract class PlanningCodelet extends Codelet { private Memory inputInitialState; - private Memory inputCurrentState; + private Memory inputObservations; private Memory inputGoals; @@ -33,8 +33,8 @@ public void accessMemoryObjects() { inputInitialState = Optional.ofNullable(inputInitialState) .orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE.toString())); - inputCurrentState = Optional.ofNullable(inputCurrentState) - .orElse(getInput(PlanningMemoryNames.INPUT_CURRENT_STATE.toString())); + inputObservations = Optional.ofNullable(inputObservations) + .orElse(getInput(PlanningMemoryNames.INPUT_OBSERVATIONS.toString())); inputGoals = Optional.ofNullable(inputGoals) .orElse(getInput(PlanningMemoryNames.INPUT_GOALS.toString())); @@ -64,11 +64,11 @@ public void calculateActivation() { @Override public void proc() { Optional.ofNullable(outputPlan).ifPresent(memory -> { - memory.setI(planning(inputInitialState, inputCurrentState, inputGoals, inputProceduralMemory, inputTransitionFunctions, inputPlanningRequest).getI()); + memory.setI(planning(inputInitialState, inputObservations, inputGoals, inputProceduralMemory, inputTransitionFunctions, inputPlanningRequest).getI()); }); } - public abstract Memory planning(Memory initialState, Memory currentState, Memory goals, Memory proceduralMemory, Memory transitionFunctions, Memory planningRequest); + public abstract Memory planning(Memory initialState, Memory observations, Memory goals, Memory proceduralMemory, Memory transitionFunctions, Memory planningRequest); public String getId() { return id; diff --git a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java index d6423608..4b6b4822 100644 --- a/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java +++ b/src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java @@ -2,7 +2,7 @@ public enum PlanningMemoryNames { INPUT_INITIAL_STATE, - INPUT_CURRENT_STATE, + INPUT_OBSERVATIONS, INPUT_GOALS, INPUT_PROCEDURAL_MEMORY, INPUT_TRANSITION_FUNCTIONS,