lecture 1 introduction - imada.sdu.dkmarco/teaching/fall2006/dmp86/notes/dm86-lec1...i programming...

38
LOCAL SEARCH METHODS APPLICATIONS AND ENGINEERING Lecture 1 Introduction Marco Chiarandini

Upload: others

Post on 20-Oct-2019

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

LOCAL SEARCH METHODSAPPLICATIONS AND ENGINEERING

Lecture 1

Introduction

Marco Chiarandini

Page 2: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Outline

1. Course Introduction

2. Combinatorial Problems

3. Three Toy Problems

4. Computational Complexity

5. Solution Methods

6. Local Search Methods

Appendix

Local Search Methods: Applications and Engineering 2

Page 3: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Course Presentation

I Communication toolsI Web-site http://www.imada.sdu.dk/~marco/Teaching/DMP86/I Blackboard (currently only used for forums)I Mailing List

I Schedule (Current: weeks 5-20. Alternative weeks 5-17.)

I EvaluationI Project

Selection, Formalization, Modeling, Solution Development, Analysis,Reporting

I Oral exam (provisional date: 21st June)

I Text book:Hoos H. and Stutzle T. (2004). Stochastic Local Search: Foundations and Applications. Morgan

Kaufmann Publishers, San Francisco, CA, USA.

I Programming Languages: C vs C++ vs Java, and R

I Weekly Notes and Assignments

Local Search Methods: Applications and Engineering 3

Page 4: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Content of the Course

I Heuristic Methods for Combinatorial Optimization

I Greedy Heuristics and Neighborhood StructuresI Metaheuristics

(Probabilistic Iterative Improvement, GRASP, Variable Neighborhood Search, Tabu Search,

Simulated Annealing, Iterated Local Search, Dynamic Local Search Dynasearch and Path

Relinking Scatter Search and Memetic Algorithm Cross Entropy, Ant Colony Optimization)

I ApplicationsTimetabling, Routing, Scheduling

I Empirical Methods

I Descriptive Statistics (Exploratory Data Analysis)I Inference Statistics (Experimental Design, Statistical Tests)

R, the free software environment for statistical computing and

I Further Notions (Multi-objective optimization, stochastic optimization)

Local Search Methods: Applications and Engineering 4

Page 5: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Combinatorial Problems

Combinatorial problems arise in many areasof Computer Science and Operations Research:

I finding shortest/cheapest round trips (TSP)

I finding models of propositional formulae (SAT)

I register memory allocation (GCP)

I planning, scheduling, timetabling

I Internet data packet routing

I protein structure prediction

I combinatorial auctions winner determination

I portfolio selection

I ...

Local Search Methods: Applications and Engineering 5

Page 6: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Combinatorial Problems (2)

Combinatorial problems are characterized by an input,i.e., a general description of conditions and parameters anda question (or task, or objective) definingthe properties of a solution.

They involve finding a grouping, ordering, or assignmentof a discrete, finite set of objects that satisfies given conditions.

Candidate solutions are combinations of objects or solution componentsthat need not satisfy all given conditions.

Solutions are candidate solutions that satisfy all given conditions.

Local Search Methods: Applications and Engineering 6

Page 7: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Combinatorial Problems (3)

Example:

I Input: a set of points in the Euclidean plane

I Task: find the shortest Hamiltonian cycle

Note:

I solution component: segment consisting of two points that are visitedone directly after the other

I candidate solution: one of the (n− 1)! possible sequences of points tovisit one directly after the other.

I solution: Hamiltonian cycle of minimal length

Local Search Methods: Applications and Engineering 7

Page 8: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Combinatorial Problems (4)

General problem vs problem instance:

General problem Π:

I Given any set of points X, find a Hamiltonian cycle

I Solution: Algorithm that finds shortest Hamiltonian cycle for any X

Problem instantiation π = Π(I):I Given a specific set of points I, find a shortest Hamiltonian cycle

I Solution: Shortest Hamiltonian cycle for I

Problems can be formalized on sets of problem instances I

