TORA example

This commit is contained in:
Naveen Sundar Govindarajulu 2018-06-18 18:29:40 -07:00
parent 2624b0c411
commit 32e7a8fe4c
6 changed files with 88 additions and 8 deletions

View file

@ -132,7 +132,14 @@ public class Action {
public List<Variable> openVars() {
return freeVariables;
Set<Variable> variables = Sets.newSet();
variables.addAll(freeVariables);
List<Variable> variablesList = CollectionUtils.newEmptyList();
variablesList.addAll(variables);
return variablesList;
}

View file

@ -42,15 +42,18 @@ public class Sandbox {
public static void main(String[] args) throws com.naveensundarg.shadow.prover.utils.Reader.ParsingException {
List<PlanningProblem> planningProblemList = (PlanningProblem.readFromFile(Sandbox.class.getResourceAsStream("../problems/tora/sodacan.clj")));
List<PlanningProblem> planningProblemList = (PlanningProblem.readFromFile(Sandbox.class.getResourceAsStream("../problems/tora/attend.clj")));
Planner depthFirstPlanner = new DepthFirstPlanner();
PlanningProblem planningProblem = planningProblemList.stream().filter(problem -> problem.getName().equals("soda can challenge")).findFirst().get();
PlanningProblem planningProblem = planningProblemList.stream().filter(problem -> problem.getName().equals("soda can challenge 2")).findFirst().get();
depthFirstPlanner.plan(planningProblem.getBackground(), planningProblem.getActions(), planningProblem.getStart(), planningProblem.getGoal()).ifPresent(
System.out::println
y->{
System.out.println(y);
}
);