Chapter 3 - Solving problems by searching Flashcards

1
Q

Define a search

A

A search is the process of computing/finding the path that leads from your current state to the goal state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define problem solving agents

A

Problem solving agents use atomic representations, states of the world that are considered as wholes. This means that they do not keep an internal structure at all. Very simple units.

I suppose this means that the agents following this scheme has no internal state in the sense that they only find a solution path of actions to perform. This doesn’t require monitoring of states. Since we assume that the task environment is known, fully observable and all that, it is reasonable to think that an agent can find a solution and shut its sensors off afterwards. In other words, there is no more interaction between the agent and other agents/objects in the TE after the route has been found.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define planning agents

A

Planning agents are goal based agents that keep an internal state of some type, factored or structured representations of states.

I believe this means that planning agents are always monitoring their percepts, because their actions rely on interaction. Problem solving agents, on the other hand, use a current state and knowledge to find a solution. When a solution is found, the sensors can shut down, and the agent can execute the path that it has constructed. This means that the actions are actions that is to be performed regardless of anything else.

Now, keep in mind that we consider the following task environment: episodic, single agent, fully observable, deterministic, static, discrete and known. You cannot get it simpler than this.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do we mean by “informed” algorithms?

A

Informed refer to knowing how far it is to the goal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What do we mean by “uninformed” algorithms?

A

Uninformed algorithms dont have a clue on where a goal might be. Therefore their only solution is to systematically explore the graph.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When we say, in this chapter, that we discuss environments that are known, what do we mean?

Name an example

A

A known task environment has a complete transition model. It knows everything about actions and what they do.

That we know the outcomes of our actions.

We refer to task environments that we “know”. This means that if we were to choose a road to get to some place, we would know where each road leads to. For instance a map.

If we didn’t know (unknown TE), we would have to randomize, which is a brute force solution, that rarely work on large cases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the 4-phase problem solving strategy?

A

1) Goal formulation. The agent receives a goal. This will limit the behavior to concentrate on this goal only. This will reduce the total amount of possible actions.

2) Problem formulation. The agent devices a description of the states and actions necessary to reach the goal.

3) Search. Simulation of sequences of actions. When it finds a solution-sequence, it stops.

4) Executions. One action at a time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When we have a fully observable, deterministic, known environment, what can we say about the solution?

A

the solution will always be a sequence of actions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define open-loop system?

A

A open loop system is a system that operates without receiving feedback during execution.

A open loop system is one where, after finding a solution from the search, you could ignore all other percepts. We know we will reach the goal, so there is no point in treating percepts.

If there is a change that the agent might not reach the goal, we would consider it a closed-loop system. Then we would monitor the percepts at all times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In general terms, how can we describe a search problem?

A

We can describe a search problem by the following bullets:
1) State space (all possible states)
2) Initial state
3) set of goal states. Could be one, or many. Could be infinite.
4) Set of actions that are available
5) Transition model, describing what the actions does
6) An action cost function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the state space?

A

The state space is the space/set of all possible states that the environment can be in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the initial state, name example

A

Initial state is the state that we are currently in before choosing the path.

For instance, some place that we are currently at.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Elaborate on goal states

A

we could have one goal state, or we could have many. We would typically get many goal states if the goal is about reaching or satisfying some condition.

The goal state should be accompanied by a method called isGoal() that returns whether or not a state is a goal state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Elaborate on the actions available to the agent

A

The actions that are available are dependent on the current state as well as the actuators of the agent.

Should have a method called “actions(s)” that gives a set of possible actions from this state.

Ex: actions(Arad) = {ToSibiu, ToTimisoara, ToZerind}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Elaborate on the transition model

A

The transition model describes what the actions does. Typically with the method called “result(s, a)” that gives the state that results from performing actions a on state s.

Therefore we can say that the transition model describes mappings from pairs of current state and some action, to some result state.

f: (s,a) —-> s’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Elaborate on the action cost function

A

We use the function “actionCost(s, a, s’)” to calculate the cost associated with performing action a on s to get to state s’. Typically, the lower the cost the better. Like shortest path. There should be heavy correlation between the action cost function the and performance measure of the agent.

We assume additivity. This means that the cost function applied on a series of states (path of size greater than 1) is simply the sum of individual costs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the difference between standardized and real world problems?

A

Standardized problems are intended to illustrate the various problem solving methodology, and have a lot of performance benefits. However, these solutions are not generally used. Real life problems are idiosyncratic, which means that they require further specifications because they are individual.

Summary: Standardized problems are for methodology purposes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

if we have a 2d array of square cells in which the agent can operate, what do we call this?

A

Grid world

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Elaborate on what a “grid world” means

A

A grid world refers to a 2d array of squares in which an agent can operate. It serves as an abstraction of the world/environment. There are restrictions though, the square-assumptions being one.

A grid world is good for simplicity, but can quickly become large.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Explain how the vacuum world can be formulated as a grid world problem

A

We remember that a search problem can be formulated with 6 bullet points:
1) State space
2) Initial state
3) Goal state
4) Actions
5) Transition model
6) Action cost function

I the vacuum world, we get the following:
State space consists of all possible states that the world can be in. We have 2 tiles, making a 1x2 matrix. Since each tile can contain dirt independently of the other, we get 4 possible combinations of states. However, we also have the agent. The agent can be in either one of the tiles, regardless of whether the tile contains dirt or not. Therefore, we get n2^(n) = 22*2 = 8 possible states.

The initial state could be either one, doesn’t really matter.

