**a)** In online search, an agent interleaves the computation with action, first an action is taken and then the next action is computed.

In online search problem, assume a deterministic, fully observable environment. The agent knows:

• Action(s)- the list of actions which are followed to reach from the source state to the goal state.

• Step-cost function-it involves the cost involved in executing each action.

• Goal Test

The main objective is to reach the goal state while minimizing the cost and the cost is the total path cost of the path travelled by the agent.

The online search problem can be viewed as an offline search space. The belief state is a set of all possible wall configurations. There are 12 possible locations for the internal walls so there are = 4096 configurations.

The agent can be in any of 9 different squares, so there are belief states.

After few percepts and actions, the agent learns about the locations of new wall. The huge space can be represented in compact form.

So, the initial belief states are , the space of belief states is

**b)** The distinct percepts which are possible in the initial state are: LEFT, RIGHT, UP and DOWN. The percepts LEFT and DOWN are illegal but the states UP and DOWN can be legal or not.

**c)** The first few branches of a contingency plan for this problem are as follows:

The agent does not know about the walls and perceives all adjacent walls. The diagram starts with 4 possible states. The agent is aware that which action is legal and there are up to 3 binary percepts, so 8 states can be formed.

The complete plan size is because the longest plan when the goal state can be reached is 13.