Local Search Methods: Applications and Engineering 8

Page 9: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Decision problems

solutions = candidate solutions that satisfy given logical conditions

Example: Satisfiability problem

I Given: A formula in propositional logic, e.g.,F := (x1 ∨ x2) ∧ (¬x1 ∨ ¬x2)

I Question: is there an assignment of truth values to variablesx1, x2, . . . , xn that renders F true?

Two variants:

I Search variant: Find a solution for given problem instance(or determine that no solution exists)

I Existence variant: Determine whether solutionsfor given problem instance exists

Local Search Methods: Applications and Engineering 9

Page 10: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Optimization problems

I objective function f measures solution quality(often defined on all candidate solutions)

I find solution with optimal quality, i.e., minimize/maximize f

Example: MAX-SAT

Which is the maximal number of clauses satisfiable in a propositional logicformula F?

Variants of optimization problems:

I Search variant: Find a solution with optimalobjective function value for given problem instance

I Evaluation variant: Determine optimal objective functionvalue for given problem instance

Local Search Methods: Applications and Engineering 10

Page 11: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Remarks

I Every optimization problem has associated decision problems: Given aproblem instance and a fixed solution quality bound b, find a solutionwith objective function value ≤ b (for minimization problems) ordetermine that no such solution exists.

I Many optimization problems have an objective functionas well as logical conditions, constraints that solutions must satisfy.

I A candidate solution is called feasible (or valid) iff it satisfiesthe given logical conditions.

I Note: Logical conditions can always be captured byan objective function such that feasible candidate solutionscorrespond to solutions of an associated decision problemwith a specific bound.

Local Search Methods: Applications and Engineering 11

Page 12: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Three Toy Problems

Toy problems: conceptually concise, exact description problemsintended to illustrate the development, analysis and presentation of algorithmsReal-world problems: what people care about. Tend not to have a singleagreed-upon description

Three prominent, conceptually simple problems:

I Finding shortest round trips in graphs (TSP)unconstrained optimization problem — routing

I Finding an assignment of colors to the vertices of a graph such that anytwo vertices connected by an edge are not assigned the same colorconstrained optimization problem — assignment

I Finding the sequences of jobs to be processed by a single machine thatminimize the total weighted tardiness (SMTWTP)unconstrained/constrained optimization problem – permutation

Local Search Methods: Applications and Engineering 12

Page 13: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

The Vertex Coloring Problem

Given: A graph G and a set of colors Γ.

A proper coloring is an assignment of one color to each vertex of the graphsuch that adjacent vertices receive different colors.

Assignment Partition

Decision version (k-coloring)Task: Find a proper coloring of G which uses at most k colors.

Optimization version (chromatic number)Task: Find a proper coloring of G which uses the minimal number of colors.

Local Search Methods: Applications and Engineering 13

Page 14: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

The Traveling Salesman Problem

I Given: Directed, edge-weighted graph G.

I Objective: Find a minimal-weight Hamiltonian cycle in G.

Types of TSP instances:

I Symmetric: For all edges (v, v′) of the given graph G, (v′, v) is also inG, and w((v, v′)) = w((v′, v)).Otherwise: asymmetric.

I Euclidean: Vertices = points in an Euclidean space,weight function = Euclidean distance metric.

I Geographic: Vertices = points on a sphere,weight function = geographic (great circle) distance.

Local Search Methods: Applications and Engineering 14

Page 15: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

The Single Machine Total Tardiness Problem

Given: a set of n jobs J1, . . . , Jn to be processed on a single machineand for each job Ji a processing time pi, a weight wi and a due date di.

Task: Find a schedule that minimizesthe total weighted tardiness

∑ni=1 wi · Ti

where Ti = Ci − di, 0 (Ci completion time of job Ji)

Example:Job J1 J2 J3 J4 J5 J6

Processing Time 3 2 2 3 4 3Due date 6 13 4 9 7 17Weight 2 3 1 5 1 2

Sequence φ = J3, J1, J5, J4, J1, J6

