2Algorithm Design Techniques Brute ForceGreedy AlgorithmsDivide and ConquerDynamic ProgrammingBacktrackingGenetic Algorithms
3Brute ForceBased on the problem’s statement and definitions of the concepts involved.Examples:Sequential searchSimple sorts: bubble sort etc.
4Greedy Algorithms "take what you can get now" strategy Work in phases. In each phase the currently best decision is made
5Greedy Algorithms - Examples Dijkstra's algorithm(shortest path is weighted graphs)Prim's algorithm, Kruskal's algorithm(minimal spanning tree in weighted graphs)
6Divide and ConquerReduce the problem to smaller problems (by a factor of at least 2) solved recursively and then combine the solutionsExamples: Binary SearchMergesortQuick sortTree traversalIn general, problems that can be defined recursively
8Dynamic ProgrammingBottom-Up Technique in which the smallest sub-instances are explicitly solved first and the results of these used to construct solutions to progressively larger sub-instances.Example:Fibonacci numbers computed by iteration and the Tower of Hanoi puzzle.
9Tower of Hanoi (move to slide show) Conditions for Tower Of Hanoi:Only one disk may be moved at a time.Each move consists of taking the upper disk from one of the rods and sliding it onto another rod, on top of the other disks that may already be present on that rod.No disk may be placed on top of a smaller disk
10Backtracking Based on exhaustive search in multiple choice problems Generate-and-Test methodsBased on exhaustive search in multiple choice problemsExample: Puzzles like eight queens puzzle and traveling salesman problem
12Backtracking – State Space Search initial stategoal state(s)a set of intermediate statesa set of operators that transform one state into another. Each operator has preconditions and postconditions.a cost function – evaluates the cost of the operations (optional)a utility function – evaluates how close is a given state to the goal state (optional)
13Genetic Algorithms Search for good solutions among possible solutions The best possible solution may be missedA solution is coded by a string , also called chromosome. The words string and chromosome are used interchangeablyA strings fitness is a measure of how good a solution it codes. Fitness is calculated by a fitness functionSelection: The procedure to choose parentsCrossover is the procedure by which two chromosomes mate to create a new offspring chromosomeMutation : with a certain probability flip a bit in the offspring
14Basic Genetic Algorithm Start: Generate random population of n chromosomes (suitable solutions for the problem)Fitness: Evaluate the fitness f(x) of each chromosome x in the populationNew population: Create a new population by repeating following steps until the new population is completeTest: If the end condition is satisfied, stop, and return the best solution in current population
15New PopulationSelection: Select two parent chromosomes from a population according to their fitnessCrossover: With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents.Mutation: With a mutation probability mutate new offspring at each locus (position in chromosome).