Actions: We can suck, move left or move right. KEY DISTINCTION: Absolute vs egocentric actions. Absolute movement actions would be “up”, “down” etc. Egocentric actions are relative to the viewpoint of the agent. “Turn left”, “turn right” etc.

Transition model: We know that “suck” removes dirt. We know “forward” moves one tile forward in the direction that the agent face. etc.

Goal states: the state where every tile is clean. 2 of the 8 states in the state space are goal states.

Actions costs: Each action cost 1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Define superimpose

A

To lay something over something else. In AI context, we can superimpose a search tree over the state space graph. Each node in the search tree corresponds to a state in the state space, and the edges represent the actions required to reach them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What do we mean by “expanding” a node?

A

Expanding a node refers to finding new nodes by testing actions and finding out what nodes (states) they lead to. In other words, we use the result(s, a) function to see where an action leads to.

After generating new nodes, we now need to figure out which if the newly generated nodes to consider next. This is the essence of a search.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the “frontier” of the search tree?

A

The frontier is the list of unexpanded nodes in the tree. The nodes are reached, but not expanded.

We say that the frontier separates two parts of the state space graph.
1) The part that is expanded (discovered completely)
2) The part that is not yet reached

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Describe best first search

A

Best first search searches for a solution by always choosing to expand nodes that are “cheapest”.

It use a priority queue with nodes that are sorted based on some evaluation function f(n). When it extract a node from the queue, it always gets the node with the lowest edge weight.

The also runs until the priority queue is empty or a solution is found.

IMPORTANT:
When BestFirstSearch expands a node, it will generate new nodes for the states we can reach by using the arsenal of actions from the state/node we are expanding. Each generated child will receive a COST. This cost is equal to the path-cost from the root to the node that we are expanding + the cost of going to from the expanding node to the newly generated node. So, cost=Path-Cost + Action-Cost.

The total cost to reach a node is thus subject to change if we find another route that leads to the same state but has a better total cost. In such a case, we need to add the child to the frontier AGAIN even though we already added it previously. This is because the new total cost may introduce new oppurtunities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What do we need to create a data structure that represent states?

A

four parts.

1) node.STATE
2) node.PARENT
3) node.ACTIOn
4) node.PATH-COST

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

How do we, given a solution goal state, find the action sequence?

A

We use the parent pointers to chain backwards while keeping track of the action (stored in each node) that lead us to this specific state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Name queues we can use

A

LIFO, FIFIO, priority

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is a “repeated state”?

A

A state that is reached multiple times. Cycles create such repeated states. Therefore, if one includes cycles, there is no end to the state space. We could continue to infinity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What do we mean by redundant paths?

A

Redundant paths are paths that we need not consider because they offer a solution, but not a better solution that one we currently have. We are not interested in worse solutions.

We absolutely have to eliminate redundant paths! In larger cases (not even very large, 10x10 grid problems) redundant paths make it a million times slower.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Give a detailed explanation of best first search

A

the algorithms takes problem and a function f as input, and returns a goal node. When returned, the goal node contains a pointer to another node, which again points further, creating a chain of nodes which creates the solution path.

There are two engines in the best first algorithm:
1) Priority queue based on the function f(n).
2) Reached lookup table.
The priority queue is simple enough, and holds nodes that are on the frontier. The algorithm works by while-looping through the priority queue, iterating through the nodes on the frontier with the lowest value. Therefore, the way f(n) works will define the algorithm.

The look up table, typically a hash map structure, is key. It holds different “states” as Keys, and the corresponding value is the node. HERE IS THE IMPORTANT PART: A node is not the same as a node. Meaning, the expand-function generate nodes with different attribute values, even though it is the same node/state. Therefore, several nodes can have the same state, but they will typically have different parent nodes and different path cost. THIS is what drives the reached look up table.

THE PROCESS:
we extract the node from the priority queue with the lowest cost between it and the current node. Then an if statement checks whether we have reached the goal state or not. If so, return node. Else, continue.
Assuming we didn’t reach the goal, we now use the expand function to generate child nodes. These child nodes contain states like always, but they also contain root-specific parent nodes etc. Then we loop through all the newly generated child nodes, and find their states. If this state has never been previously reached, we will add the state in the look up table along with the node representing the state, and we add this node to the frontier.
If the node has been previously reached, we compare the path cost between the old way and the new way. If the new is better, we add the new node (with correct pointer/updated pointer information) to the frontier and update the look up table as well.

This is the general idea.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

The “expand” function is used to generate child nodes. How does it work?

A

It receives a node, and then loops through all possible actions that may be performed at the given state.
s = node.state
for action in actions(s):
s’ = result(s,action)
cost = node.path-cost + problem.Action-cost(s, action, s’)
yield node(state = s’, parent=node, action=action, path-cost=cost)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What do we mean by “problem” that we see in the input of a search?

A

A problem is an abstract class (in python) that represents functionality that a problem must have.

Formally, a search problem contains the following:
1) a set of possible states, also known as the state space
2) The initial state
3) A set of goal states. Accompanied by the isGoal() method
4) The actions that are avaiable to the agent at a specific state
5) A transition model, using the result(s,a) function to figure out how our actions impact the world
6) An action-cost function. Calculate the cost of performing a certain action. Given by the Action-Cost(s,a,s’) if we are programming, or c(s,a,s’) if we’re doing math.

It contains functions that provide:
- actions, through a actions(state) method
- result method, gives you the state when a certain action is to be performed. Typically method result(state, action).
- goal_test(state)
- path_cost(state, action, result_state, costPrevious)