Job J3 J1 J5 J4 J1 J6

Ci 2 5 9 12 14 17Ti 0 0 2 3 1 0wi · Ti 0 0 2 15 3 0

Local Search Methods: Applications and Engineering 15

Page 16: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Computational Complexity

Fundamental question:

How hard is a given computational problems to solve?

Important concepts:

I Time complexity of a problem Π: Computation timerequired for solving a given instance π of Πusing the most efficient algorithm for Π.

I Worst-case time complexity: Time complexity in theworst case over all problem instances of a given size,typically measured as a function of instance size,neglecting constants and lower-order terms( O(...) upper, Θ(...) tight, Ω(...) lower).

Local Search Methods: Applications and Engineering 16

Page 17: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Important concepts (continued):

I NP: Class of problems that can be solved in polynomial time by anon-deterministic machine.

Note: non-deterministic 6= randomized; non-deterministic machines areidealized models of computation that havethe ability to make perfect guesses.

I NP-complete: Among the most difficult problems in NP; believed tohave at least exponential time-complexity for any realistic machine orprogramming model.

I NP-hard: At least as difficult as the most difficult problems in NP,but possibly not in NP (i.e., may have even worse complexity thanNP-complete problems).

Local Search Methods: Applications and Engineering 17

Page 18: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Many combinatorial problems are hardbut some problems can be solved efficiently

I Longest path problem is NP-hardbut not shortest path problem

I SAT for 3-CNF is NP-completebut not 2-CNF (linear time algorithm)

I TSP is NP-hard, the associated decision problem (for any solutionquality) is NP-completebut not the Euler tour problem

I TSP on Euclidean instances is NP-hardbut not where all vertices lie on a circle.

I The Graph Coloring Problem is NP-completebut not on interval graphs

I Many scheduling and timetabling problems are NP-hard

Local Search Methods: Applications and Engineering 18

Page 19: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Application Scenarios

Practically solving hard combinatorial problems:

I Subclasses can often be solved efficiently(e.g., 2-SAT);

I Average-case vs worst-case complexity(e.g. Simplex Algorithm for linear optimization);

I Approximation of optimal solutions:sometimes possible in polynomial time (e.g., Euclidean TSP),but in many cases also intractable (e.g., general TSP);

I Randomized computation is often practically(and possibly theoretically) more efficient;

I Asymptotic bounds vs true complexity:constants matter!

Local Search Methods: Applications and Engineering 19

Page 20: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:
Page 21: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Solution Methods

I Exact methods:systematic enumerationcomplete: guaranteed to eventually find (optimal) solution,or to determine that no solution exists

I Search algorithmsI Dynamic programmingI Constraint programmingI Integer programming

I Approximate methods:incomplete: not guaranteed to find (optimal) solution,and unable to prove that no solution exists

I Integer programming relaxationsI Randomized backtrackingI Heuristic algorithms

I Approximation methodsworst-case solution guarantee

Algorithms: instantiation of methods on a specific problem ΠLocal Search Methods: Applications and Engineering 21

Page 22: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Complete Search Paradigms

Tree search

I uninformed search: breadth first, depth first

I informed search: greedy best-first search, A∗ search, branch & bound

Example: branch & bound / A∗ search for TSPI Compute lower bound on length of completion of given

partial round trip.I Terminate search on branch if length of current partial

round trip + lower bound on length of completion exceedslength of shortest complete round trip found so far.

I Combination of constructive search and backtracking, i.e., revisiting ofchoice points after construction of completecandidate solutions.

I Performs systematic search over constructions.

I Complete, but visiting all candidate solutionsbecomes rapidly infeasible with growing size of problem instances.

Local Search Methods: Applications and Engineering 22

Page 23: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Incomplete Search Paradigms

Heuristic: a commonsense rule (or set of rules) intended to increase theprobability of solving some problem

Construction rules (aka construction heuristics)

I search space = partial candidate solutions

I search step = extension with one or more solution components

Perturbative search

I search space = complete candidate solutions

