Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.1'
version = '0.5.2-beta'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the Semantic Versioning 2.0.0 that we have been using, I recommend this PR to bump CST's version to 0.6.0, as we effectively have a new feature here.


repositories {
flatDir {
Expand Down
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions src/main/java/br/unicamp/cst/planning/PlanningCodelet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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 String id;

private Memory inputInitialStateMO;

private Memory inputGoalsMO;
private Memory inputActionsMO;
private Memory inputTransitionFunctionsMO;

private Memory outputPlanMO;

public PlanningCodelet(String id) {
setId(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());
}
}

@Override
public void calculateActivation() {
try {
setActivation(0d);
} catch (CodeletActivationBoundsException e) {
e.printStackTrace();
}
}

@Override
public void proc() {
outputPlanMO.setI(planning(inputInitialStateMO, inputGoalsMO, inputActionsMO).getI());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but without a test that can be used also as a spec to this Codelet, it becomes quite hard to understand how all these abstract concepts should be used in practice. What do you think of adding a test to this PR, so anyone would have it as a spec for how to use this new PlanningCodelet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

André I will implement tests using planning codelet in this PR, but I haven't had time to do that yet.

}

public abstract Memory planning(Memory currentState, Memory goal, Memory actions);

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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
}