







































Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!








































Many AI problems can be solved by exploring the solution space: it contains all possible sequence of actions that might be applied by an agent. some of these sequences lead to a solution The agent examines alternative sequence of actions that lead to know state and chooses the best one, this procces is called Search. The search process can be seen as a tree whose node are states and branches are operators or actions. A search alorithm take as input a probelm and returns a solution in form of a sequence of actions. In general we use constructive algorithm: we expand the current state until we found a solution. Once the solution is found, the action found can be performed. this is called execution usually search done off-line, before execution terminology
In general to solve a seach problem we need to define the state, all possible operators that can be performed and its associated cost, the inital state and the goal states. NODE Each node in the search tree corresponds to a data structure contains:
time: , is the maximum deoth parameter Memory ITERATIVE DEEPENING perfrom iteratively a limited depth search starting with maximum depth=0 and adding 1 at each new search performed. There are nodes in the tree that are expanded multiple time due to ther estarting of the search. but asymptotically has the same time of breadh-first combine the memory advantege of depth first, and the completeness of the breadth first Complete: yes Optimal: yes if step cost equal one Space: Time: BIDIRECTIONAL SEARCH start a forward search strategy from the inital state and a backward search strategy from the goal state. stop when the fringe in the backward part is equal or is a subset of the fringe of the froward part. Complete: if both direction use breadh first strategy Optimal: if both direction use breadh first strategy and step unit costs. time and memory:
Use knowledge about the problem in order to reduce the combinatorial explosion. In order to selct which nodes to expand we use an evaluation function. evaluation functions : evaluation function that gives a computational estimate of the effort to reach the final state.
the time use to evaluate a node should reduce the size of the space to explore, usually there is rade off between time to compute the heuristics and the time it takes to solve the problem. we have to consider that the time spent to compute the hueristcs could be used to search for the solution, this is the trade off. Evaluation function: estimate the cost from the given node to the goal BEST SEARCH Expand the node with smaller evaluation function value. the choice of the evaluation function. usually the evaluation function contains a component calld heuristic functions = estimate of the chepaest path from the current state n to the goal state. if n is a goal state, then the heuristics must be 0. the informed best search strategy depends on the evaluation function used to elect the ndoe to expand. GREEDY BEST-FIRST The evaluation function is composed only by the heuristics function, expan node that seem closer to the goal Optimal: no, try to find as soon as possible a node with 0 evaluation functions, and not the node with lowest path cost. Complete: no, like deepth first, can be stucked in loop time and complexity: , but can be drastically reduced by the heuristic function A STAR ALGORITHM the evaluation function is composed by the path cost to reach the node and the heuristic function admissible heuristics an heuristics is admissible if the estimated cost is less then the true cost.
the heursitc is consistent if for each node n1 and any succesr n2 genrerted by an action a: if n is a goal state If the heurstic is consitent then the A star on graph is optimal. the tree search for A star is optimal if the heuristic is admissible, whule the graph version is optimal if the heuristic is consistent A consistent heuristc implies an admissible heuristc, consistency is a much stronger property.
Local search algorithms start from the initial solution (can be unfeasible) and iteratively try to improve it through local moves, defined in a neighborhood. Local search is done when the path to reach a goal is not important and when we can determine if state is solution or not by looking at its description. Neighborhood structure Assigns to every a set of neighbors. is called neighborhood. neighborhood graph : graph that depend on local move you are using, define the solution that you can obtain from current state with one local move. HILL CLIMBING Very basic local search algorithm. A move is performed only if the solution it produces is better than the current solution. It stops as soon as it finds a local minimum. This one of its main drawbacks, as it doesn't effectively explore the search space. Moreover, it doesn't remember the states already reached. It's like " climbing Everest in a thick fog with amnesia ".There are severial variants. it is dependent from the starting point. A local optima is a solution such that it is the best one among any other solutions belonging to its neighborhood. when we solve optmization problem we want to find the global optimum. The larger the neighbourhood the higher quality is the solution. A problem with local optima is that it represents the best solution in the neighborhood but it could be worst than other local optima. We can also incur in plateaus , flat regions where the states have the same value: in this case we don't know in which direction to move. Ridges are ... (ask prof ??? )
A metaheuristic is a high-level problem-independent algorithmic framework that guides the search process. Two major components of any metaheuristic algorithms are: intensification and diversification. Diversification means to generate diverse solutions so as to explore the search space on a global scale, while intensification means to focus the search in a local region knowing that a current good solution is found in this region. Intensification ensures that solutions will be near an optimum, while diversification via randomization allows the search to espace from local optima and, at the same time, increases the diversity of solutions. metaheurstic is not an exact method, usually finds good enough solution in relative small amount of time, that would not be find by exact method due the complexity of the problem. meta-heuristcs overcome probelm of classic local search method like get stuck in local optima. metaheuristc can be dividid in:
Population based metaheuristics are inspired by natural processes like natural evolution and social insects foraging behaviors. It's based on the basic principle of learning correlations between good solution components, achieved by evolving a set of points in the search space. Genetic Algorithms are inspired by evolution. There are three key components: adaptation: organisms are suited to their habitats inheritance: offspring resemble their parents. The fittest individuals have a higher chance of having numerous offspring. Children are similar, not equal to their parents. The traits characterizing the fittest individuals spread across the population, generation by generation. natural selection: new, adapted types of organisms emerge and those that fail to change adequately are subject to extinction. GAs are not meant to simulate the biological evolutionary processes, but rather aimed at exploiting these key concepts for problem solving. A population is the set of individuals or solutions, individuals are also called genotypes. Genotypes are made of units calledd genes , the domain of a vlaue of a gende is composed of alles The offspring creation phase uses multiple operators:
Genetical Algorithms can result in a good strategy for many problems for its simplicity and its general purpose design, but sometimes its genetic operators are too simple. Local search-based algorithms are preferred when :
Swarm Intelligence is an artificial intelligence technique based on the study of many individuals that coordinate using decentralized control and self-organization. SI systems typically consists of a population of simple agents interacting locally with one another and their environment. Although there is normally no centralized control dictating how each individual agent should behave, local interactions between such agents often lead to the emergence of a global behaviour. human inspiration There is a theory stating that human intelligence is the result of social interactions, as we evaluate, compare and imitate other individuals, learn from experience emulating the successful behaviour of others, enabling us to adapt to complex environments and situations through the discovery of optimal patterns, belief and behaviors. Thus, culture and cognition could be considered as consequences of human social choices, where a culture emerges when individuals become similar through a process of social learning. Propertis The typical swarm intelligence system has the following properties:
ant colony is a sthocastic process on a fully connected graph called construction graph :
Evaporation is applied both time: after ceratin time step, the current phermone become less intense. Deamon actions Centralized actions, that can not be performed by the ants, usually a local search is done on the solution in order to decide to leave additional phermone to guide the search from a gloabal perspective
The model consists of three essential components: employed and unemployed foraging bees, and food sources. The first two components, employed and unemployed foraging bees, search for rich food sources, which is the third component, close to their hive. The model also defines two leading modes of behaviour which are necessary for self-organizing and collective intelligence: recruitment of foragers to rich food sources resulting in positive feedback and abandonment of poor sources by foragers causing negative feedback. the artificial bees randomly discover a population of initial solution vectors and then iteratively improve them by employing the strategies: moving towards better solutions by explore a local neighborhood of the food source while abandoning poor solutions. algorithm there are 3 groups of bees:
In particle swarm optimization, simple software agents, called particles , move in the search space of an optimization problem. The position of a particle represents a candidate solution to the optimization problem at hand. Each particle searches for better positions in the search space by changing its velocity according to rules originally inspired by behavioral models of bird flocking. idea : each individual move and sample the solution space and take infotrmation of the best solutionf found from its neighborhood Exploration is achieved by individual agents that search for the best solution (food source) in their neighborhood, determined by their position, which is initially assigned randomly according to a uniform distribution. The search is performed by the movement of each particle, where the movement is guided by the best position found so far in search space, which is updated when better solutions are discovered. To evaluate each position a fitness function (or cost function) is used. Exploitation is then achieved by taking advantage of other searches toward promising regions, as other successful behaviors influence the search direction of each individual. To avoid getting stuck in a local minimum, the swarm is divided into sub-groups and information is spread only within the sub- group. To guarantee global spread of information each particle is part of more sub-groups. proximity individuals are effected by the best solution found from other individuals that are closer to them. algorithm initialize a population of candidate solutions (paeticles) randomly at each step move each particles in the serach space based on:
All these swarm intelligence algorithms require an accurate parameter tuning activity, which is a tedious and error prone operation. In fact, it's hard to find the optimal parameter configuration. this method are never complete! no optimal or feasible solution guarantee. All the solution found using local search or population based can be found in the search tree.
Games are multi-agent environment that has to account for the presence of an opponent, and we do not know how the oppenent behave. the player in games can be 2 or more but we do not know haw the opponents behave. we consider only games with following properties:
if the search space is huge we have to prune the tree, we can not explore all the tree, if is the branch and is the depth then the elaf are. we have to apply the min-max algo up to certain node and then apply an evaluation function to the leaf in which we stop. This evaluation function must be fast to compute, else the time i spent to compute the evaluation i could use it for search. If the evaluation function is perfect, i would stop at the first level evaluate the ndoe and oick the best action, but we do not have a perfect evaluation function. What happen if evaluation function of other player is different from my? you have to think that a good move for me is a bad for the opponent. So we consider the evaluation only from one player perspective and if the root node is a max, all the eval function are given by the max eval function because we do not know the eval function of the opponent. the opponent will try to minimize my evaluation function. Stop after few iterations How we decideto expand a node or not? we could set a maximum depth for all the tree or we can explore first the most promising action until a certain depth or until the evaluation function does not change a lot and then search for the not promising action, but stop the search for them until a few iterations sometimes we can also search more for moves that seem complicated, so move that have an high variance in the evalution function, so evalute it with an higer depth, the problem is that this moves can be useless, so we extend the tree for level grater than p, but the search is useless. so in general we explore the tree until a certian level, stop the search, compute the evaluation function on each leaf and propagate the values back. alpha beta cut The type of evaluation we have seen so far consider also moves and nodes that will never occur. If I found a move that is better than all the possible moves i can do in certain node, then i can stop to seach along this path because all the possible moves i can do from the current state will never influence the choice make at root level. We can explot this concept to reduce the search space. idea behind alpha-beta cut: Consider a node in the tree, if the player had a better choice (call it ), in the parent node level or at any point along the current path, then will never be selected, so we cut this path and stop search along this way.
we call alpha the best value found on the path for MAX, and beta the best value found on the path for MIN, the algorithm cut the branch using this two value since there is no way of finding a best value along the current path, no matter which is the evaluation of the node along this path. alpha and beta are values that store the current best value you can chose in a given path rules of cutting