I search step = modification of one or more solution components

I iteratively generate and evaluate candidate solutionsI decision problems: evaluation = test if solutionI optimization problems: evaluation = check objective function value

I evaluating candidate solutions is typically computationally much cheaperthan finding (optimal) solutions

Local Search Methods: Applications and Engineering 23

Page 24: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Example

Construction Rule

Construction Heuristic (CH):

s := ∅While s is not a complete solution:|| choose a solution component cb add the solution component to s

Perturbative Search

Iterative Improvement (II):

While s has better neighbors:|| choose a neighbor s′ of s|| such that g(s′) < g(s)b s := s′

Local Search Methods: Applications and Engineering 24

Page 25: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Local Search Methods

In order to obtain very high quality solutionsit is often successful to combine the two heuristic paradigms

Meta-heuristicsGeneral guidance criteria over lower level heuristics.

Metaheuristics

ConstructionHeuristics

PerturbativeSearch

Informed search based on local or incomplete knowledge as opposed tosystematic search ⇒ Local Search Methods

Stochastic Local Search (SLS) algorithms use randomized choices ingenerating and modifying candidate solutions. They are introduced wheneverit is unknown which deterministic rules are profitable for all the instances ofinterest.

Local Search Methods: Applications and Engineering 25

Page 26: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Example: Uninformed random walk for k-coloring

procedure URW-for-k-col(G,k, maxSteps)input: graph G, integer k, integer maxStepsoutput: feasible coloring of G or ∅choose assignment ϕ of k colors to all vertices in G

uniformly at random;steps := 0;while not((ϕ is a proper coloring) and (steps < maxSteps)) do

randomly select vertex v in G;change value of ϕ(v);steps := steps+1;

endif ϕ is feasiblethen

return ϕelse

return ∅end

end URW-for-k-col

Local Search Methods: Applications and Engineering 26

Page 27: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Systematic search is often better suited when ...

I proofs of insolubility or optimality are required;

I time constraints are not critical;

I problem-specific knowledge can be exploited.

Local search is often better suited when ...

I non linear constraints and non linear objective function;

I reasonably good solutions are required within a short time;

I problem-specific knowledge is rather limited.

Complementarity:Local and systematic search can be fruitfully combined, e.g., by using localsearch for finding solutions whose optimality is proved using systematicsearch.Note: The largest instance proved optimal for the Traveling Salesmanamounts to 24978 cities. See http://www.tsp.gatech.edu/.

Local Search Methods: Applications and Engineering 27

Page 28: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Local search — global view

c

s

I vertices: candidate solutions(search positions)

I edges: connect neighboringpositions

I s: (optimal) solution

I c: current search position

Local Search Methods: Applications and Engineering 28

Page 29: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Definition: Local Search Algorithm (1)

For given problem instance π:

I search space S(π)(e.g., for GCP: assignment of colors to each vertex)

I solution set S′(π) ⊆ S(π)(e.g., for GCP: feasible assignment)

I neighborhood relation N(π) ⊆ S(π)× S(π)(e.g., for GCP: neighboring assignments differin the color at one vertex)

Local Search Methods: Applications and Engineering 29

Page 30: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Definition: Local Search Algorithm (2)

I set of memory states M(π)(may consist of a single state, for LS algorithms thatdo not use memory)

I initialization function init : ∅ 7→ D(S(π)×M(π))(specifies probability distribution over initial search positions andmemory states)

I step function step : S(π)×M(π) 7→ D(S(π)×M(π))(maps each search position and memory state ontoprobability distribution over subsequent, neighboringsearch positions and memory states)

I termination predicate terminate : S(π)×M(π) 7→ D(>,⊥)(determines the termination probability for eachsearch position and memory state)

Local Search Methods: Applications and Engineering 30

Page 31: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

procedure LS-Decision(π)input: problem instance π ∈ Πoutput: solution s ∈ S′(π) or ∅(s, m) := init(π);

while not terminate(π, s, m) do(s, m) := step(π, s, m);

end