It is up to us, as programmers, to program a satisfactory subclass of the abstract class problem, so that it fits our problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Elaborate on “nodes”

A

Nodes are structures that mainly consists of pointers.
They point to their parent.
They point to the state that they represent.
Includes the action that got us to this node.
Contains the total path cost (from source).

The nodes do not have pointers to children. We find the children by using expand, which use actions and look at the state we get.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What is a “repeated state”?

A

A repeated state is a state that has been previously reached/expanded and then re-reached.
Can be because of cycles. If so, we may risk infinite states, so we need to be careful.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What is the meaning of redundant paths?

A

Redundant paths refer to the case where we have multiple/several paths that leads from the same source to the same goal. The path is different, but the endpoint and goal is the same for both paths.

We are typically only interested in the “best” paths, so there is no need to keep track of all of them. In fact, keeping track of all of them is a big problem due to the sheer size/number of paths we might have.

Consider 10x10 grid world and finding a path from a source tile to a goal tile. The number of possibilities would be ridiculous. We can’t keep track of all of them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

How do we eliminate redundant paths?

A

There are 3 ways:

1) Remember previously reached states. This way, we can compare the current best with alternatives and keep the better option. This is the approach used in best first search.

2) We could simply not give a fuck and dont check for redundancy. This works for problems where WE KNOW that redundancy is not an issue. For instance, when searching on structures that already have a tree-property, we need not worry. Assembly line for instance. We call a search that doesn’t check for redundancy a “tree-like search”. If it checks, we call it “graph search”.

3) We compromise and check for cycles, but not for redundant paths in general. We back trace and check for cycles.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

In what ways can we measure performance of problem-solving algorithms?

A

There are 4 ways:

1) Completeness. Does it find a solution if one exists?
2) Cost optimality. Does it find the BEST solution?
3) Time complexity
4) Space complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What is branching factor?

A

Branching factor refers to the number of successors of a node that needs to be considered (the immediate children of a node)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

When is the breadth first search appropriate?

A

Uninformed algorithm that works well when every action cost the same.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

Can we use best first to calculate breadth-first search?

A

Yes, we can do this by using f(n)=amount of actions, and then perhaps multiply this number by a weight.
However, this is not the most efficient way of implementing a breadth first search.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

What are the main differences between breadth first and best first in terms of “tricks” to improve efficiency?

A

Firstly, breadth first use a FIFO queue, which will always be faster than priority queues. FIFO is sufficient because we always add nodes according to their level away from the source.

Secondly, “reached” can be a set of states rather than a hash map. This is because if we reach a certain node, we know that the current path is the best, as every other path will be longer (because equal weights).
This also means that we can do an early goal test, in contrast to the late goal test that best first does.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

What do we call Dijkstra’s in the AI community?

A

Uniform-cost search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

Explain uniform-cost search

A

It is the exact same as best-first, but we use evaluation function as a function that calculates the total path cost from source to node.

The origin of the name “uniform” refers to the fact that this algorithm WILL always perform on nodes of same “weight”/”cost” in order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

is depth first search cost optimal?

A

No. It is not cost optimal because if will return the first solution it finds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

When do we consider using depth first search?

A

Depth first is great whenever the graph we are expanding is a tree like structure. Meaning, where a tree like search is feasible, the depth first search require much less memory than the other searches. This is because the frontier is very small, and the reached look up table is not included.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

Compare memory requirements of the depth first search and the breadth first search

A

Breadth first search require a reachedtable that become increasingly large further down. very fast reach memory limits.

Depth first only keep the current path as frontier (and some other nodes).

Because of this. depth first search has become a workhorse of AI.

Depth first: O(bm)

Breadth first: O(b^d)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What are the requirements of using a depth first search?

A

finite state space.

In cyclic state spaces, it may get stuck in infinite loop, must therefore accommodate for such situations.

There are ways, however, that allowed us to use a depth first search even though the original state space is infinite. This method is called “depth limited search”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

What is the point of depth limited search?

A

We add a limit “L” that basically determines a certain depth where we simply dont consider the successors of nodes.

This obviously puts a lot of importance on choosing a suitable value for the depth limit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

What is the “diameter” of the state space?

A

The diameter of the state space refers to the max length we need to get from one side to the entire other side/all other points. If it can be proved that you only need 10 actions to reach every city in a country, then this diameter level would be a good depth limit. There is simply no point in looking further down, as the solutions that we could find further down will be even worse than the current ones.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

When we dont know the diameter of the state space, what can we do if we still want to use DFS due to memory implications?

A

We can use the iterative deepening search.

The iterative deepening search picks/tries all values for the depth limit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

Explain, detailed, the Iterative deepening search

A

The iterative deepening search use many calls to “Depth limited search” with various/iterative values of depth limit.

The iterative part loops from 0 to infinity, each time calling the depth-limited-search. This returns the result. If the result is not equal to some cutoff value, then it returns and the method ends. But if the returned value from depth-limited-search is the cutoff value, then the loop continue.

In the depth-limited-search:
It takes input as the problem, and the depth limit. Problem is the same as with best first search.

It first create a LIFO queue, which is basically a stack. This is the engine, and represent the frontier. At the beginning, the initial state node is added.
Then it initialize the “result” variable as “failure”.

The main part of the search (at the current depth limit) is a while loop that runs through the stack (frontier). It extracts the top element of the stack/frontier, checks if this is the goal state or not (returns node is yes).
Then it checks if the depth of this node is greater than the depth limit. If this is true, then it sets the result variable equal to “cutoff”, and disregard the node, continuing the loop by extracting another element from the frontier stack.
But, if the node depth is not greater than the depth limit, then it runs a “is-not-Cycle(node)” method on the node. If not cycle, it expands the node, generating children of the node and adding them to the frontier. Then the while loop continues.

