Checking if an action is non-trivial

This commit is contained in:
Naveen Sundar Govindarajulu 2017-01-22 09:33:10 -08:00
parent 079af81ce0
commit 8d5f2464a1
5 changed files with 16 additions and 8 deletions

View file

@ -36,6 +36,8 @@
</dependency> </dependency>
</dependencies> </dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project> </project>

View file

@ -140,6 +140,12 @@ public class Action {
} }
public boolean isNonTrivial(){
boolean case1Trivial = Sets.subset(additions, preconditions) && deletions.isEmpty();
return !case1Trivial;
}
@Override @Override
public String toString() { public String toString() {
return shorthand.getArguments().length == 0? name: shorthand.toString(); return shorthand.getArguments().length == 0? name: shorthand.toString();

View file

@ -15,8 +15,8 @@ import java.util.stream.Collectors;
public class DepthFirstPlanner implements Planner { public class DepthFirstPlanner implements Planner {
private static int MAX_DEPTH = 4; private static int MAX_DEPTH = 3;
private static boolean EXHAUSTIVE_TILL_MAX_DEPTH = true; private static boolean EXHAUSTIVE_TILL_MAX_DEPTH = false;
public static int getMaxDepth() { public static int getMaxDepth() {
return MAX_DEPTH; return MAX_DEPTH;
@ -77,7 +77,7 @@ public class DepthFirstPlanner implements Planner {
Set<Plan> allPlans = Sets.newSet(); Set<Plan> allPlans = Sets.newSet();
boolean atleastOnePlanFound = false; boolean atleastOnePlanFound = false;
for (Action action : actions) { for (Action action : actions.stream().filter(Action::isNonTrivial).collect(Collectors.toSet())) {
Optional<Set<Pair<State, Action>>> nextStateActionPairs = Operations.apply(background, action, start); Optional<Set<Pair<State, Action>>> nextStateActionPairs = Operations.apply(background, action, start);

View file

@ -1,5 +1,4 @@
package edu.rpi.rair.utils; package edu.rpi.rair.utils;
import com.diogonunes.jcdp.color.ColoredPrinter; import com.diogonunes.jcdp.color.ColoredPrinter;
import com.diogonunes.jcdp.color.api.Ansi; import com.diogonunes.jcdp.color.api.Ansi;
import com.naveensundarg.shadow.prover.Sandbox; import com.naveensundarg.shadow.prover.Sandbox;
@ -12,6 +11,7 @@ import edu.rpi.rair.Goal;
import edu.rpi.rair.GoalTracker; import edu.rpi.rair.GoalTracker;
import edu.rpi.rair.Plan; import edu.rpi.rair.Plan;
import edu.rpi.rair.Planner; import edu.rpi.rair.Planner;
import edu.rpi.rair.utils.GoalTrackingProblem;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -39,7 +39,7 @@ public class RunDemo {
}); });
planningProblemWarmUp(); planningProblemWarmUp();
System.out.println("WARM UP DONE"); System.out.println("\nWARM UP DONE");
} catch (Reader.ParsingException e) { } catch (Reader.ParsingException e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -35,7 +35,7 @@
(in ?person ?room2) (in ?person ?room2)
(open (door ?room2))] (open (door ?room2))]
:additions [(in ?person ?room1)] :additions [(in ?person ?room1)]
:deletions [(in ?person ?room1)] :deletions [(in ?person ?room2)]
}) })
(define-action keepDoorClosed [?actor ?room] (define-action keepDoorClosed [?actor ?room]
{:preconditions [(robot ?actor) {:preconditions [(robot ?actor)