Posts

Showing posts from February, 2017

Steepest Hill climbing/Best first search/A* Algorithm

Steepest Hill climbing differs from simple hill climbing by choosing the Best Successor rather than the first one.This indicates that it has elements of breadth first  search algorithm The Algorithm in a simplified manner is here  1.Evaluate the initial State. 2.If it is goal state than Quit otherwise make Initial state as the current state and proceed. 3 Repeat      set target to be the State that any Successor of the Current state can be better. 4.For (in a loop)  Each operator that can be applied in the Current State Apply new operator to new       state.if it is a goal state than Quit otherwise Compare with the Target state if better than set Current state to target state. Best First Search    We had BFS and DFS in DFS solution can be found without Computing the nodes and in BFS is good because it does not get trapped in dead ends. But for Best first search it takes the benefit of both the steps (DFS and BFS) takes the most step to be chosen . For exampl

DFS AND BFS TRAVERSAL (AI)

Image
The breadth first search (BFS) and the depth first search (DFS) are the two algorithms used for traversing and searching a node in a graph. They can also be used to find out whether a node is reachable from a given node or not.   Breadth First Search (BFS) Now we take an example of a problem in BFS that is how it works what are the operations we require in order to traverse a graph with the help of BFS. BFS means breath first search that is we can traverse the tree layerwise for example given in below    Here we have have nodes A in layer one nodes B,C,D in layer two nodes E and F in layer three. So now must be clear visiting the Nodes layerwise means what . For visiting a node we have queue maintaining the nodes which are visited . Now lets see the algorithm for BFS for this tree . At the first layer we have A so here by convention we consider A as already marked now search for all nodes which are adjacent to A . Probably we find adjacent nodes to A are B

Water Jug problem and TSP (Artificial intelligence Approach)

                                    Water Jug problem(production rules ) Now lets move upon water jug problem. In that ultimately we will have a amount of Water to play with and a jug. Lets begin. we have 2 jug say  1st --> a  liters of water. 2nd--> b  liters of water. target volume is say t liters of water. whats the problem now ..? what is our aim..? Our Aim is that we should fill the either of the Jug with t liters of water . Target is to achieve t liters of water either in jug 1 or Jug 2.  Problem is solvable when t is the multiple of gcd(a,b) and that can be modeled as a search through state space (explained in previous post what is state space). The state space search for this search procedure to work can be describe as the set of ordered pair of integers (x,y)such as x belongs to {0,1,2,3..a} and y belongs to {0,1,2,3,b}. The initial value is (0,0) and the goal value is (t,y) and(x,t) for all x ,y. Now the key is to generate the new st

State space search / blocks world problem by heuristic approach /TIC TAC TOE

A lot of AI is about SEARCH. The "state space" is the set of states of the problem we can get to by applying operators to a state of the problem to get a new state. A  state  contains  all of the information necessary to predict the effects of an action and to determine if it is a goal state. State-space searching assumes that the agent has perfect knowledge of the state space and can observe what state it is in (i.e., there is full observability); the agent has a set of actions that have known deterministic effects;some states are goal states, the agent wants to reach one of these goal states, and the agent can recognize a goal state. a solution is a sequence of actions that will get the agent from its current state to a goal state. Define the Problem as State Space Search Consider the problem of “Playing Chess” . to build a program that could play chess, we have to specify the starting position of the chess board, the rules that define legal moves. And the