There is great focus on the is-cycle(node) method in order to avoid going backwards while trying to get deeper in the graph. If we detect a child node as a cycle, we simply ignore the node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

Is there a difference between measuring time and space complexity in computer science as AI?

A

Yes.

In CS we often do so by referencing the amount of vertices and edges. This is appropriate when the graph is an explicit data structure. But in AI, the graph may only be implicitly stated in terms of initial state, possible actions, and transition model. Therefore, it is not practical to use V and E to measure complexity. We therefore want to use branching factor b, depth/number of actions d, the maximum number of actions on any path m.

53
Q

In one sentence, describe the bidirectional search

A

Bidirectional search searches forward from the initial state and backwards from the goal state with the hope of them meeting at some point.

54
Q

What do we need to do in order to make the bidirectional search work?

A

We need to keep track of 2 frontiers and 2 tables of reached states (with nodes representing the states etc).

We also need to be able to reason backwards.

We have a solution when the two frontiers collide.

55
Q

What do we mean by informed search strategies?

A

Informed search strategies refer to search methods that try to use some hints about the location of the goals in order to improve the search.

We call these hints “heuristics”, and the formal definition of a heuristic is a mental short cut.

The heuristics come in the shape of a heuristic function, h(n).

Example: h(n) = straight line distance between cities.

56
Q

Elaborate on heuristics

A

The key part about heuristics is that they are easily calculated. It is supposed to mimic a cache operation that immediatly returns a result for us that allow us to do less work.

57
Q

Define greedy best-first search

A

Greedy best first search use heuristic h(n) as evaluation function. Thus, f(n) = h(n). It will always choose the nodes that it believes will be best based on the heuristic function.

if h(n) is straight line distance, then it will always pick the choices with the lowest straight line distance, with the hope of correlation to real distance.

Greedy best search will not be cost optimal.

Greedy best first search is complete when we have a finite state space.

58
Q

Considering the A* search, what is it?

A

A* search is an informed best-first search that has the following evaluation function:

f(n) = g(n) + h(n)

In other words, the evaluation function is the sum of the path cost from source node to node of interest, and the h(n) is the heuristic function which is the estimated shortest path from node n to a goal state.

59
Q

is A* search complete?

A

Only if state space is finite or has a solution, AND assuming all costs are greater than some value epsilon that is greater than 0.

60
Q

is A* cost optimal?

A

A* can be cost optimal. it depends on certain properties of the heuristic.

A key property of heuristics are admissibility. this means that it will never overestimate the cost to reach a goal.

with an admissible heuristic, A* is cost optimal

61
Q

What is an admissible heuristic?

A

An admissible heuristic refers to a heuristic function that will never overestimate the cost to reach a goal. We therefore say that it is optimistic. It will try something rather than not.

62
Q

What is consistency?

A

Consistency is a property of a heuristic.

A heuristic h(n) is consistent if, for every node n and every sucessesor n’ of n generated by an action a, we have:
h(n) <= c(n,a,n’) +h(n’)

In other words:
A heuristic function is consistent if its estimate (to the goal from node n) is always less than or equal to the sum of the cost of going from n to n’ and the estimate of cost from n’ to the goal.

This is a type of the triangle inequality, as the consistent heuristic cannot estimate a higher cost than the cost of moving to a neighboring state and then performing a new estimate, which is closer to the goal and should therefore be better.

Therefore, all heuristics/heuristic functions that are consistent will automatically be admissible.

63
Q

Explain contours

A

If we have a visual representation of the states we are considering (a graph) we can draw contour lines to show all nodes that fall within some limit. More specifically, all nodes that fall within some limit based on f(n).

We know that f(n) = g(n) + h(n), which means that the cost evaluation is the sum of the path cost to a node n added to the estimate of how far left, given by the heuristic function.

Contour lines use the source node/state as the measuring point in regards to g(n).

The better the heuristic, the narrower the bands (contours) will be.

Actually, if we had the “perfect” heuristic we would be able to precisely predict the optimal cost path. Then the contour of C* would only contain the nodes on the optimal path. This is the extreme case of “better heuristic mean narrower contours”.

64
Q

What do we mean by “monotonic” costs?

A

We refer to the fact that as we move along a path, the g(n) will monotonically increase as costs are always positive.

65
Q

what is f(n)?

A

The evaluation function. When used with A* it tries to estimate the entire path cost by summing together the already calculated cost to node n, and the heuristic estimate from h(n).

66
Q

What is the requirement of monotonically increasing f(n)?

A

The requirement is consistent heuristic.

When we perform an action that leads from n to n’, we get the following:
f(n) = g(n) + h(n)
f(n’) = g(n) + c(n,a,n’) + h(n’)

f(n) = f(n’) –> h(n) = c(n,a,n’) + h(n’)

Here we see that in order for the f(n’) to be larger than f(n), we need this:
h(n) <= c(n,a,n’) + h(n’)

In other words, if the heuristic is consistent.

67
Q

What do we mean by “satisficing” solutions?

A

When we accept solutions that are good enough, but not necessarily optimal.

68
Q

What is the weighted A* search?

A

The weighted A* search refers to an added weight that we multiply with the heuristic function. This is in order to give up admissibility, but get a more accurate heuristic. The hope is that this will reduce running time, as the answer is more precise.

69
Q

Why is f(n) monotonically increasing?

