Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 380: Design and Analysis of Algorithms

Similar presentations


Presentation on theme: "CSC 380: Design and Analysis of Algorithms"— Presentation transcript:

1 CSC 380: Design and Analysis of Algorithms
Dr. Curry Guinn

2 Quick Info Dr. Curry Guinn CIS 2015 guinnc@uncw.edu
Office Hours: MWF: 10:00am-11:00m and by appointment

3 Outline of today Satisfiability 3-SAT Brute force Hill climbing
Simulated annealing

4 The Satisfiability Problem
Given a set of propositional logic clauses, find an assignment of truth values to each symbol so that all of the clauses are true. (P -> Q & S) & (~P & ~Q) & (S | ~Q)

5 3SAT is a special case All clauses contain the disjunction of 3 terms
Disjunction means OR Each term is of the form P or ~P. (P | Q | ~S) & (~P | ~Q | ~S) & (P | ~Q | S) It turns out that any SAT case, can be transformed into 3SAT

6 3SAT is an NP-complete problem
Which means that it is map-able to other NP-complete problems such as Traveling salesman Clique Map coloring Knapsack, Etc. What do I mean by “map-able”?

7 Suppose we want to actually write code to solve this problem
How do we do it? Analysis Design Implement Test

8 Analysis Can we write down the problem?

9 Write down the problem Find a set of truth assignments for the propositional symbols such that are of the clauses are true. Each clause consist of a disjunction (OR) of three terms. Each term is either a proposition symbol or its negation (i.e., P or ~P). More generally, for a particular problem, we will have n different propositional symbols and m different clauses. Do you want to add anything?

10 Find the nouns. Why?

11 Find the nouns. Why? Find a set of truth assignments for the propositional symbols such that all of the clauses are true. Each clause consist of a disjunction (OR) of three terms. Each term is either a proposition symbol or its negation (i.e., P or ~P). More generally, for a particular problem, we will have n different propositional symbols and m different clauses.

12 Start making UML diagrams of the classes
Term Clause Symbol TruthAssignment Problem

13 See board and IDE

14 Iterative Improvement Algorithms
Essentially, guess at a solution and then make improvements until you find a solution. Not important how you get there. Hill climbing Simulated annealing

15 Local search algorithms
In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution State space = set of "complete" configurations Find configuration satisfying constraints, e.g., n-queens In such cases, we can use local search algorithms keep a single "current" state, try to improve it

16 Example: n-queens Put n queens on an n × n board with no two queens on the same row, column, or diagonal

17 Hill-climbing search "Like climbing Everest in thick fog with amnesia"

18 Hill-climbing search Problem: depending on initial state, can get stuck in local maxima

19 Hill-climbing search: 8-queens problem
h = number of pairs of queens that are attacking each other, either directly or indirectly h = 17 for the above state

20 Hill-climbing search: 8-queens problem
A local minimum with h = 1

21 Hill climbing From a guess, always choose a successor state that is closer to the solution. Problems Local maxima Plateaux Ridges Solution: Random-restart ... or ...

22 Simulated annealing Instead of always choosing the “best” successor, occasionally choose something that is worse at random.

23 Simulated annealing search
Idea: escape local maxima by allowing some "bad" moves but gradually decrease their frequency

24 Properties of simulated annealing search
One can prove: If T decreases slowly enough, then simulated annealing search will find a global optimum with probability approaching 1 Widely used in VLSI layout, airline scheduling, etc

25 For Next Class, Wednesday
Read about Hill Climbing


Download ppt "CSC 380: Design and Analysis of Algorithms"

Similar presentations


Ads by Google