Improvements to BreadthFirstPlanner

- Allow for unbounded search
- Allow for a way to look for a certain number of plans
- Use Pair from standard library
This commit is contained in:
Brandon Rozek 2023-09-26 15:08:10 -04:00
parent 88b5ceee7a
commit 08b9c01f3e
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480
4 changed files with 90 additions and 87 deletions

View file

@ -44,17 +44,17 @@ public final class Runner {
return;
}
Planner breadthFirstPlanner = new BreadthFirstPlanner();
BreadthFirstPlanner breadthFirstPlanner = new BreadthFirstPlanner();
for (PlanningProblem planningProblem : planningProblemList) {
Optional<Set<Plan>> optionalPlans = breadthFirstPlanner.plan(
Set<Plan> plans = breadthFirstPlanner.plan(
planningProblem.getBackground(),
planningProblem.getActions(),
planningProblem.getStart(),
planningProblem.getGoal());
if(optionalPlans.isPresent()) {
System.out.println(optionalPlans.get().toString());
if(plans.size() > 0) {
System.out.println(plans.toString());
}
else {
System.out.println("FAILED");