A

f = g + h.

If we move from node n to node n’, the cost change as well:

f(n) = g(n) + h(n)
f(n’) = g(n) + c(n,a,n’) + h(n’)

Now we challenge the statement by setting them equal to eachother.

f(n) = f(n’)
This gives us:
h(n) = c(n,a,n’) + h(n’)

We are interesting in WHEN the evaluation function f(n) is monotonically increasing, which means we must apply the <= operator:

h(n) <= c(n,a,n’) + h(n’)

This is the consistency requirement, which means that if we want our evaluation function to be monotonically increasing, then the heuristic function MUST be consistent.

70
Q

Elaborate on the A* algorithm

A

First of all, it is the best-first search with f(n) = g(n) + h(n).
g(n) is the path cost from source to node n. h(n) is the heuristic function value estimate to the goal. It is absolutely key that this heuristic is admissible (best is consistent).

So, the A* will always choose to expand a node that has the best f(n) value. We remember the priority queue that is used by best-first search. We extract a node based on f(n). When we reach a node by expanding a parent node, we know that the reached node is on the optimal path, meaning that this current pointer-chain is the best. Why is this?

If C* is the cost of the optimal solution, we can say the following:
1) Every node that can be reached from the initial state on a path where every node on the path has f(n) < C* will be surely expanded. This is because the A* algorithms will believe that this path is better than the one that turns out to be optimal. Therefore it tries it. When it eventually finds out that this path is not as good as some other path, due to sudden increase in heuristic values, then the path will be given up. However, the nodes that showed f(n) < C* will be surely expanded, meaning we KNOW they are expanded.

2) A* expands NO nodes with f(n) > C*. This is because of the admissibility effect

71
Q

What is the proof of showing that A* is cost optimal?

A

Assume that the algorithm returns with a cost C that is greater than C* (the optimal cost).
This means that there will be at least some node n that lies on the actual optimal path that has not been expanded. If it had been expanded, then it would have produced the a better alternative because it is on the optimal path, and because of the fact that the admissible feature of the heuristic.
therefore, we have the following:

Because the node was not expanded, we must have the following:

f(n) > C. It this is not the case, it would have been expanded.
f(n) = g(n) + h(n) by definition.
f(n) = g
(n) + h(n); where g(n) refers to the cost of the optimal path from source node to n.
f(n) <= g
(n) + h(n) where h(n) refers to the cost of the optimal path from n to goal.

Then,
f(n) <= C*, which is a contradiction.

In other words:
If there was to be another path that is better, then we would, at some point, have “ignored” the node we would have needed to expand in order to reach the optimal path and the goal. The only explanation for such ignorance, is if the evaluation function f(n) showed a worse estimate than another alternative we had. Because the heuristic function is supposed to be admissible (perhaps consistent) we know that it cannot overestimate anything. Therefore, the evaluation function would provide either the correct answer, or something lower.
Anyways, if the evaluation function indeed showed a worse estimate than what actually is the optimal solution, then we can form the proof of contradiction, because something here doesn’t make sense. Either it is the admissible feature or the fact that such path doesn’t exist. Meaning, we must get the optimal path when admissible.

72
Q

What is pruning?

A

Pruning refers to eliminating possibilities from consideration without having to examine them. Thus reducing time significantly.

73
Q

What is the requirement of having an algorithm that satisfy “completeness”?

A

The algorithm MUST systematically explore the graph/the states such that a solution is found if it exists. This will involve being able to explore the entire graph.

In a more formal way: An algorithm must find a path from the source to goal for every instance of a problem where such a path exists.

Incompleteness often occur when we have infinite state space. Then we need to do some measures.

74
Q

Explain d, m and b

A

These are what we, in AI, use to measure time and space complexity.

d is the depth/number of actions in the optimal solution. Therefore, if we know we find it, we can use this.

m is the maximum number of states down any path.

b is the branching factor, the number of successors of a mode that need to be considered.

75
Q

Why would the A* not choose to expand the goal state even if it is reached in some cases?

A

The A* search always choose to expand the node that offers the lowest estimated cost. In other words, even though the goal is sitting in the frontier list, it could think: “There might be a better way down this other path, let me try this…”. If this new path turns out to be better, then it is better. If not, then it will eventually find the one in the frontier. However, it will have tried every other opportunity that might have provided with a better alternative.

76
Q

Is there any point in using an “inadmissible heuristic”?

A

An inadmissible heuristic is one that might overestimate. This means that we risk missing the optimal solution with the A* search , but the heuristic can potentially be more accurate.

77
Q

Explain detour index.

How can we use this with A*/heuristics?

A

The detour index refers to the fact that a multiplier is applied to straight line distance to account for the typical curvature of the road.

Considering the heuristic of straight line distance, if we multiply the heuristic with the multiplier (detour index) we would get a more accurate heuristic, but it also might over estimate.

When we use this approach with the A* search, we call it “weighted A* search”. The evaluation would then be:
f(n) = g(n) + W*h(n)

The main point of giving up the optimal solution, is to reduce the amount of nodes we have to explore/expand. We are often talking about a small increase in cost (say 5%) and a time reduction of something like 7, meaning the search performs 7 times worse when using regular.

78
Q

What is the general performance rule of the weighted A* search?

A

We expect a result between C* and WC. However, in reality, we often we a solution that is closer to C* than to WC.

79
Q

What is bounded suboptimal search?

A

Bounded suboptimal search refers to accepting results than are within some limit. Weighted A* is within the limit of W. The limit is in regards to the optimal path.

80
Q