if s ∈ S′(π) thenreturn s

elsereturn ∅

endend LS-Decision

Local Search Methods: Applications and Engineering 31

Page 32: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

procedure LS-Minimization(π′)input: problem instance π′ ∈ Π′

output: solution s ∈ S′(π′) or ∅(s, m) := init(π′);s := s;while not terminate(π′, s, m) do

(s, m) := step(π′, s, m);if f(π′, s) < f(π′, s) then

s := s;end

endif s ∈ S′(π′) then

return selse

return ∅end

end LS-Minimization

Local Search Methods: Applications and Engineering 32

Page 33: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Appendix

Page 34: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

The SAT Problem

General SAT Problem (search variant):

I Given: Formula F in propositional logic

I Objective: Find an assignment of truth values to variables in F thatrenders F true, or decide that no such assignment exists.

SAT: A simple example

I Given: Formula F := (x1 ∨ x2) ∧ (¬x1 ∨ ¬x2)I Objective: Find an assignment of truth values to variables x1, x2 that

renders F true, or decide that no such assignment exists.

Local Search Methods: Applications and Engineering 34

Page 35: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Definition:

I Formula in propositional logic: well-formed string that may containI propositional variables x1, x2, . . . , xn;I truth values > (‘true’), ⊥ (‘false’);I operators ¬ (‘not’), ∧ (‘and’), ∨ (‘or’);I parentheses (for operator nesting).

I Model (or satisfying assignment) of a formula F : Assignment of truthvalues to the variables in F under which F becomes true (under theusual interpretation of the logical operators)

I Formula F is satisfiable iff there exists at least one model of F ,unsatisfiable otherwise.

Local Search Methods: Applications and Engineering 35

Page 36: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Definition:

I A formula is in conjunctive normal form (CNF) iff it is of the form

m∧i=1

k(i)∨j=1

lij = (l11 ∨ . . . ∨ l1k(1)) . . . ∧ (lm1 ∨ . . . ∨ lmk(m))

where each literal lij is a propositional variable or its negation. Thedisjunctions (li1 ∨ . . . ∨ lik(i)) are called clauses.

I A formula is in k-CNF iff it is in CNF and all clauses contain exactly kliterals (i.e., for all i, k(i) = k).

I In many cases, the restriction of SAT to CNF formulaeis considered.

I The restriction of SAT to k-CNF formulae is called k-SAT.

I For every propositional formula, there is an equivalent formula in 3-CNF.

Local Search Methods: Applications and Engineering 36

Page 37: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Example:

F := ∧ (¬x2 ∨ x1)∧ (¬x1 ∨ ¬x2 ∨ ¬x3)∧ (x1 ∨ x2)∧ (¬x4 ∨ x3)∧ (¬x5 ∨ x3)

I F is in CNF.

I Is F satisfiable?Yes, e.g., x1 := x2 := >, x3 := x4 := x5 := ⊥ is a model of F .

Local Search Methods: Applications and Engineering 37

Page 38: Lecture 1 Introduction - imada.sdu.dkmarco/Teaching/Fall2006/DMP86/Notes/dm86-lec1...I Programming Languages: C vs C++ vs Java, and R I Weekly Notes and Assignments Local Search Methods:

Computation Complexity

Equivalent NotionsConsider Decision Problems

I A problem Π is in P if ∃ algorithm A that finds a solution in polynomialtime.

I in NP if ∃ verification algorithm A(s, k) that verifies a binary certificate(whether it is a solution to the problem) in polynomial time.

I Polynomial time reduction formally show that one problem Π1 is at leastas hard as another Π2, to within a polynomial factor. (there exists apolynomial time transformation) π1 ≤P π2 ⇒ Π1 is no more than apolynomial harder than Π2.

I Π1 is in NP-complete if

1. Π1 ∈ NP2. ∀Π2 ∈ NP Π2 ≤P Π1

I If Π1 satisfies property 2, but not necessarily property 1, we say that it isNP-hard:

Local Search Methods: Applications and Engineering 38