/
OnlineSearchProblem.java
48 lines (41 loc) · 1.42 KB
/
OnlineSearchProblem.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package aima.core.search.framework.problem;
import aima.core.search.framework.Node;
import java.util.List;
/**
* Artificial Intelligence A Modern Approach (3rd Edition): page 147.<br>
* <br>
* An online search problem must be solved by an agent executing actions, rather
* than by pure computation. We assume a deterministic and fully observable
* environment (Chapter 17 relaxes these assumptions), but we stipulate that the
* agent knows only the following: <br>
* <ul>
* <li>ACTIONS(s), which returns a list of actions allowed in state s;</li>
* <li>The step-cost function c(s, a, s') - note that this cannot be used until
* the agent knows that s' is the outcome; and</li>
* <li>GOAL-TEST(s).</li>
* </ul>
*
* @param <S> The type used to represent states
* @param <A> The type of the actions to be used to navigate through the state space
*
* @author Ruediger Lunde
*/
public interface OnlineSearchProblem<S, A> {
/**
* Returns the initial state of the agent.
*/
S getInitialState();
/**
* Returns the description of the possible actions available to the agent.
*/
List<A> getActions(S state);
/**
* Determines whether a given state is a goal state.
*/
boolean testGoal(S state);
/**
* Returns the <b>step cost</b> of taking action <code>action</code> in state <code>state</code> to reach state
* <code>stateDelta</code> denoted by c(s, a, s').
*/
double getStepCosts(S state, A action, S stateDelta);
}