Class Sa1Solver<NavgraphNode>
java.lang.Object
eu.iv4xr.framework.goalsAndTactics.Sa1Solver<NavgraphNode>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Perform exploration for the given budget. -
Field Summary
Modifier and TypeFieldDescriptionA function that returns the "distance" between an entity and the agent.A function to check if an entity is reachable from the agent's position.(package private) Random
-
Constructor Summary
ConstructorDescriptionSa1Solver(BiFunction<Iv4xrAgentState<NavgraphNode>,WorldEntity,Boolean> reachabilityChecker, BiFunction<Iv4xrAgentState<NavgraphNode>,WorldEntity,Float> distanceToAgent, Function<Iv4xrAgentState<NavgraphNode>,BiFunction<WorldEntity,WorldEntity,Float>> distanceFunction, Function<String,GoalStructure> gCandidateIsInteracted, Function<String,GoalStructure> gTargetIsRefreshed, Predicate<Iv4xrAgentState<NavgraphNode>> explorationExhausted, Function<Integer,GoalStructure> exploring)
-
Method Summary
Modifier and TypeMethodDescription(package private) WorldEntity
nextCandidate(Iv4xrAgentState<NavgraphNode> belief, List<String> visited, Predicate<WorldEntity> selector, String tId, Sa1Solver.Policy policy)
solver(BasicAgent agent, String tId, Predicate<WorldEntity> selector, Predicate<Iv4xrAgentState> phi, Sa1Solver.Policy policy, int incrementalExplorationBudget)
This tries to make the environment to move to a state where the entity tId satisfies the predicate phi as a goal.
-
Field Details
-
reachabilityChecker
A function to check if an entity is reachable from the agent's position. The agent is not specified explicitly, but instead the function takes an agent-state as input. "The agent" is the agent that "owns" this state, and its id is embedded in that state. -
distanceToAgent
A function that returns the "distance" between an entity and the agent. -
distanceBetweenEntities
public Function<Iv4xrAgentState<NavgraphNode>,BiFunction<WorldEntity,WorldEntity,Float>> distanceBetweenEntities -
gCandidateIsInteracted
-
gTargetIsRefreshed
-
explorationExhausted
-
exploring
-
rnd
Random rnd
-
-
Constructor Details
-
Sa1Solver
public Sa1Solver() -
Sa1Solver
public Sa1Solver(BiFunction<Iv4xrAgentState<NavgraphNode>,WorldEntity,Boolean> reachabilityChecker, BiFunction<Iv4xrAgentState<NavgraphNode>,WorldEntity,Float> distanceToAgent, Function<Iv4xrAgentState<NavgraphNode>,BiFunction<WorldEntity,WorldEntity,Float>> distanceFunction, Function<String,GoalStructure> gCandidateIsInteracted, Function<String,GoalStructure> gTargetIsRefreshed, Predicate<Iv4xrAgentState<NavgraphNode>> explorationExhausted, Function<Integer,GoalStructure> exploring)
-
-
Method Details
-
nextCandidate
WorldEntity nextCandidate(Iv4xrAgentState<NavgraphNode> belief, List<String> visited, Predicate<WorldEntity> selector, String tId, Sa1Solver.Policy policy) -
solver
public GoalStructure solver(BasicAgent agent, String tId, Predicate<WorldEntity> selector, Predicate<Iv4xrAgentState> phi, Sa1Solver.Policy policy, int incrementalExplorationBudget)This tries to make the environment to move to a state where the entity tId satisfies the predicate phi as a goal. The algorithm is as follows:- The agent moves to tId until it can see it.
- It checks the predicate phi. If it is satisfied we are done.
- Else, the agent check if there is a reachable entity e whose properties satisfy the given selector, and not yet tried before. If there is such an e, the agent moves to it and interacts with it. Then it repeats from step-1.
- If there is no such e in step-3, the agent checks if the world has some unvisited place (has some area to explore). If so, the agent explores for some budget, then we go back to step-3.
- If there is no more place to explore, the search fails.
-