-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Planning codelet #16
Open
eduardofroes
wants to merge
11
commits into
master
Choose a base branch
from
planning_codelet
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Planning codelet #16
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f3640f3
First version of planning codelet.
eduardo-froes-ifood 21b0ff0
First version of Planning Codelet.
eduardo-froes-ifood 877394e
Revert java version to jdk 8
eduardo-froes-ifood 716235a
Added id attribute in planning codelet.
eduardo-froes-ifood fc63c92
Renamed the memory objects attributes.
eduardo-froes-ifood d98dc1e
Fixed bugs in planning codelet
eduardo-froes-ifood 4bebbd2
Fixed bugs in planning codelet
eduardo-froes-ifood ec5a589
Added new memory in the planning codelet.
eduardo-froes-ifood 5e4c058
Added procedural memory in planning codelet.
eduardo-froes-ifood 0b9b51b
Added current state memory in planning codelet.
eduardo-froes-ifood 2609b29
Renamed memory attributes in planning codelet class.
eduardo-froes-ifood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
72 changes: 72 additions & 0 deletions
72
src/main/java/br/unicamp/cst/planning/PlanningCodelet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
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; | ||
|
||
import java.util.Optional; | ||
|
||
public abstract class PlanningCodelet extends Codelet { | ||
|
||
private String id; | ||
|
||
private Memory inputInitialState; | ||
|
||
private Memory inputGoals; | ||
private Memory inputActions; | ||
private Memory inputTransitionFunctions; | ||
private Memory inputPlanningRequest; | ||
|
||
private Memory outputPlan; | ||
|
||
public PlanningCodelet(String id) { | ||
setId(id); | ||
} | ||
|
||
@Override | ||
public void accessMemoryObjects() { | ||
inputInitialState = Optional.ofNullable(inputGoals) | ||
.orElse(getInput(PlanningMemoryNames.INPUT_INITIAL_STATE.toString())); | ||
|
||
inputGoals = Optional.ofNullable(inputGoals) | ||
.orElse(getInput(PlanningMemoryNames.INPUT_GOALS.toString())); | ||
|
||
inputActions = Optional.ofNullable(inputActions) | ||
.orElse(getInput(PlanningMemoryNames.INPUT_ACTIONS.toString())); | ||
|
||
inputTransitionFunctions = Optional.ofNullable(inputTransitionFunctions) | ||
.orElse(getInput(PlanningMemoryNames.INPUT_TRANSITION_FUNCTIONS.toString())); | ||
|
||
inputPlanningRequest = Optional.ofNullable(inputPlanningRequest) | ||
.orElse(getInput(PlanningMemoryNames.INPUT_PLANNING_REQUEST.toString())); | ||
|
||
outputPlan = Optional.ofNullable(outputPlan) | ||
.orElse(getInput(PlanningMemoryNames.OUTPUT_PLAN.toString())); | ||
} | ||
|
||
@Override | ||
public void calculateActivation() { | ||
try { | ||
setActivation(0d); | ||
} catch (CodeletActivationBoundsException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void proc() { | ||
Optional.ofNullable(outputPlan).ifPresent(memory -> { | ||
memory.setI(planning(inputInitialState, inputGoals, inputActions, inputTransitionFunctions, inputPlanningRequest).getI()); | ||
}); | ||
} | ||
|
||
public abstract Memory planning(Memory currentState, Memory goals, Memory actions, Memory transitionFunctions, Memory planningRequest); | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/br/unicamp/cst/planning/PlanningMemoryNames.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package br.unicamp.cst.planning; | ||
|
||
public enum PlanningMemoryNames { | ||
INPUT_INITIAL_STATE, | ||
INPUT_GOALS, | ||
INPUT_ACTIONS, | ||
INPUT_TRANSITION_FUNCTIONS, | ||
INPUT_PLANNING_REQUEST, | ||
OUTPUT_PLAN | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method
planning
has 5 arguments (exceeds 4 allowed). Consider refactoring.