soft computing unit 1 by varun

Upload: varun-galar

Post on 03-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Soft Computing Unit 1 by Varun

    1/29

    By varun galar

    Soft Computing

    Unit - 1

    Jan 2013

  • 7/28/2019 Soft Computing Unit 1 by Varun

    2/29

    2

    Table of contents

    1 1. Soft Computing .......................................................................................... 4

    1.1 Introduction of Soft Computing ................................................................................................... 4

    1.2 Soft Computing Vs Hard Computing ........................................................................................... 5

    1.3 Various types of Soft Computing ................................................................................................ 6

    1.4 Soft Computing Applications ...................................................................................................... 7

    2. Artificial Intelligence ................................................................................................ 8

    2.1 Introduction:- .................................................................................................................................... 8

    2.2 Production System ............................................................................................................................ 9

    2.3 Search Techniques:- ....................................................................................................................... 11

    2.3.1 Depth First Search ....................................................................................................................... 12

    2.3.2 Breadth First Search .................................................................................................................... 14

    2.3.3 Hill Climbing Search .................................................................................................................... 16

    2.3.4 Best First Search ......................................................................................................................... 17

    2.3.5 A* Search Technique ................................................................................................................... 19

    2.3.6 AO* Search................................................................................................................................. 21

    2.3.7 Control Strategies ........................................................................................................................ 22

    2.4 Knowledge Representation Issues .................................................................................................. 23

    2.5 Propositional and predicate logic..................................................................................................... 24

    2.6 Forward and Backward Reasoning ................................................................................................. 25

    2.7 Natural Language Processing(NLP) ................................................................................................ 27

  • 7/28/2019 Soft Computing Unit 1 by Varun

    3/29

    3

    Table of exhibits

    Exhibit 1: Soft computing VS Hard Computing..5

    Exhibit 2: Types Of Production System9

    Exhibit 3: Forward vs Backward Reasoning..26

  • 7/28/2019 Soft Computing Unit 1 by Varun

    4/29

    4

    1 1. Soft Computing

    1.1 Introduction of Soft Computing

    Soft computing is a term applied to a field of computer science with the aim of exploiting the

    robustness,good report with reality,low cost solution,uncertainty and partial truth to obtain tractability and

    tolerance of imprecision. It is the fusion of methodologies that were designed to model and enable solutions

    to real world problems, which are not modeled, or too difficult to model, mathematically. The principal

    constituents of soft computing are fuzzy logic, neurocomputing, and probabilistic reasoning, with the latter

    subsuming genetic algorithms, belief networks, chaotic systems, and parts of learning theory. fuzzy logic is

    mainly concerned with imprecision and approximate reasoning; neurocomputing with learning and curve-

    fitting; and probabilistic reasoning with uncertainty and belief propagation".Its goal is to attempt to match the

    human brain as near as possible.Soft computing would cover all the advangates of different soft computing

    componenets.

    Figure 1 Soft Computing

    Soft Computing is a new multidisciplinary field that was proposed by Dr. Lotfi Zadeh, whose goal was to

    construct new generation Artificial Intelligence, known as Computational Intelligence. The idea of SoftComputing was initiated in 1981 when Dr. Zadeh published his first paper on soft data analysis. Since then,

    the concept of Soft Computing has evolved. Dr. Zadeh defined Soft Computing in its latest incarnation as the

    fusion of the fields of Fuzzy Logic, Neuro-computing, Evolutionary and Genetic Computing, and Probabilistic

    Computing into one multidisciplinary system. The main goal of Soft Computing is to develop intelligent

    machines and to solve nonlinear and mathematically unmodelled system problemsIn effect, the role model

    for soft computing is the human mind.

    .

  • 7/28/2019 Soft Computing Unit 1 by Varun

    5/29

    5

    1.2 Soft Computing Vs Hard Computing

    S.no Soft computing Hard computing

    1. Soft computing differs from conventional (hard)

    computing in that, unlike hard computing, it is

    tolerant of imprecision, uncertainty, partial truth,and approximation. In effect, the role model for

    soft computing is the human mind.

    Hard computing, i.e., conventional computing,

    requires a precisely stated analytical model and

    often a lot of computation time.

    2. Soft computing based on fuzzy logic, neural nets

    and probabilistic reasoning.

    Hard computing based on binary logic, crisp

    systems, numerical analysis and crisp software.

    3. Soft computing has the characteristics of

    approximation and dispositionality.

    Hard computing has the characteristics of

    precision and categoricity

    4. In soft computing the tolerance for imprecision and

    uncertainty is exploited to achieve tractability,

    lower cost, high Machine Intelligence Quotient(MIQ) and economy of communication

    In hard computing, imprecision and uncertainty

    are undesirable properties

    5. Soft computing can evolve its own programs Hard computing requires programs to be

    written.

    6. Soft computing can use multivalued or fuzzy

    logic

    Hard computing uses two-valued logic.

    7. Soft computing incorporates stochasticity Hard computing is deterministic.

    8. Soft computing can deal with ambiguous and

    noisy data

    Hard computing requires exact input data

    9. Soft computing allows parallel computations Hard computing is strictly sequential

    10. Soft computing can yield approximate answers Hard computing produces precise answers

    11. It uses Soft constraints It uses Real-time constraints

    12. It need robustness rather than accuracy. It need accuracy and precision in calculations

    and outcomes.

    13. It is useful for routine tasks that are not critical It is useful in critical systems.

    Table 1. Soft computing VS Hard Computing

    Figure 2: Soft and Hard Computing

  • 7/28/2019 Soft Computing Unit 1 by Varun

    6/29

    6

    1.3 Various types of Soft Computing

    The various types of Soft Computing techniques are as follows:-

    1,Neural Network

    2.Fuzzy Logic

    3.Genetic Algorithm

    1.3.1 Neural Network:-

    It is a mathematical model inspired by biological neural networks. A neural network consists of an

    interconnected group of artificial neurons, and it processes information using a connectionist approach to

    computation. In most cases a neural network is an adaptive system that changes its structure during a learning

    phase. Neural networks are used to model complex relationships between inputs and outputs or to find

    patterns in data.

    The inspiration for neural networks came from examination of central nervous systems. In an artificial neural

    network, simple artificial nodes, called "neurons", "neurodes", "processing elements" or "units", are connected

    together to form a network which mimics a biological neural network.

    1.3.2. Fuzzy Logic:-

    It is a form of many-valued logic derived from fuzzy set theory to deal with reasoning that is fluid or

    approximate rather than fixed and exact. In contrast with "crisp logic", where binary sets have two-valued logic,

    fuzzy logic variables may have a truth value that ranges in degree between 0 and 1.

    In simple words we can say fuzzy logic is a super set of conventional (Boolean) logic that has been extended

    to handle the concept of partial truth--the truth values between completely true and completely false.

    3.Genetic Algorithms:-

    A genetic algorithm (or GA) is a search technique used in computing to find true or approximate

    solutions to optimization and search problems.

    Genetic algorithms are categorized as global search heuristics.

    Genetic algorithms are a particular class of evolutionary algorithms that use techniques inspired by

    evolutionary biology such as inheritance, mutation, selection, and crossover (also called

    recombination).

    Genetic algorithms are so powerful that they can exhibit more efficiency if programmed perfectly.

    Applications include learning Robot behavior, molecular structure optimization, automated design of

    mechatronic systems, and electronic circuit design.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    7/29

    7

    1.4 Soft Computing Applications

    Heavy industry

    o Matsushita, Siemens

    o robotic arms, humanoid robots

    Home appliances

    o Canon, Sony, Goldstar, Siemens

    o washing machines, ACs, refrigerators, cameras

    Automobiles

    o Nissan, Mitsubishi, Daimler-Chrysler, BMW, Volkswagen

    o Travel Speed Estimation, Sleep Warning Systems, Driver-less cars

    Spacecrafts

    o NASA

    o Manoeuvering of a Space Shuttle(FL), Optimization of Fuel-efficient Solutions for a

    Manoeuvre(GA), Monitoring and Diagnosis of Degradation of Components andSubsystems(FL), Virtual Sensors(ANN)

  • 7/28/2019 Soft Computing Unit 1 by Varun

    8/29

    8

    2. Artificial Intelligence

    2.1 Introduction:-

    A.I. can be define as the artificial brain having capability of thinking and understanding.

    A.I. is branch of computer science concerned with the study and creation of computer system that

    exhibits some form of intelligence

    AI is the process to make computers do things which, at the moment, people do better.

    AI is the study and design of intelligent agents, where an intelligent agent is a system that perceives

    its environment and takes actions that maximize its chances of success.

    The definitions of AI gives four possible goals to pursue :

    1. Systems that think like humans.

    2. Systems that think rationally.

    3. Systems that act like humans

    4. Systems that act rationally

    Various techniques that have evolved, can be applied to a variety of AI tasks.The techniques are

    concerned with how we represent, manipulate and reason with knowledge in order to solve problems.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    9/29

    9

    2.2 Production System

    An Artificial Intelligence System developed for solution of any problem is called Production System.Once the

    problem is defined, analyzed and represented in a suitable formalism. The Production System is used for

    application of rules and obtaining the solution.

    A production systemconsists of four basic components:

    1. A set of rulesof the form Ci Aiwhere Ciis the condition part and Aiis the action part. These rules are

    interpreted as follows: given condition, Ci, take action Ai. The condition determines when a given rule is

    applied, and the action determines what happens when it is applied.

    2. One or more know ledge databasesthat contain whatever information is relevant for the given problem.

    Some parts of the database may be permanent, while others may temporary and only exist during the solution

    of the current problem. The information in the databases may be structured in any appropriate manner.

    3. A control strategythat determines the order in which the rules are applied to the database, and provides a

    way of resolving any conflicts that can arise when several rules match at once.

    4. A rule applierwhich is the computational system that implements the control strategy and applies the rules.

    Four classes of production systems:-

    1. A monotonic production system

    2. A non monotonic production system

    3. A partially commutative production system

    4. A commutative production system.

    Table 2 : Types Of Production System

    Production systems describe the operations that can be performed in a search for a solution to the

    problem.

    They can be classified as follows.

    Monotonic production system :- A system in which the application of a rule never prevents the later

    application of another rule, that could have also been applied at the time the first rule was selected.

    Partially commutative production system:-A production system in which the application of a particular sequence of rules transforms state X into

    state Y, then any permutation of those rules that is allowable also transforms state x into state Y.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    10/29

    10

    Theorem proving falls under monotonic partially communicative system. Blocks world and 8 puzzle

    problems like chemical analysis and synthesis come under monotonic, not partially commutative

    systems. Playing the game of bridge comes under non monotonic , not partially commutative system.

    For any problem, several production systems exist. Some will be efficient than others. Though it may

    seem that there is no relationship between kinds of problems and kinds of production systems, inpractice there is a definite relationship.

    Partially commutative , monotonic production systems are useful for solving ignorable problems. These

    systems are important for man implementation standpoint because they can be implemented without the

    ability to backtrack to previous states, when it is discovered that an incorrect path was followed. Such

    systems increase the efficiency since it is not necessary to keep track of the changes made in the search

    process.

    Monotonic partially commutative systems are useful for problems in which changes occur but can be

    reversed and in which the order of operation is not critical (ex: 8 puzzle problem).

    Production systems that are not partially commutative are useful for many problems in which irreversible

    changes occur, such as chemical analysis. When dealing with such systems, the order in which

    operations are performed is very important and hence correct decisions have to be made at the first time

    itself.

    Advantages of production systems:-

    1. Production systems provide an excellent tool for structuring AI programs.

    2. Production Systems are highly modular because the individual rules can be added, removed or modified

    independently.

    3. The production rules are expressed in a natural form, so the statements contained in the knowledge base

    should the a recording of an expert thinking out loud.

    Disadvantages of Production Systems:-

    One important disadvantage is the fact that it may be very difficult analyse the flow of control within aproduction system because the individual rules dont call each other.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    11/29

    11

    2.3 Search Techniques:-

    Search refers to the search for a solution in a problem space.

    Search proceeds with different types of search control strategies.

    Search is fundamental to the problem-solving process.

    Search is a general mechanism that can be used when more direct method is not known.

    There are two types of search Techniques:-

    Uninformed search algorithms or Brute-force algorithms search, through the search

    space, all possible candidates for the solution checking whether each candidate satisfies

    the problem's statement.

    Informed search algorithms use heuristic functions, that are specific to the problem,

    apply them to guide the search through the search space to try to reduce the amount of

    time spent in searching.

    Example ofUninformed search are

    Depth First Search

    Breadth First Search

    Example ofInformed Search are

    Hill Climbing

    Best First Search

    A* Search

    AO* Search

  • 7/28/2019 Soft Computing Unit 1 by Varun

    12/29

    12

    2.3.1 Depth First Search

    A search strategy that extends the current path as far as possible before backtracking to the last

    choice point and trying the next alternative path is called Depth-first search.

    DFS is an uninformed search that progresses by expanding the first child node of the search tree that

    appears and thus going deeper and deeper until a goal node is found, or until it hits a node that has

    no children. Then the search backtracks, returning to the most recent node it hasn't finished exploring.

    In a non-recursive implementation, all freshly expanded nodes are added to a stack for exploration.

    Depth first search works by taking a node, checking its neighbors, expanding the first node it finds

    among the neighbors, checking if that expanded node is our destination, and if not, continue exploring

    more nodes.Depth First Search uses last-in first-out stack for keeping the unexpanded nodes.

    More commonly, depth-first search is implemented recursively, with the recursion stack taking the

    place of an explicit node stack.

    This procedure finds whether the goal can be reached or not but the path it has to follow has not been

    mentioned. Diving downward into a tree as quickly as possible performs DFS searches.

    This strategy does not guarantee that the optimal solution has been found.

    In this strategy, search reaches a satisfactory solution more rapidly than breadth first, an advantage

    when the search space is large.

    ALGORITHM: Depth First Search

    Put the root node on a stack;

    while (stack is not empty)

    { remove a node from the stack;

    if (node is a goal node) return success;

    put all children of node onto the stack; }

    return failure;

    Example of Depth First Search

    Let us take a example of searching of a lost Car keys at home.In this car key example, the BFS search orderfollows node sequence: 1, 2, 3, 4, 5 and so on in Depth -first order.

    I'll start with the Room 1 . If I can't see them at a glance, I should check in the wardrobe 1: I can't see my key,

    but there are some clothes. These trousers? Nothing in the pockets but some old wallet... Maybe inside the

    wallet? No. What else is there in the wardrobe? Check everything thoroughly.Then I will check desk 1.After

    completely elliminating any possibility that the keys might be in the Room 1, I'll move on to the next room i.e.

    Room2. Once I start checking the hallway in such minute detail, one item at a time, I will find them inside thecoat, after I start inspecting the rack

    This way Depth First Search works

    Depth-first traversal: Home Room AWardrobe 1 Desk 1 Wardrobe 2 CAR KEY

  • 7/28/2019 Soft Computing Unit 1 by Varun

    13/29

    13

    ADVANTAGES OF DEPTH-FIRST SEARCH

    1. The advantage of depth-first Search is that memory requirement is only linear with respect to thesearch graph. This is in contrast withbreadth-first search which requires more space. The reason is thatthe algorithm only needs to store a stack of nodes on the path from the root to the current node.

    2. The time complexity of a depth-first Search to depth d is O(b^d) since it generates the same set ofnodes as breadth-first search, but simply in a different order. Thus practically depth-first search is time-limited rather than space-limited.

    3. If depth-first search finds solution without exploring much in a path then the time and space it takeswill be very less.

    DISADVANTAGES OF DEPTH-FIRST SEARCH

    1. The disadvantage of Depth-First Search is that there is a possibility that it may go down the left-mostpath forever. Even a finite graph can generate an infinite tree.

    2. Depth-First Search is not guaranteed to find the solution.

    3. And there is no guarantee to find a minimal solution, if more than one solution exists

  • 7/28/2019 Soft Computing Unit 1 by Varun

    14/29

    14

    2.3.2 Breadth First Search

    Breadth-first search (BFS) technique is a systematic search strategy which begins at an initial node

    (an initial state) and from the initial node search actions are applied downward on a tree structure in a

    breadth-wise order.

    The search generates all nodes at a particular level before proceeding to the next level of the tree.

    The search systematically proceeds testing each node that is reachable from a parent node before it

    expands to any child of those nodes.

    In this strategy, no viable solution is omitted and therefore guarantee that optimal solution is found.

    BFS is often not feasible when the search space is large.

    The search action consists of:

    1. Selecting a node as a current node

    2. Testing the current node for meeting the goal test criteria

    3. If the goal state is not reached, select the next node in a breadth-wise order

    4. The search ends either when all the nodes have been searched or if the goal has been found.

    ALGORITHM: BREADTH-FIRST SEARCH

    Put the root node on a queue;

    while (stack is not empty)

    { remove a node from the queue;

    if (node is a goal node) return success;

    put all children of node onto the queue; }

    return failure;

    ADVANTAGES OF BREADTH-FIRST SEARCH

    1. Breadth first search will never get trapped exploring the useless path forever.

    2. If there is a solution, BFS will definitely find it out.

    3. If there is more than one solution then BFS can find the minimal one that requires less number of

    steps.

    DISADVANTAGES OF BREADTH-FIRST SEARCH

    1. The main drawback of Breadth first search is its memory requirement. Since each level of the treemust be saved in order to generate the next level, and the amount of memory is proportional to the

    number of nodes stored, the space complexity of BFS is O(bd). As a result, BFS is severely space-

    bound in practice so will exhaust the memory available on typical computers in a matter of minutes.

    2. If the solution is farther away from the root, breath first search will consume lot of time.

    Example of BFS Search

  • 7/28/2019 Soft Computing Unit 1 by Varun

    15/29

    15

    In the car key example, the BFS search order follows node sequence: 1, 2, 3, 4, 5 and so on in breadth -

    first order.

    The BFS search will first go through all the rooms, then all the desks, then all the drawers in that sequence.

    Breadth First Traversal:

    Home Room ARoom BRoom CWardrobe 1Desk 1Wardrobe 2Car Keys

  • 7/28/2019 Soft Computing Unit 1 by Varun

    16/29

    16

    2.3.3 Hill Climbing Search

    Hill Climbing Search Technique is a variety of depth-first (generate - and - test) search. A feedback is used

    here to decide on the direction of motion in the search space. In the depth-first search, the test function will

    merely accept or reject a solution. But in hill climbing the test function is provided with a heuristic function

    which provides an estimate of how close a given state is to goal state

    Hill climbing is an optimization technique for solving computationally hard problems. It is best used in problems

    with the property that the state description itself contains all the information needed for a solution. The

    algorithm is memory efficient since it does not maintain a search tree: It looks only at the current state and

    immediate future states.

    Hill climbing attempts to iteratively improve the current state by means of an evaluation function. Consider all

    the [possible] states laid out on the surface of a landscape. The height of any point on the landscape

    corresponds to the evaluation function of the state at that point

    In contrast with other iterative improvement algorithms, hill-climbing always attempts to make changes that

    improve the current state. In other words, hill-climbing can only advance if there is a higher point in the

    adjacent landscape.

    Hil climbing is an example of an informed search method because it uses information about the search space

    to search in a reasonably efficient manner. Hill Climbing is like climbing Everest in thick fog with an altimeter

    without map and having problem of amnesia(i.e. loss of memory)

  • 7/28/2019 Soft Computing Unit 1 by Varun

    17/29

    17

    2.3.4 Best First Search

    The best-first search is a way of combining the advantages of both depth-first and breadth-first search.Best-

    first search, rather than plunging as deep as possible into the tree (as in depth-first search), or traversing eachlevel of the tree in succession (as in breadth-first search), uses a heuristic to decide at each stage which is the

    best place to continue the search.The best-first search can be implemented using priority queue.

    The depth-first search is good because it allows a solution to be found without all competing branches having

    to be expanded. Breadth-first search is good because it does not get trapped on dead ends of paths.The way

    of combining this is to follow a single path at a time but swiches between paths whenever some competing

    path looks more promising than the current one does.Hence at each step of best-first search process, we

    select most promising node out of successor nodes that have been generated so far.

    In Best-First search, the search space is evaluated according to a heuristic function. Nodes yet to be evaluated

    are kept on an OPEN list and those that have already been evaluated are stored on a CLOSED list. The

    OPEN list is represented as a priority queue, such that unvisited nodes can be dequeued in order of their

    evaluation function.

    The evaluation function f(n) is made up of two parts.

    These are the heuristic function (h( n )) and the estimated cost (g(n)), where

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

    We can think of the estimated cost as a value measurable from our search space, and the heuristic function as

    an educated guess. The OPEN list is then built in order of fl n ). This makes best-first search fundamentally

    greedy because it always chooses the best local opportunity in the search frontier

    The search frontier is defined as the set of node opportunities that can be searched next. In Best-First search,

    the fivntieris a priority queue sorted in f( n) order Given the strict order of f( n ), the selection of the node to

    evaluate from the priority queue is greedy.

    2.3.4.1 Algorithm for Best-First Search

    1. Use two ordered lists OPEN and CLOSED.

    2. Start with the initial node n0 and put it on the ordered list OPEN.

    3. Create a list CLOSED. This is initially an empty list.

    4. If OPEN is empty exit with failure.

    5. Select first node on OPEN. Remove it from OPEN and put it on CLOSED.Call this node n.

    6. If n is the goal node then terminate search with Success, else

    7. Expand node n. This will generate all the successors of node n.Find out the value of heuristic

    function of all nodes. Sort all the children generated so far on the basis of their utility value. Select the

    node of minimum heuristic value for further expansion

    8. Reorder the list OPEN according to the heuristic and go back to step 4.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    18/29

    18

    2.3.4.2 APPLICATIONS

    Best-first search and its more advanced variants have been used in such applications as games and web

    crawlers. In a web crawler, each web page is treated as a node, and all the hyperlinks on the page are treated

    as unvisited successor nodes. A crawler that uses best-first search generally uses an evaluation function that

    assigns priority to links based on how closely the contents of their parent page resemble the search query. In

    games, best-first search may be used as a path-finding algorithm for game characters. For example, it could

    be used by an enemy agent to find the location of the player in the game world. Some games divide up the

    terrain into tiles which can either be blocked or unblocked. In such cases, the search algorithm treats each

    tile as a node, with the neighbouring unblocked tiles being successor nodes, and the goal node being the

    destination tile

  • 7/28/2019 Soft Computing Unit 1 by Varun

    19/29

    19

    2.3.5 A* Search Technique

    Most widely used best first search form is called A*, which is pronounced as A star. It is a heuristic searchingmethod, and used to minimize the search cost in a given problem. It aims to find the least-cost path from a

    given initial node to the specific goal. It is an extended form of best-first search algorithm. Best first-search

    algorithm tries to find a solution to minimize the total cost of the search pathway, too. However, the difference

    from Best-First Search is that A* also takes into account the cost from the start, and not simply the local cost

    from the previously been node. Best-first search finds a goal state in any predetermined problem space.

    However, it cannot guarantee that it will choose the shortest path to the goal . For instance, if there are two

    options to chose from, one of which is a long way from the initial point but has a slightly shorter estimate of

    distance to the goal, and another that is very close to the initial state but has a slightly longer estimate of

    distance to the goal, best-first search will always choose to expand next the state with the shorter estimate.

    The A* algorithm fixes the best first searchs this particular drawback .

    In short, A* algorithm searches all possible routes from a starting point until it finds the shortest path or

    cheapest cost to a goal. The terms like shortest path, cheapest cost here refer to a general notion. It could be

    some other alternative term depending on the problem. For instance, in a map problem the cost is replaced by

    the term distance. This may reduce the necessity to search all the possible pathways in a search space, and

    result in faster solution. A* evaluates nodes by combining g(n) and h(n). In the standard terminology used

    when talking about A*:

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

    The purpose of this equation is to obtain the lowest f score in a given problem. n being node number crossed

    until the final node,

    f(n) is the total search cost, g(n) is actual lowest cost( shortest distance traveled) of the path from initial start

    point to the node n, h(n) is the estimated of cost of cheapest(distance) from the node n to a goal node. This

    part of the equation is also called heuristic function/estimation.

    At each node, the lowest f value is chosen to be the next step to expand until the goal node is chosen and

    reached for expansion. Whenever the heuristic function satisfies certain conditions, A* search is both complete

    and optimal

    Algorithm of A*

    1.The algorithm maintains two sets

    OPEN list: The OPEN list keeps track of those nodes that need to be examined.

    CLOSED list: The CLOSED list keeps track of nodes that have already been examined.

    2.Initially, the OPEN list contains just the initial node, and the CLOSED list is empty. Each node n maintains

    the following:

    g(n) = the cost of getting from the initial node to n.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    20/29

    20

    h(n) = the estimate, according to the heuristic function,of the cost of getting from n to the goal node.

    F(n) = g(n) + h(n); intuitively, this is the estimate of the best solution that goes through n.

    3. Each node also maintains a pointer to its parent, so that later the best solution if found can be retrieved. A-

    Star has a main loop that repeatedly gets the node, call it n, with the lowest f(n) value from the OPEN list. If n

    is the goal node, then we are done, and the solution is given by backtracking from n. Otherwise, n is removed

    from the OPEN list and added to the CLOSED list. Next all the possible successor nodes of n are generated.

    4. For each successor node n, if it is already In the CLOSED list and the copy there has an equal or lower f

    estimate, and then we can safely discard the newly generated n and move on. Similarly, if n is already in the

    OPEN list and the copy there has an equal or lower f estimate, we can discard the newly generated n and

    move on.

    Practical Applications of A*

    A* is the most popular choice for path finding, because it's fairly flexible and can be used in a widerange of contexts such as games (8-puzzle and a path finder).

    Bidirectional search

    Iterative deepening

    Beam search

    Dynamic weighting

    Bandwidth search

  • 7/28/2019 Soft Computing Unit 1 by Varun

    21/29

    21

    2.3.6 AO* Search

    AO* Search Procedure.

    1. Place the start node on open.

    2. Using the search tree, compute the most promising solution tree TP .

    3. Select node n that is both on open and a part of tp, remove n from open and place it no closed.

    4. If n is a goal node, label n as solved. If the start node is solved, exit with success where tp is the solution

    tree, remove all nodes from open with a solved ancestor.

    5. If n is not solvable node, label n as unsolvable. If the start node is labeled as unsolvable, exit with failure.

    Remove all nodes from open ,with unsolvable ancestors.

    6. Otherwise, expand node n generating all of its successor compute the cost of for each newly generated

    node and place all such nodes on open.

    7. Go back to step(2)

    Note: AO* will always find minimum cost solution.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    22/29

    22

    2.3.7 Control Strategies

    Search for a solution in a problem space, requires "Control Strategies" to control the search processes.

    Which rule to apply next?

    More than one rule will have its left side match the current state.

    The first requirement of a good control strategy is that it causes motion

    The second requirement of a good control strategy is that it be systematic.

    Construct a tree and weigh out the various options at each step.

    This is where BFS and DFS comes into use

    Heuristic Search can also be used

    The search control strategies are of different types, and are realized by some specific type of "Control

    Structures".

    Strategies for search

    Some widely used control strategies for search are stated below.

    Forward search: Here, the control strategies for exploring search proceeds forward from initial state

    to wards a solution;the methods are called data-directed. Backward search: Here, the control strategies for exploring search proceeds backward from a goal

    or final state towards either a solvable sub problem or the initial state; the methods are called goal

    directed.

    Both forward and backward search: Here, the control strategies for exploring search is a mixture

    of both forward and backward strategies .

    Systematic search : Where search space is small, a systematic (but blind) method can be used to

    explore the whole search space.One such search method is depth-first search andthe other is breath-

    first search.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    23/29

    23

    2.4 Knowledge Representation Issues

    The fundamental goal of Knowledge Representation is to facilitate inferencing (conclusions) from knowledge.

    The issues that arise while using KR techniques are many. Some of these are explained below.

    Important Attributes :

    Any attribute of objects so basic that they occur in almost every problem domain ?

    Relationship among attributes:

    Any important relationship that exists among object attributes ?

    Choosing Granularity :

    At what level of detail should the knowledge be represented ?

    Set of objects :

    How sets of objects be represented ?

    Finding Right structure :

    Given a large amount of knowledge stored, how can relevant parts be accessed ?

  • 7/28/2019 Soft Computing Unit 1 by Varun

    24/29

    24

    2.5 Propositional and predicate logic

    Propositional Logic:-

    The simplest form of logic is Propositional Logic. A proposition is a statement that is either true or false. A

    string of symbols separated by conjunctions (AND), disjunctions (OR) negations (NOT). Propositional Logic

    assumes that knowledge contains only facts. The truth of a statement is known, it becomes a premise that can

    be used to derive new propositions.

    Propositional logic is declarative

    Propositional logic allows partial/disjunctive/negated information

    (unlike most data structures and databases)

    Propositional logic is compositional:

    meaning of B1,1 U P1,2 is derived from meaning of B1,1 and of P1,2

    Meaning in propositional logic is context-independent

    (unlike natural language, where meaning depends on context)

    Propositional logic has very limited expressive power

    (unlike natural language)

    Predicate Logic:

    Language like representation of knowledge that facilitates inference using predicate calculus. Propositional

    logic is useful, but it has one big drawback: we cannot talk generally, but only about specific examples

    (propositions).

    A predicate is a proposition whose truth depends on the value of one or more variables.

    For example, n is a perfect square is a predicate whose truth depends on the value of n.

    A function like notation is used to denote a predicate supplied with specific variable values. P(n)=n is a perfect

    square

    P(4) is true and P(5) is false.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    25/29

    25

    2.6 Forward and Backward Reasoning

    2.6.1 Forward Reasoning: In a forward chaining system you start with the initial facts, and keep using the rules to draw new

    conclusions (or take certain actions) given those facts

    Forward chaining systems are primarily data-driven.facts in the system are represented in a working

    memory which is continually updated.Rules in the system represent possible actions to take when

    specified conditions hold on items in the working memory They are sometimes called condition-action

    rules. The conditions are usually patterns that must match items in the working memory.Actionsusually involve addingordeletingitems from the working memory. Interpreter controls the application

    of the rules, given the working memory, thus controlling the system's activity. It is based on a cycle of

    activity sometimes known as a recognize-actcycle

    The system first checks to find all the rules whose conditions hold selects one and performs the

    actions in the action part of the rule selection of a rule to fire is based on fixed strategies, known as

    conflict resolution strategies.Actions usually involve adding or deleting items from the working

    memory. Interpreter controls the application of the rules, given the working memory, thus controlling

    the system's activity. It is based on a cycle of activity sometimes known as a recognize-act cycle. The

    system first checks to find all the rules whose conditions hold selects one and performs the actions inthe action part of the rule. Selection of a rule to fire is based on fixed strategies, known as conflict

    resolution strategies

    Forward chaining may be better if you have lots of things you want to prove.

    Forward chaining like an exhaustive search.

    Forward chaining system, includes writing rules to manage sub goals.

    Lots of output Hypothesis + Lots of data up front => Use Forward Chaining

    2.6.2 Backward Reasoning:-

    In a backward chaining system you start with some hypothesis (or goal) you are trying to prove, and

    keep looking for rules that would allow you to conclude that hypothesis, perhaps setting new subgoals

    to prove as you go.

    You COULD keep on forward chaining until no more rules apply or you have added your hypothesis to

    the working memory but in the process the system is likely to do a lot of irrelevant work, adding

    uninteresting conclusions to working memory

    This can be done by backward chainingfrom the goal state (or on some hypothesized state that we

    are interested in). Note that a backward chaining system does NOTneed to update a working

    memory. Instead it needs to keep track of what goals it needs to prove its main hypothesis.

    Backward chaining may be better if you are trying to prove a single fact, given a large set of initialfacts, and where, if you used forward chaining, lots of rules would be eligible to fire in any cycle.

    Backward chaining is more focused and tries to avoid exploring unnecessary paths of reasoning.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    26/29

    26

    Backward chaining systems automatically manage sub goals.

    Fewer output Hypothesis + Must query for data => Use Backward Chaining.

    =

    Table 3.Forward vs Backward Reasoning

    Attribute Backward Reasoning Forward Reasoning

    Also known as Goal-driven Data-driven

    Starts from Possible conclusion New data

    Processing Efficient Somewhat wasteful

    Aims for Necessary data Any Conclusion(s)

    Approach Conservative/Cautious Opportunistic

    Practical if Number of possible final answers is

    reasonable or a set of known

    alternatives is available.

    Combinatorial explosion creates an

    infinite number of possible right answers.

    Appropriate for Diagnostic, prescription and

    debugging application

    Planning, monitoring, control and

    interpretation application

    Reasoning Top-down reasoning Bottom-up reasoning

    Type of Search Depth-first search Breadth-first search

    Who determine search Consequents determine search Antecedents determine search

    Flow Consequent to antecedent Antecedent to consequent

  • 7/28/2019 Soft Computing Unit 1 by Varun

    27/29

    27

    2.7 Natural Language Processing(NLP)

    Natural language is any language naturally used by humans such as English, French, or Japanese. NLP is a

    hallmark of human intelligence. Natural language processing (NLP) can be defined as the automatic (or semi-

    automatic) processing of human language. Natural-language-processing programs use artificial intelligence to

    allow a user to communicate with a computer in the user's natural language. The computer can both

    understand and respond to commands given in a natural language.So Natural Language Processing is a fieldof computer science and linguistics concerned with the interactions between computers and human

    languages. .NLP is also known as Computational Linguistics. NLP is used to get computers to perform useful

    tasks involving human language, tasks like enabling human-machine communication, improving human-

    human communication, or simply doing useful processing of text or speech.

    Computer languages are artificial languages, invented for the sake of communicating instructions to computers

    and enabling them to communicate with each other. Most computer languages consist of a combination of

    symbols, numbers, and some words. These languages are complex and may take years to master. By

    programming computers (via computer languages) to respond to our natural languages, we make them easier

    to use.

    Four problems arise that can cause misunderstanding:

    (1) Ambiguityconfusion over what is meant due to multiple meanings of words and phrases.

    (2) Imprecisionthoughts are sometimes expressed in vague and inexact terms.

    (3) Incompletenessthe entire idea is not presented, and the listener is expected to "read between the lines."

    (4) Inaccuracyspelling, punctuation, and grammar problems can obscure meaning.

    NLP covers a broad range of activities with the eventual goal of enabling people to communicate with

    machines using natural communication skills. It is the scientific study of language from a computational

    perspective.

    2.7.1Steps in Natural Language Processing:

    1) Morphological Analysis: Individual worlds are analyzed into their components and non word tokens, such

    as punctuation are separated from the words.

    2) Syntactic Analysis: Linear sequences of words are transformed into structures that show how the words

    relate each other. Some word sequences may be rejected if they violate the languages rules for how words

    may be combined.

  • 7/28/2019 Soft Computing Unit 1 by Varun

    28/29

    28

    3) Semantic Analysis: The structures created by the syntactic analyzer are assigned meanings.

    4) Discourse Integration: The meaning of an individual sentences may depend on the sentences that

    precede it and may influence the meanings of the sentence( may depend on the sentences that precede it)

    that follow it.

    5) Pragmatic Analysis: The structure representing what was said is reinterpreted to determine that what was

    actually meant. For example, the sentence Do you know what time it is? should be interpreted as a request

    to be told the time.

    In its simplest form, a natural language processing program works like this: a sentence is typed in on the

    keyboard; if the program can derive meaningthat is, if it has a reference in its knowledge base for every

    word and phraseit will respond, more or less appropriately.

    An example of a computer with a natural language processor is the computerized card catalog available inmany public libraries. The main menu usually offers four choices for looking up information: search by author,

    search by title, search by subject, or search by keyword. If you want a list of books on a specific topic or

    subject you type in the appropriate phrase. You are asking the computerin Englishto tell you what is

    available on the topic. The computer usually responds in a very short timein Englishwith a list of books

    along with call numbers so you can find what you need.

    One of the challenges inherent in natural language processing is teaching computers to understand the way

    humans learn and use language. Take, for example, the sentence "Baby swallows fly." This simple sentence

    has multiple meanings, depending on whether the word "swallows" or the word "fly" is used as the verb, whichalso determines whether "baby" is used as a noun or an adjective. In the course of human communication, the

    meaning of the sentence depends on both the context in which it was communicated and each persons

    understanding of the ambiguity in human languages. This sentence poses problems for software that must first

    be programmed to understand context and linguistic structures.

    2.7.2 NLP Applications

    Question answering

    Who is the first Indian president?

    Text Categorization/Routing

    e.g., customer e-mails.

    Text Mining

    Machine (Assisted) Translation

    Language Teaching/Learning

    Usage checking

    Spelling correction

  • 7/28/2019 Soft Computing Unit 1 by Varun

    29/29