What is bounded-cost search?

A

A search where we accept solutions with lower cost than some cost C.

Boundedcost search is a suboptimal type of search that follow the regular goal of suboptimal searches of increased speed, but is not willing to accept any trashy solution. The bound indicates the worst solution it would accept. So, in conclusion, bounded cost search is a balance between performance of speed and soundness.

81
Q

What is unbounded search?

A

We accept any solution, speed is all that matters.

Speedysearch is a type of this. Speedy search is essentially a greedy-best first search that is only using the heuristic. With speedy search, we will never expand more nodes than with A*.

82
Q

What is speedy search?

A

Speedy search is a search that uses heuristic of “estimated number of actions”. It is a type of greedy best first search. It works whenever all costs are the same, and we just want solution fast.

83
Q

What is the main issue with A*?

A

Memory. We have frontier and reached. This is not always a problem though. The key is whether the frontier is large or not relative to the reached. IF frontier is small compared to reached, then it doesn’t matter. But if they are about the same, then it is duplication at a high level.

We could also remove states from reached when it can be proved that they are no longer needed.

we could also keep track of how many times a node/state has been reached. If we are operating in a grid world, a node can only be reached from its neighbors (4). Therefore, we can remove the state from reached when this limit is achieved. This is called “reference counts”.

84
Q

What is beam search?

A

A search that limits the size of the frontier to contain the k best f-scores. Every other expanded node is discarded. this will of course make it incomplete and suboptimal, but it will reduce memory.

85
Q

What is IDA*?

A

Iterative deepening A* search.

In IDA* search, the depth limit is the f-score/value. At each iteration, the cut-off value is the smallest f-cost of any node that exceeded the cut off from the previous iteration. In other words, each iteration exhaustively searches an f-contour, finds a node just beyond that contour, and use this contour value/f-cost as the next contour.

IDA* is a very important algorithm because it doesn’t keep reached table.

86
Q

What is SMA*?

A

Simplified memory bounded A*.

It proceeds just like regular A. But, when memory is full, it will do the following:
It will fetch the node that has the worst f-value of the nodes that are reached. SMA
then backs up the f-value of the node that we forget, and store it at the parent node. In this way, the ancestor of a forgotten subtree will always know the value of the path it has forgotten, even though the nodes are removed from memory. It knows the quality that might be there. If SMA* finds out that all other paths are worse than the forgotten value, then it will reopen this path.

Worth noticing: In the case of similar f-values, SMA* expands the most newly added node, and removes the oldest of the worst nodes.

The problem with SMA* is if it meets difficult problems that require many regenerations of paths due to back and forth actions.

87
Q

Name two good candidates for heuristics of the 8-puzzle game

A

1) The number of misplaced tiles. This is actually admissible because every misplaced tile require AT LEAST one action to get it to the right one. Therefore this will never be an overestimation, but rather a large underestimation.

2) The sum of distances of the tiles from their goal positions. Because we can’t move tiles diagonally, the distance is equal to the sum of the vertical and horizontal distance. Because of its resemblance to city-block movement, this heuristic is called “Manhattan distance”. This heuristic is also admissible. This is based on the same point that we physically cannot move a tile any faster/less costly than the Manhattan distance. So, the Manhattan distance would be the sum of all the individual distances.

88
Q

What is one way to characterize the quality of a heuristic?

A

We can use the effective branching factor, b*

The effective branching factor is defined as this: IF the total number of nodes generated by A * in a particular problem is N and the solution depth is d, then the effective branching factor is the branching factor that a UNIFORM tree of depth d must have in order to contain N+1 nodes.

From the definition of the effective branching factor, we can understand why a good heuristic will result in a lower branching factor than a bad heurisitc function. If we have a perfect heurisitc funciton, we’d have an effective branching factor of 1.

89
Q

What is the effective branching factor b*?

A

If the total number of nodes generated by A* is N and the solution depth is d, then b* is the branching factor that a uniform tree of depth d would have to have in order to contain N+1 nodes.

Thus:
N+1 = 1 + b* + (b)^2 + (b)^3 + … + (b)^d
Dette er altså en ligning som løses med hensyn til b
.

The effective branching factor can very across different instances of the same problem. But usually, it will be fairly constant across all instances.

A branching factor b* close to 1 is the best.

90
Q

Explain effective depth, and how this can be used a measure of A* pruning/heuristic performance

A

Kort and Reid argue that a better way to characterize the effect is A* pruning (beskjæring av deltrær) with a given heuristic h is that it reduced the effective depth by a constant k_{h} compared to the true depth. This means that the total search cost is O(b^{d-k_{h}} instead of O(b^d) for an uninformed search.

91
Q

When we use g(n) as evaluation function, what exactly is the measure we use?

A

Depends on the algorithm.

If we use breadth first, we use f(n) as the number of actions we need to reach that state/depth. This means it will be a cumulative cost of the entire path to the node representing some state.

If we use Dijkstra’s, the evaluation function is the cost of the path from source to node of interest.

Do not make the mistake of mixing up the action cost function (from the problem itself) the node cost (total cost of the entire path from source to node) and the evaluation function. The evaluation function in A* will be a combination of the current total cost from source to node (current best) and the heuristic of choice.

92
Q

Is it obvious that f(n) will monotonically increase?

A

No. It is obvious that g(n) will monotonically increase.

In regards to f(n) we can prove that the only situation where it will monotonically increase is in the case of consistent heuristic. Therefore, if we can prove that some heuristic is consistent, we can prove that f(n) will always be monotonically increasing.

93
Q

If C* is the cost of an optimal path: What can we say about the nodes in the state space?

A

We can be sure of a couple of things:

1) A* expands all nodes that can be reached from the initial state on a path where every node on the path has f(n) < C*. Therefore, we say these are SURELY EXPANDED NODES.

