Clase 3: Basic Concepts of Search. Problems: SAT, TSP. Tarea 1 Computación Evolutiva Gabriela Ochoa
Basic Concepts Representation: Encodes alternative candidate solutions for manipulation Objective: describes the purpose to be fulfilled Evaluation Function: returns a specific value that indicates the quality of any particular solution given the representation
Search Problem Definition: Given a search space S and its feasible part F in S, find x Є F such that eval(x) ≤ eval(y), for all y Є F (minimization) The point x that satisfies the above condition is called global solution The terms “search problem” and “optimization problem” are considered synonymous. The search for the best solution is the optimization problem
Boolean satisfiability problem (SAT ) An instance of the problem: is defined by a Boolean expression written using only AND, OR, NOT, variables, and parentheses. The question is: given the expression, is there some assignment of TRUE and FALSE values to the variables that will make the entire expression true? SAT is of central importance in various areas of computer science, including theoretical computer science, algorithmics, artificial intelligence, hardware design and verification. computer sciencetheoretical computer sciencealgorithmicsartificial intelligence
Computational Complexity of SAT SAT is NP-complete. In fact, it was the first known NP-complete problem, as proved by Stephen Cook in 1971NP-completeStephen Cook The problem remains NP-complete even if all expressions are written in conjunctive normal form with 3 variables per clause (3-CNF)conjunctive normal form (x11 OR x12 OR x13) AND (x21 OR x22 OR x23) AND (x31 OR x32 OR x33) AND... where each x is a variable, with or without a NOT in front of it, and each variable can appear multiple times in the expression.
Problem Formulation (SAT) Let us consider a problem of size 30 (i.e. 30 variables) Representation 1 True, 0 False, Binary String of length 30 Search Space 2 choices for each variable, taken over 30 variables, generates 2 30 possibilities Objective To find the vector of bits such that the compound Boolean statement is satisfied (made true) Evaluation Function? Not enough information to take the objective
Travelling salesman problem (TSP) Given a number of cities and the costs of travelling from one to the other, what is the cheapest roundtrip route that visits each city and then returns to the starting city? An equivalent formulation in terms of graph theory is: Find the Hamiltonian cycle with the least weight in a weighted graph. graph theoryHamiltonian cycle weighted graph
Problem Formulation (TSP) Let us consider a problem of size 30 (i.e. 30 cities) Representation: Permutation of natural numbers 1,…,30 where each number corresponds to a city to be visited in sequence Search Space: Permutations of all cities. Symmetric TSP, circuit the same regardless the starting city: (n-1)!/2 Objective: Minimize the total distance traversed, visiting each city once, and returning to the starting city. Min Sum(dist(x,y)) Evaluation Function: Map each tour to its corresponding total distance
Neighbourhoods and local Optima Region of the search space that is “near” to some particular point in that space S. x N(x) A search space S, a potential solution x, and its neighbourhood N(x)
Defining Neighbourhoods 1 Define a distance function dist on the search space S Dist: S x S → R N(x) = {y Є S: dist(x,y) ≤ ε } Examples: Euclidean distance, for search spaces defined over continuous variables Hamming distance, for search spaces definced over binary strings (e.g. SAT)
Use a mapping m, that defines a neighbourhood for any point x Є S 2-swap mapping: generates a new set of potential solutions from a given solution x Solutions are generated by swapping two cities from a given tour Every solution has n(n-1)/2 neighbours Example: → , Defining Neighbourhoods, TSP
1-flip mapping: generates a new set of potential solutions from a given solution x Solutions are generated by flipping a single bit in the given bit string Every solution has n neighbours Example: → ( 1 st bit) Defining Neighbourhoods, SAT
Gaussian Distribution: for each variable defines a neighbourhood Mean: the current point, Std. dev.: 1/6 of the range of the variable x = (x 1, …, x n ), where l i ≤ x i ≤ u i x’ = x i + N(0,σ i ), where σ i = (u i - l i )/6 N(0,σ i ) is an independent random Gaussian number with mean zero and std. dev. σ i Defining Neighbourhoods, Real Numbers
Local Optimum A potential solution x Є S is a local optimum with respect to the neighbourhood N, if and only if eval(x) ≤ eval(y), for all y Є N(x)