2) A* expands NO NODES that has f(n) > C* (admissibility)

3) A* might expand some of the nodes on the goal contour, where f(n) = C*

94
Q

What do we mean by “A* is optimally efficient”?

Why is A* optimally efficient?

A

Optimally efficient means that the algorithm will always find the best solution, the optimal solution. This does not mean that it will be the fastest.

A* is optimally efficient because it will, with a consistent heuristic, surely expand all nodes with f(n) < C*. Therefore, if one path is better than another, it will be expanded.

95
Q

What is the main problem with A*?

A

It expands a lot of nodes ,thus requiring much time and memory.

96
Q

What can we do with A* to make it faster/require less memory?

A

We can do what is known as “satisficing solutions”. This means, accepting solutions that are not necessarily perfect or optimal, but good enough. We can eliminate vast amount of the state space by this technique.

97
Q

What is the detour index, and what is the key thought here?

A

The detour index is a multiplier that aims to provide a more accurate result of the straight line distance.

The point is to manipulate the heuristic in a way that makes it more accurate. However, this comes with the cost of giving up the optimal solution. For instance, what happens if the distance measured in air distance is x, and the real distance is very close to this? When we multiply with the detour index of say 1.6, we get a “real distance”/”heuristic distance” that is much higher than it actually is. Therefore, the heuristic now overestimated, which means that it may not find optimal solutions. However, in the long run, it will provide efficiency.

98
Q

What is the weighted A* search?

A

A, but with a slightly modified heuristic: f(n) = g(n) + Wh(n)

In theory, the weighted A* search will get a solution with a cost between C* and WC. However, in general the actual results tend to be closer to C* than WC.

99
Q

What can be said about the way weighted A* “focus” its search?

A

Weighted A* will focus its search towards the goal. This it does because of the extra emphasis on the heuristic value, as it has become relatively more important. It still place some weight on the path cost though.

100
Q

Elaborate on bounded vs unbounded search

A

Bounded and unbounded search refers to suboptimal searches.

Bounded is suboptimal but it has a limit of how “bad” a solution can be. Weighted A* is therefore bounded suboptimal (we can guarantee solution within WC)

Unbounded is a type of suboptimal search that provides no guarantees on solutions. All that matters is speed.

101
Q

What is speedy search?

A

Speedy search is a type of UNBOUNDED search that is a greedy approach. It will use a heuristic which estimates the number of actions required for each state to reach the goal state, and decide based on this. This way provides no guarantees, thus unbounded. It tends however, to be quite quick.

102
Q

If you are using A* or best first search and have a somewhat absurd need to reduce memory as much as possible, what can you do?

A

The problem with memory and A* is that nodes that are on the frontier are stored 2 places at once. We can avoid this by complicating the code and storing only in one space. The result is a slower algorithm and a terrible codebase.

103
Q

For the 8 puzzle, or the 15 puzzle, what are some candidates for good heuristic functions?

A

There are two common:

1) The number of misplaced tiles. It is easy to see that this is admissible. If (8 puzzle) all 8 tiles are out of position, it would AT LEAST require 8 moves. Therefore, when the heuristic spits out the value 8, it is a vast optimistic answer.

2) Manhattan distance. The sum of distances horizontally and vertically.

104
Q

Elaborate on the effective branching factor b*

A

The effective branching factor b* is a way of characterizing the performance of the heuristic.

The effective branching factor b* is the branching factor required to create a uniform tree with depth d such that the total amount of nodes in the tree is N+1, when N is the amount of nodes generated by the search.

Thus:
N+1 = 1 + b* + (b)^2 + … + (b)^d

Obviously, an effective branching factor close to 1 is good, as it would indicate a single path.

105
Q

Elaborate on effective depth

A

Like effective branching factor, effective depth is a way of characterizing the “goodness” of a heuristic. It is argued by Korf and Reid that effective depth is better than effective branching factor.

106
Q

What is a relaxed problem?

A

A relaxed problem is a problem with “fewer” restrictions on the actions.

107
Q

Consider a search algorithm. What is its input and what is its output?

A

Input is a search-problem, abstract problem. Recall what a problem must include.

Output is a path/solution path if one exists, or an indicaiton of failure, if a solution does not exist.

108
Q

IS there a difference between the state space and the search tree?

A

THe state space is a possibly infinttely large graph that consists of theoretically possible states. THe search tree is an exploration of a subset of the state space, and will only run until it reach a solution.

109
Q

Formally define a search problem

A

A search problem has the following description:

Initial state
State space
Actions(state)
Transition model (result(state, action))
isGoal(state)
action cost function: Action-Cost(s,a,s’)

The action cost function should supply values that reflect its own performance measure.

110
Q

Recall optimal solution

A

Optimal solution is the path with the best cost possible.

111
Q

What do we mean by “expanding” a node?

A

Exploring its children (actions).

112
Q

Whats the difference between a reached node and an expended node?

A

A reached node refers to a state that has a node generated for it. It becomes expanded when its children have been reached.

113
Q

Extremely short, describe the works of best-first-search

A

It keeps a queue (frontier) that is ranked on the basis of some evaluation function. It will while queue not empty pop an element, check for goal, if not goal it will expand it, and add the children to the priorityQueue that is ordered by the evaluation function. It maintains a reached table to keep the best path to every single state.

114
Q

Elaborate on the difference between open-loop systems and closed-loop systems and what they really represent

A

The loop term refers to whether or not the system is continually monitoring percepts. we say that the system is free from the loop if it doesn’t monitor percepts.

Different types of agents are suitable for both types. If the agent is operating in a difficult environment, and there is a chance that the agent’s model is incorrect, it is likely better to monitor percepts to develop the model, and thus utilizing a closed loop system, rather than an open loop system.

115
Q

What is the difference between a graph search and a tree-like search?

A

A graph search checks for redundant paths, while the tree-like search does not.

We say “tree-like” because it still search on a graph, not a tree. However, it acts like the graph has the properties of a tree which allows it to ignore the possibility of cycles.

116
Q

What is a property of consistent heuristics that is relevant for the running of A*

A

If A* use a consistent heuristic, the first time it reach a state, we know that it will always be on an optimal path, so we never have to re-add the node to the frontier and we never have to change an entry in reached.

117
Q

Consider best first searhc. In what cases would we add a node/state back to the frontier even though it has already been expended?

How about uniform cost search?

A

This is a case that happens if we find a new path leading to this state but with a better path cost. Because of the better path cost, it has to be explored again/expanded again because, with this new improved path, this path via this state could be the optimal one.

With UCS, we will NEVER expand a node multiple times. We may most likely IMPROVE the paht and the cost of the path WHILE the node is in the frontier, waiting to be popped, but we will never expand the node multiple times. This can be proved by contradiction. Let us say we find a path that reach some node better than previously. This would mean that this path was always better than the other one. If we expanded the node before, it means that this node held the best total path cost of all nodes in the frontier. Thereofre, as long as costs are positive and additive, we would have chosen the better path previously. Thus, it is not possible to expand a node multiple times.

The key is additive and positive costs.

118
Q

How does Best first search and UCS handle cycles?

A

They handle cycles by only adding nodes to the frontier if they have a total path cost that is BETTER than previously. This of course includes the cases where the nodes have never been REACHED.

So, even though the search state space is infinite, we can limit this by this technique.

Of course, if we know that the state space will not contain cycles, we dont need to keep a reached table at all, since the first time a state is reached, we KNOW it will be the best. This is the case with breadth first search. The technical term is a TREE-LIKE search. It is called TREE-“LIKE” because the search operate LIKE the graph is a tree, even though it is a graph.

119
Q

How do we measure time complexity? Consider breadth first search

A

We use m, the maximum depth, d, the depth of an optimal solution, and the branching factor b.

In BFS, the optimal solution will lie somewhere. It will expand exponentially until the layer that the solution is at. Therefore, it will expand b^d nodes. Therefore, this is the time complexity.

The space complexity is O(b^d) as well, because ALL of these nodes will always be in memory, due to the reached table. (table, not hashed structure).

120
Q

When would we ever use breadth first search? It sucks

A

We’d use it if we DESPERATELY need the OPTIMAL solution and all costs are equal, AND we dont have any heuristics.

The very second we dont need THE optimal solution, we’d use iterative deepening with depth limited.

121
Q

What is the obvious TERRIBLE part of UCS?

A

Without any sense of which “direction” to move in, it will only focus on low path cost before perhaps useful costs.

If the optimal solution is one step away but with a cost of 100, and the root is surrounded by long paths of low cost edges, it will explore all of these paths before the only one that works. The goal node could literally only be connected directly to the root, and it would test this LAST.

122
Q

Elaborate on the running time of UCS

A

UCS performs shit whenver the solution path is FAR AWAY from the root (in terms of cost) and the cost of single actions can be very small. So, if the indiviual actions’ costs are very small compared to the total path cost of the optimal solution, the UCS will suck.

O(b^(1+floor(C*/epsilon)))

123
Q

How does Depth Limited search handle cycles?

A

There are basically 2 ways:

1) Check a few steps back up using parent pointers to find out

2) Let them be caught by the depth limit.

124
Q

What is the preferred choice of UNINFORMED search when the state space is larger than can fit in memory and the depth of the solution is not known?

A

Iterative deepening with depth limited.

The memory problem is a big reason for this. Branching factor of 5 gives us approximately max depth of 11.

125
Q

What is the value from the fact that A* search use a consistent heuristic?

A

Consistency on a heuristic with A* search means that A* search will only reach a state ONCE. If we reach a state, we know it is on the optimal path.

126
Q

Consider uniform cost search, and then consider what makes it bad.

Recall that UCS is bad because it has NO IDEA what direction to search in.

Elaborate on why A* is so much better

A

A* is better because of the heuristic. As long as the heuristic never overestimates, we get an optimal solution.

Recall that when we apply the evaluation function f(n)=g(n)+h(n), we calculate the sum of the total path cost from root to node n, and the estimated distance from n to goal. tehrefore, if n is the goal, it will only consider the cost.

The heuristic gives a very large weight on the estimate of the distance left. So, if the cost-step of the action is very small, we know that UCS is likely to try it first. However, A* will consider the fact that this action actually moves in the wrong direction, and thus NOT expand it.

127
Q

what is a consistent heuristic, and why is it important?

A

A consistent heuristic has the following property:

h(n) <= c(n,a,n’) + h(n’)
This is a triangle inequality.

It says that the heuristic value from a node n MUST be smaller than or equal to the heuristic value of a neughboring state/node + the cost of moving there.

Consistency gives A* the property of only reaching nodes ONCE. meaning, every time we reach a node, we know it will be on the optimal path to that node.

128
Q
A