Top Banner
monash university Faculty of Information Technology Combinatorial problems and Search FIT4012 Advanced topics in computational science This material is based on slides provided with the book ’Stochastic Local Search: Foundations and Applications’ by Holger H. Hoos and Thomas St¨ utzle (Morgan Kaufmann, 2004) - see www.sls-book.net for further information. August 4, 2014 Slide 1/74
177

Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

Jul 18, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty

Faculty of Information Technology

Combinatorial problems and Search

FIT4012 Advanced topics in computational scienceThis material is based on slides provided with the book ’Stochastic Local Search:Foundations and Applications’ by Holger H. Hoos and Thomas Stutzle (MorganKaufmann, 2004) - see www.sls-book.net for further information.

August 4, 2014

Slide 1/74

Page 2: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Overview

• Combinatorial Problems

• Computational Complexity

• Stochastic Local Search

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 2/74

Page 3: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Combinatorial Problems

Combinatorial problems arise in many areas ofcomputer science and application domains:

• finding shortest/cheapest round trips (TSP)

• finding models of propositional formulae (SAT)

• planning, scheduling, time-tabling

• internet data packet routing

• protein structure prediction

• combinatorial auctions winner determination

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 3/74

Page 4: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Combinatorial Problems

Combinatorial problems arise in many areas ofcomputer science and application domains:

• finding shortest/cheapest round trips (TSP)

• finding models of propositional formulae (SAT)

• planning, scheduling, time-tabling

• internet data packet routing

• protein structure prediction

• combinatorial auctions winner determination

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 3/74

Page 5: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Combinatorial problems involve finding a:

• grouping,

• ordering, or

• assignment

of a discrete, finite set of objects that satisfies givenconditions.

Candidate solutions are combinations of solution componentsthat may be encountered during a solutions attempt but neednot satisfy all given conditions.

Solutions are candidate solutions that satisfy all givenconditions.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 4/74

Page 6: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Combinatorial problems involve finding a:

• grouping,

• ordering, or

• assignment

of a discrete, finite set of objects that satisfies givenconditions.

Candidate solutions are combinations of solution componentsthat may be encountered during a solutions attempt but neednot satisfy all given conditions.

Solutions are candidate solutions that satisfy all givenconditions.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 4/74

Page 7: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Combinatorial problems involve finding a:

• grouping,

• ordering, or

• assignment

of a discrete, finite set of objects that satisfies givenconditions.

Candidate solutions are combinations of solution componentsthat may be encountered during a solutions attempt but neednot satisfy all given conditions.

Solutions are candidate solutions that satisfy all givenconditions.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 4/74

Page 8: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Grouping

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 5/74

Page 9: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Ordering

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 6/74

Page 10: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Assignment

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 7/74

Page 11: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example:

• Given: Set of points in the Euclidean plane

• Objective: Find the shortest round trip

• a round trip corresponds to a sequence of points(assignment of points to sequence positions)

• solution component: trip segment consisting of twopoints that are visited one directly after the other

• candidate solution: round trip

• solution: round trip with minimal length

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 8/74

Page 12: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example:

• Given: Set of points in the Euclidean plane

• Objective: Find the shortest round trip

• a round trip corresponds to a sequence of points(assignment of points to sequence positions)

• solution component: trip segment consisting of twopoints that are visited one directly after the other

• candidate solution: round trip

• solution: round trip with minimal length

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 8/74

Page 13: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Problem vs problem instance

• Problem: Given any set of points X , find a shortestround trip

• Solution: Algorithm that finds shortest round trips forany X

• Problem instance: Given a specific set of points P, finda shortest round trip

• Solution: Shortest round trip for P

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 9/74

Page 14: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Problem vs problem instance

• Problem: Given any set of points X , find a shortestround trip

• Solution: Algorithm that finds shortest round trips forany X

• Problem instance: Given a specific set of points P, finda shortest round trip

• Solution: Shortest round trip for P

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 9/74

Page 15: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Decision problemssolutions = candidate solutions that satisfy given logicalconditions

Example: The Graph Colouring Problem• Given: Graph G and set of colours C• Objective: Assign to all vertices of G a colour from C

such that two vertices connected by an edge are neverassigned the same colour

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 10/74

Page 16: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Decision problemssolutions = candidate solutions that satisfy given logicalconditions

Example: The Graph Colouring Problem• Given: Graph G and set of colours C• Objective: Assign to all vertices of G a colour from C

such that two vertices connected by an edge are neverassigned the same colour

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 10/74

Page 17: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search vs. decision variant

Every decision problem has two variants:

• Search variant: Find a solution for given probleminstance (or determine that no solution exists)

• Decision variant: Determine whether solution for givenproblem instance exists

Search and decision variants are closely related; algorithmsfor one can be used for solving the other.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 11/74

Page 18: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search vs. decision variant

Every decision problem has two variants:

• Search variant: Find a solution for given probleminstance (or determine that no solution exists)

• Decision variant: Determine whether solution for givenproblem instance exists

Search and decision variants are closely related; algorithmsfor one can be used for solving the other.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 11/74

Page 19: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Optimisation problems

• can be seen as generalisations of decision problems

• objective function f measures solution quality (oftendefined on all candidate solutions)

• typical goal: find solution with optimal qualityminimisation problem: minimal value of fmaximisation problem: maximal value of f

Example: Variant of the Graph Colouring Problem where

the objective is to find a valid colour assignment that uses aminimal number of colours.

Every minimisation problem can be formulated as amaximisation problem and vice versa.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 12/74

Page 20: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Optimisation problems

• can be seen as generalisations of decision problems

• objective function f measures solution quality (oftendefined on all candidate solutions)

• typical goal: find solution with optimal qualityminimisation problem: minimal value of fmaximisation problem: maximal value of f

Example: Variant of the Graph Colouring Problem where

the objective is to find a valid colour assignment that uses aminimal number of colours.

Every minimisation problem can be formulated as amaximisation problem and vice versa.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 12/74

Page 21: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Optimisation problems

• can be seen as generalisations of decision problems

• objective function f measures solution quality (oftendefined on all candidate solutions)

• typical goal: find solution with optimal qualityminimisation problem: minimal value of fmaximisation problem: maximal value of f

Example: Variant of the Graph Colouring Problem where

the objective is to find a valid colour assignment that uses aminimal number of colours.

Every minimisation problem can be formulated as amaximisation problem and vice versa.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 12/74

Page 22: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Variants of optimisation problems

• Search variant: Find a solution with optimal objectivefunction value for given problem instance

• Evaluation variant: Determine optimal objectivefunction value for given problem instance

Every optimisation problem has associated decisionproblems:

Given a problem instance and a fixed solution quality boundb, find a solution with objective function value ≤ b (forminimisation problems) or determine that no such solutionexists.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 13/74

Page 23: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Variants of optimisation problems

• Search variant: Find a solution with optimal objectivefunction value for given problem instance

• Evaluation variant: Determine optimal objectivefunction value for given problem instance

Every optimisation problem has associated decisionproblems:

Given a problem instance and a fixed solution quality boundb, find a solution with objective function value ≤ b (forminimisation problems) or determine that no such solutionexists.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 13/74

Page 24: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Many optimisation problems have an objective functionas well as logical conditions that solutions must satisfy.

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

Note: Logical conditions can always be captured byan objective function such that feasible candidate solutionscorrespond to solutions of an associated decision problem

with a specific bound.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 14/74

Page 25: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Many optimisation problems have an objective functionas well as logical conditions that solutions must satisfy.

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

Note: Logical conditions can always be captured byan objective function such that feasible candidate solutionscorrespond to solutions of an associated decision problem

with a specific bound.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 14/74

Page 26: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Note:

• Algorithms for optimisation problems can be used tosolve associated decision problems

• Algorithms for decision problems can often be extendedto related optimisation problems.

• Caution: This does not always solve the given problemmost efficiently.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 15/74

Page 27: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Note:

• Algorithms for optimisation problems can be used tosolve associated decision problems

• Algorithms for decision problems can often be extendedto related optimisation problems.

• Caution: This does not always solve the given problemmost efficiently.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 15/74

Page 28: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Two Prototypical Combinatorial Problems

Studying conceptually simple problems facilitatesdevelopment, analysis and presentation of algorithms

Two prominent, conceptually simple problems:

• Finding satisfying variable assignments of propositionalformulae (SAT)– prototypical decision problem

• Finding shortest round trips in graphs (TSP)– prototypical optimisation problem

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 16/74

Page 29: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Two Prototypical Combinatorial Problems

Studying conceptually simple problems facilitatesdevelopment, analysis and presentation of algorithms

Two prominent, conceptually simple problems:

• Finding satisfying variable assignments of propositionalformulae (SAT)– prototypical decision problem

• Finding shortest round trips in graphs (TSP)– prototypical optimisation problem

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 16/74

Page 30: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

SAT: A simple example

General SAT Problem (search variant):

• Given: Formula F in propositional logic (e.g.F := (x1 ∨ x2) ∧ (¬x1 ∨ ¬x2))

• Objective: Find an assignment of truth values tovariables in F that renders F true, or decide that nosuch assignment exists.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 17/74

Page 31: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

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

• Model (or satisfying assignment) of a formula F :Assignment of truth values to the variables in F underwhich F becomes true (under the usual interpretation ofthe logical operators)

• Formula F is satisfiable iff there exists at least onemodel of F , unsatisfiable otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 18/74

Page 32: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

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

• Model (or satisfying assignment) of a formula F :Assignment of truth values to the variables in F underwhich F becomes true (under the usual interpretation ofthe logical operators)

• Formula F is satisfiable iff there exists at least onemodel of F , unsatisfiable otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 18/74

Page 33: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

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

• Model (or satisfying assignment) of a formula F :Assignment of truth values to the variables in F underwhich F becomes true (under the usual interpretation ofthe logical operators)

• Formula F is satisfiable iff there exists at least onemodel of F , unsatisfiable otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 18/74

Page 34: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• A formula is in conjunctive normal form (CNF) iff it is ofthe form

m∧i=1

k(i)∨j=1

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

where each literal lij is a propositional variable or itsnegation. The disjunctions (li1 ∨ . . . ∨ lik(i)) are calledclauses.

• A formula is in k-CNF iff it is in CNF and all clausescontain exactly k literals (i.e., for all i , k(i) = k).

For every propositional formula, there is an equivalentformula in 3-CNF.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 19/74

Page 35: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• A formula is in conjunctive normal form (CNF) iff it is ofthe form

m∧i=1

k(i)∨j=1

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

where each literal lij is a propositional variable or itsnegation. The disjunctions (li1 ∨ . . . ∨ lik(i)) are calledclauses.

• A formula is in k-CNF iff it is in CNF and all clausescontain exactly k literals (i.e., for all i , k(i) = k).

For every propositional formula, there is an equivalentformula in 3-CNF.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 19/74

Page 36: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• A formula is in conjunctive normal form (CNF) iff it is ofthe form

m∧i=1

k(i)∨j=1

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

where each literal lij is a propositional variable or itsnegation. The disjunctions (li1 ∨ . . . ∨ lik(i)) are calledclauses.

• A formula is in k-CNF iff it is in CNF and all clausescontain exactly k literals (i.e., for all i , k(i) = k).

For every propositional formula, there is an equivalentformula in 3-CNF.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 19/74

Page 37: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Concise definition of SAT

• Given: Formula F in propositional logic.

• Objective: Decide whether F is satisfiable.

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

• The restriction of SAT to k-CNF formulae is calledk-SAT.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 20/74

Page 38: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Concise definition of SAT

• Given: Formula F in propositional logic.

• Objective: Decide whether F is satisfiable.

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

• The restriction of SAT to k-CNF formulae is calledk-SAT.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 20/74

Page 39: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example:

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

• F is in CNF.

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

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 21/74

Page 40: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example:

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

• F is in CNF.

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

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 21/74

Page 41: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

TSP: A simple example

Bonifaccio

Gibraltar

Europe

Africa

AsiaStromboli

Zakinthos

Ithaca

Corfu

Taormina

Djerba

Malea

Troy

Maronia

Messina

Circeo

Favignana

Ustica

Birzebbuga

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 22/74

Page 42: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

TSP: A simple example

Bonifaccio

Gibraltar

Europe

Africa

AsiaStromboli

Zakinthos

Ithaca

Corfu

Taormina

Djerba

Malea

Troy

Maronia

Messina

Circeo

Favignana

Ustica

Birzebbuga

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 22/74

Page 43: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

TSP: A simple example

Bonifaccio

Gibraltar

Europe

Africa

AsiaStromboli

Zakinthos

Ithaca

Corfu

Taormina

Djerba

Malea

Troy

Maronia

Messina

Circeo

Favignana

Ustica

Birzebbuga

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 22/74

Page 44: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition

• Hamiltonian cycle in graph G := (V ,E ): cyclic paththat visits every vertex of G exactly once (exceptstart/end point).

• Weight of path p := (u1, . . . , uk) in edge-weighted graphG := (V ,E ,w): total weight of all edges on p, i.e.:

w(p) :=k−1∑i=1

w((ui , ui+1))

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 23/74

Page 45: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition

• Hamiltonian cycle in graph G := (V ,E ): cyclic paththat visits every vertex of G exactly once (exceptstart/end point).

• Weight of path p := (u1, . . . , uk) in edge-weighted graphG := (V ,E ,w): total weight of all edges on p, i.e.:

w(p) :=k−1∑i=1

w((ui , ui+1))

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 23/74

Page 46: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

The Travelling Salesman Problem (TSP)

• Given: Directed, edge-weighted graph G .

• Objective: Find a minimal-weight Hamiltonian cycle inG .

Types of TSP instances:

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

• Euclidean: Vertices = points in a Euclidean space,weight function = Euclidean distance metric.

• Geographic: Vertices = points on a sphere, weightfunction = geographic (great circle) distance.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 24/74

Page 47: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

The Travelling Salesman Problem (TSP)

• Given: Directed, edge-weighted graph G .

• Objective: Find a minimal-weight Hamiltonian cycle inG .

Types of TSP instances:

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

• Euclidean: Vertices = points in a Euclidean space,weight function = Euclidean distance metric.

• Geographic: Vertices = points on a sphere, weightfunction = geographic (great circle) distance.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 24/74

Page 48: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

The Travelling Salesman Problem (TSP)

• Given: Directed, edge-weighted graph G .

• Objective: Find a minimal-weight Hamiltonian cycle inG .

Types of TSP instances:

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

• Euclidean: Vertices = points in a Euclidean space,weight function = Euclidean distance metric.

• Geographic: Vertices = points on a sphere, weightfunction = geographic (great circle) distance.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 24/74

Page 49: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

The Travelling Salesman Problem (TSP)

• Given: Directed, edge-weighted graph G .

• Objective: Find a minimal-weight Hamiltonian cycle inG .

Types of TSP instances:

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

• Euclidean: Vertices = points in a Euclidean space,weight function = Euclidean distance metric.

• Geographic: Vertices = points on a sphere, weightfunction = geographic (great circle) distance.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 24/74

Page 50: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Problem difficulty

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 25/74

Page 51: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Complexity classes

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 26/74

Page 52: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational Complexity

Fundamental question: How hard is a given computationalproblem to solve?

Important concepts:

• Time complexity of a problem Π: Computation timerequired for solving a given instance π of Π using themost efficient algorithm for Π.

• 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(...)’ and‘Θ(...)’ notations).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 27/74

Page 53: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational Complexity

Fundamental question: How hard is a given computationalproblem to solve?

Important concepts:

• Time complexity of a problem Π: Computation timerequired for solving a given instance π of Π using themost efficient algorithm for Π.

• 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(...)’ and‘Θ(...)’ notations).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 27/74

Page 54: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational Complexity

Fundamental question: How hard is a given computationalproblem to solve?

Important concepts:

• Time complexity of a problem Π: Computation timerequired for solving a given instance π of Π using themost efficient algorithm for Π.

• 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(...)’ and‘Θ(...)’ notations).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 27/74

Page 55: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Important concepts (continued):

• NP: Class of problems that can be solved in polynomialtime by a nondeterministic machine.

Note: nondeterministic 6= randomised; non-deterministicmachines are idealised models of computation that havethe ability to make perfect guesses.

• NP-complete: Among the most difficult problems inNP; believed to have at least exponentialtime-complexity for any realistic machine orprogramming model.

• NP-hard: At least as difficult as the most difficultproblems in NP, but possibly not in NP (i.e., may haveeven worse complexity than NP-complete problems).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 28/74

Page 56: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Important concepts (continued):

• NP: Class of problems that can be solved in polynomialtime by a nondeterministic machine.

Note: nondeterministic 6= randomised; non-deterministicmachines are idealised models of computation that havethe ability to make perfect guesses.

• NP-complete: Among the most difficult problems inNP; believed to have at least exponentialtime-complexity for any realistic machine orprogramming model.

• NP-hard: At least as difficult as the most difficultproblems in NP, but possibly not in NP (i.e., may haveeven worse complexity than NP-complete problems).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 28/74

Page 57: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Important concepts (continued):

• NP: Class of problems that can be solved in polynomialtime by a nondeterministic machine.

Note: nondeterministic 6= randomised; non-deterministicmachines are idealised models of computation that havethe ability to make perfect guesses.

• NP-complete: Among the most difficult problems inNP; believed to have at least exponentialtime-complexity for any realistic machine orprogramming model.

• NP-hard: At least as difficult as the most difficultproblems in NP, but possibly not in NP (i.e., may haveeven worse complexity than NP-complete problems).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 28/74

Page 58: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Important concepts (continued):

• NP: Class of problems that can be solved in polynomialtime by a nondeterministic machine.

Note: nondeterministic 6= randomised; non-deterministicmachines are idealised models of computation that havethe ability to make perfect guesses.

• NP-complete: Among the most difficult problems inNP; believed to have at least exponentialtime-complexity for any realistic machine orprogramming model.

• NP-hard: At least as difficult as the most difficultproblems in NP, but possibly not in NP (i.e., may haveeven worse complexity than NP-complete problems).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 28/74

Page 59: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Many combinatorial problems are hard:

• SAT for general propositional formulae is NP-complete.

• SAT for 3-CNF is NP-complete.

• TSP is NP-hard, the associated decision problem (forany solution quality) is NP-complete.

• The same holds for Euclidean TSP instances.

• The Graph Colouring Problem is NP-complete.

• Many scheduling and timetabling problems areNP-hard.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 29/74

Page 60: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Many combinatorial problems are hard:

• SAT for general propositional formulae is NP-complete.

• SAT for 3-CNF is NP-complete.

• TSP is NP-hard, the associated decision problem (forany solution quality) is NP-complete.

• The same holds for Euclidean TSP instances.

• The Graph Colouring Problem is NP-complete.

• Many scheduling and timetabling problems areNP-hard.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 29/74

Page 61: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Many combinatorial problems are hard:

• SAT for general propositional formulae is NP-complete.

• SAT for 3-CNF is NP-complete.

• TSP is NP-hard, the associated decision problem (forany solution quality) is NP-complete.

• The same holds for Euclidean TSP instances.

• The Graph Colouring Problem is NP-complete.

• Many scheduling and timetabling problems areNP-hard.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 29/74

Page 62: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Many combinatorial problems are hard:

• SAT for general propositional formulae is NP-complete.

• SAT for 3-CNF is NP-complete.

• TSP is NP-hard, the associated decision problem (forany solution quality) is NP-complete.

• The same holds for Euclidean TSP instances.

• The Graph Colouring Problem is NP-complete.

• Many scheduling and timetabling problems areNP-hard.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 29/74

Page 63: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Many combinatorial problems are hard:

• SAT for general propositional formulae is NP-complete.

• SAT for 3-CNF is NP-complete.

• TSP is NP-hard, the associated decision problem (forany solution quality) is NP-complete.

• The same holds for Euclidean TSP instances.

• The Graph Colouring Problem is NP-complete.

• Many scheduling and timetabling problems areNP-hard.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 29/74

Page 64: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

But: Some combinatorial problems can be solved efficiently:

• Shortest Path Problem (Dijkstra’s algorithm);

• 2-SAT (linear time algorithm);

• many special cases of TSP, e.g., Euclidean instanceswhere all vertices lie on a circle;

• sequence alignment problems (dynamic programming).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 30/74

Page 65: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

But: Some combinatorial problems can be solved efficiently:

• Shortest Path Problem (Dijkstra’s algorithm);

• 2-SAT (linear time algorithm);

• many special cases of TSP, e.g., Euclidean instanceswhere all vertices lie on a circle;

• sequence alignment problems (dynamic programming).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 30/74

Page 66: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

But: Some combinatorial problems can be solved efficiently:

• Shortest Path Problem (Dijkstra’s algorithm);

• 2-SAT (linear time algorithm);

• many special cases of TSP, e.g., Euclidean instanceswhere all vertices lie on a circle;

• sequence alignment problems (dynamic programming).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 30/74

Page 67: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

But: Some combinatorial problems can be solved efficiently:

• Shortest Path Problem (Dijkstra’s algorithm);

• 2-SAT (linear time algorithm);

• many special cases of TSP, e.g., Euclidean instanceswhere all vertices lie on a circle;

• sequence alignment problems (dynamic programming).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 30/74

Page 68: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Practically solving hard combinatorial problems

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

• Average-case vs worst-case complexity (e.g. SimplexAlgorithm for linear optimisation);

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

• Randomised computation is often practically (andpossibly theoretically) more efficient;

• Asymptotic bounds vs true complexity: constantsmatter!

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 31/74

Page 69: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Practically solving hard combinatorial problems

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

• Average-case vs worst-case complexity (e.g. SimplexAlgorithm for linear optimisation);

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

• Randomised computation is often practically (andpossibly theoretically) more efficient;

• Asymptotic bounds vs true complexity: constantsmatter!

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 31/74

Page 70: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Practically solving hard combinatorial problems

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

• Average-case vs worst-case complexity (e.g. SimplexAlgorithm for linear optimisation);

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

• Randomised computation is often practically (andpossibly theoretically) more efficient;

• Asymptotic bounds vs true complexity: constantsmatter!

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 31/74

Page 71: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Practically solving hard combinatorial problems

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

• Average-case vs worst-case complexity (e.g. SimplexAlgorithm for linear optimisation);

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

• Randomised computation is often practically (andpossibly theoretically) more efficient;

• Asymptotic bounds vs true complexity: constantsmatter!

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 31/74

Page 72: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Practically solving hard combinatorial problems

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

• Average-case vs worst-case complexity (e.g. SimplexAlgorithm for linear optimisation);

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

• Randomised computation is often practically (andpossibly theoretically) more efficient;

• Asymptotic bounds vs true complexity: constantsmatter!

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 31/74

Page 73: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 32/74

Page 74: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search Paradigms

Solving combinatorial problems through search:

• iteratively generate and evaluate candidate solutions

• decision problems: evaluation = test if solution

• optimisation problems: evaluation = check objectivefunction value

• evaluating candidate solutions is typicallycomputationally much cheaper than finding (optimal)solutions

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 33/74

Page 75: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search Paradigms

Solving combinatorial problems through search:

• iteratively generate and evaluate candidate solutions

• decision problems: evaluation = test if solution

• optimisation problems: evaluation = check objectivefunction value

• evaluating candidate solutions is typicallycomputationally much cheaper than finding (optimal)solutions

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 33/74

Page 76: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search Paradigms

Solving combinatorial problems through search:

• iteratively generate and evaluate candidate solutions

• decision problems: evaluation = test if solution

• optimisation problems: evaluation = check objectivefunction value

• evaluating candidate solutions is typicallycomputationally much cheaper than finding (optimal)solutions

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 33/74

Page 77: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search Paradigms

Solving combinatorial problems through search:

• iteratively generate and evaluate candidate solutions

• decision problems: evaluation = test if solution

• optimisation problems: evaluation = check objectivefunction value

• evaluating candidate solutions is typicallycomputationally much cheaper than finding (optimal)solutions

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 33/74

Page 78: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Perturbative search

• search space = complete candidate solutions

• search step = modification of one or more solutioncomponents

Example: SAT

• search space = complete variable assignments

• search step = modification of truth values for one ormore variables

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 34/74

Page 79: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Perturbative search

• search space = complete candidate solutions

• search step = modification of one or more solutioncomponents

Example: SAT

• search space = complete variable assignments

• search step = modification of truth values for one ormore variables

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 34/74

Page 80: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Constructive search (construction heuristics)

• search space = partial candidate solutions

• search step = extension with one or more solutioncomponents

Example: Nearest Neighbour Heuristic (NNH) for TSP

• start with single vertex (chosen uniformly at random)

• in each step, follow minimal-weight edge to yetunvisited, next vertex

• complete Hamiltonian cycle by adding initial vertex toend of path

Note: NNH typically does not find very high qualitysolutions, but it is often and successfully used in combinationwith perturbative search methods.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 35/74

Page 81: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Constructive search (construction heuristics)

• search space = partial candidate solutions

• search step = extension with one or more solutioncomponents

Example: Nearest Neighbour Heuristic (NNH) for TSP

• start with single vertex (chosen uniformly at random)

• in each step, follow minimal-weight edge to yetunvisited, next vertex

• complete Hamiltonian cycle by adding initial vertex toend of path

Note: NNH typically does not find very high qualitysolutions, but it is often and successfully used in combinationwith perturbative search methods.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 35/74

Page 82: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Constructive search (construction heuristics)

• search space = partial candidate solutions

• search step = extension with one or more solutioncomponents

Example: Nearest Neighbour Heuristic (NNH) for TSP

• start with single vertex (chosen uniformly at random)

• in each step, follow minimal-weight edge to yetunvisited, next vertex

• complete Hamiltonian cycle by adding initial vertex toend of path

Note: NNH typically does not find very high qualitysolutions, but it is often and successfully used in combinationwith perturbative search methods.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 35/74

Page 83: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Systematic search

• traverse search space for given problem instance in asystematic manner

• complete: guaranteed to eventually find (optimal)solution, or to determine that no solution exists

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 36/74

Page 84: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Systematic search

• traverse search space for given problem instance in asystematic manner

• complete: guaranteed to eventually find (optimal)solution, or to determine that no solution exists

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 36/74

Page 85: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Local Search

• start at some position in search space

• iteratively move from position to neighbouring position

• typically incomplete: not guaranteed to eventually find(optimal) solutions, cannot determine insolubility withcertainty

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 37/74

Page 86: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Local Search

• start at some position in search space

• iteratively move from position to neighbouring position

• typically incomplete: not guaranteed to eventually find(optimal) solutions, cannot determine insolubility withcertainty

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 37/74

Page 87: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT

procedure URW-for-SAT(F ,maxSteps)input: propositional formula F , integer maxStepsoutput: model of F or ∅choose assignment a of truth values to all variables in F

uniformly at random;steps := 0;while not((a satisfies F ) and (steps < maxSteps)) do

randomly select variable x in F ;change value of x in a;steps := steps+1;

endif a satisfies F then

return aelse

return ∅end

end URW-for-SAT

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 38/74

Page 88: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT

procedure URW-for-SAT(F ,maxSteps)input: propositional formula F , integer maxStepsoutput: model of F or ∅choose assignment a of truth values to all variables in F

uniformly at random;steps := 0;while not((a satisfies F ) and (steps < maxSteps)) do

randomly select variable x in F ;change value of x in a;steps := steps+1;

endif a satisfies F then

return aelse

return ∅end

end URW-for-SAT

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 38/74

Page 89: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT

procedure URW-for-SAT(F ,maxSteps)input: propositional formula F , integer maxStepsoutput: model of F or ∅choose assignment a of truth values to all variables in F

uniformly at random;steps := 0;while not((a satisfies F ) and (steps < maxSteps)) do

randomly select variable x in F ;change value of x in a;steps := steps+1;

endif a satisfies F then

return aelse

return ∅end

end URW-for-SAT

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 38/74

Page 90: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT

procedure URW-for-SAT(F ,maxSteps)input: propositional formula F , integer maxStepsoutput: model of F or ∅choose assignment a of truth values to all variables in F

uniformly at random;steps := 0;while not((a satisfies F ) and (steps < maxSteps)) do

randomly select variable x in F ;change value of x in a;steps := steps+1;

endif a satisfies F then

return aelse

return ∅end

end URW-for-SAT

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 38/74

Page 91: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Local search 6= perturbative search:

• Construction heuristics can be seen as local searchmethods e.g., the Nearest Neighbour Heuristic for TSP.

Note: Many high-performance local search algorithmscombine constructive and perturbative search.

• Perturbative search can provide the basis for systematicsearch methods.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 39/74

Page 92: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Local search 6= perturbative search:

• Construction heuristics can be seen as local searchmethods e.g., the Nearest Neighbour Heuristic for TSP.

Note: Many high-performance local search algorithmscombine constructive and perturbative search.

• Perturbative search can provide the basis for systematicsearch methods.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 39/74

Page 93: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Local search 6= perturbative search:

• Construction heuristics can be seen as local searchmethods e.g., the Nearest Neighbour Heuristic for TSP.

Note: Many high-performance local search algorithmscombine constructive and perturbative search.

• Perturbative search can provide the basis for systematicsearch methods.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 39/74

Page 94: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Tree search

• Combination of constructive search and backtracking,i.e., revisiting of choice points after construction ofcomplete candidate solutions.

• Performs systematic search over constructions.

• Complete, but visiting all candidate solutions becomesrapidly infeasible with growing size of problem instances.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 40/74

Page 95: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Tree search

• Combination of constructive search and backtracking,i.e., revisiting of choice points after construction ofcomplete candidate solutions.

• Performs systematic search over constructions.

• Complete, but visiting all candidate solutions becomesrapidly infeasible with growing size of problem instances.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 40/74

Page 96: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: NNH + Backtracking

• Construct complete candidate round trip using NNH.

• Backtrack to most recent choice point with unexploredalternatives.

• Complete tour using NNH (possibly creating new choicepoints).

• Recursively iterate backtracking and completion.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 41/74

Page 97: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Efficiency of tree search can be substantially improved bypruning choices that cannot lead to (optimal) solutions.

Example: Branch & bound / A∗ search for TSP

• Compute lower bound on length of completion of givenpartial round trip.

• Terminate search on branch if length of current partialround trip + lower bound on length of completionexceeds length of shortest complete round trip found sofar.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 42/74

Page 98: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Efficiency of tree search can be substantially improved bypruning choices that cannot lead to (optimal) solutions.

Example: Branch & bound / A∗ search for TSP

• Compute lower bound on length of completion of givenpartial round trip.

• Terminate search on branch if length of current partialround trip + lower bound on length of completionexceeds length of shortest complete round trip found sofar.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 42/74

Page 99: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Efficiency of tree search can be substantially improved bypruning choices that cannot lead to (optimal) solutions.

Example: Branch & bound / A∗ search for TSP

• Compute lower bound on length of completion of givenpartial round trip.

• Terminate search on branch if length of current partialround trip + lower bound on length of completionexceeds length of shortest complete round trip found sofar.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 42/74

Page 100: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 43/74

Page 101: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Systematic vs Local Search

• Completeness: Advantage of systematic search, butnot always relevant, e.g., when existence of solutions isguaranteed by construction or in real-time situations.

• Any-time property: Positive correlation betweenrun-time and solution quality or probability; typicallymore readily achieved by local search.

• Complementarity: Local and systematic search can befruitfully combined, e.g., by using local search for findingsolutions whose optimality is proven using systematicsearch.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 44/74

Page 102: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Systematic vs Local Search

• Completeness: Advantage of systematic search, butnot always relevant, e.g., when existence of solutions isguaranteed by construction or in real-time situations.

• Any-time property: Positive correlation betweenrun-time and solution quality or probability; typicallymore readily achieved by local search.

• Complementarity: Local and systematic search can befruitfully combined, e.g., by using local search for findingsolutions whose optimality is proven using systematicsearch.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 44/74

Page 103: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Systematic vs Local Search

• Completeness: Advantage of systematic search, butnot always relevant, e.g., when existence of solutions isguaranteed by construction or in real-time situations.

• Any-time property: Positive correlation betweenrun-time and solution quality or probability; typicallymore readily achieved by local search.

• Complementarity: Local and systematic search can befruitfully combined, e.g., by using local search for findingsolutions whose optimality is proven using systematicsearch.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 44/74

Page 104: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Systematic search is often better suited when ...

• proofs of insolubility or optimality are required;

• time constraints are not critical;

• problem-specific knowledge can be expoited.

Local search is often better suited when ...

• reasonably good solutions are required within a shorttime;

• parallel processing is used;

• problem-specific knowledge is rather limited.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 45/74

Page 105: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Systematic search is often better suited when ...

• proofs of insolubility or optimality are required;

• time constraints are not critical;

• problem-specific knowledge can be expoited.

Local search is often better suited when ...

• reasonably good solutions are required within a shorttime;

• parallel processing is used;

• problem-specific knowledge is rather limited.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 45/74

Page 106: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Stochastic Local Search

Many prominent local search algorithms use randomisedchoices in generating and modifying candidate solutions.

These stochastic local search (SLS) algorithms are one of themost successful and widely used approaches for solving hardcombinatorial problems.

Some well-known SLS methods and algorithms:

• Evolutionary Algorithms

• Simulated Annealing

• Lin-Kernighan Algorithm for TSP

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 46/74

Page 107: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Stochastic Local Search

Many prominent local search algorithms use randomisedchoices in generating and modifying candidate solutions.

These stochastic local search (SLS) algorithms are one of themost successful and widely used approaches for solving hardcombinatorial problems.

Some well-known SLS methods and algorithms:

• Evolutionary Algorithms

• Simulated Annealing

• Lin-Kernighan Algorithm for TSP

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 46/74

Page 108: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Stochastic local search — global view

c

s

• vertices: candidate solutions(search positions)

• edges: connect neighbouringpositions

• s: (optimal) solution

• c: current search position

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 47/74

Page 109: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Stochastic local search — global view

c

s

• vertices: candidate solutions(search positions)

• edges: connect neighbouringpositions

• s: (optimal) solution

• c: current search position

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 47/74

Page 110: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Stochastic local search — local view

c

s

Next search position is selected

from local neighbourhood based on local information, e.g.,heuristic values.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 48/74

Page 111: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition: Stochastic Local SearchAlgorithm (1)

For given problem instance π:

• search space S(π) (e.g., for SAT: set of all completetruth assignments to propositional variables)

• solution set S ′(π) ⊆ S(π) (e.g., for SAT: models ofgiven formula)

• neighbourhood relation N(π) ⊆ S(π)× S(π) (e.g., forSAT: neighbouring variable assignments differ in thetruth value of exactly one variable)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 49/74

Page 112: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition: Stochastic Local SearchAlgorithm (1)

For given problem instance π:

• search space S(π) (e.g., for SAT: set of all completetruth assignments to propositional variables)

• solution set S ′(π) ⊆ S(π) (e.g., for SAT: models ofgiven formula)

• neighbourhood relation N(π) ⊆ S(π)× S(π) (e.g., forSAT: neighbouring variable assignments differ in thetruth value of exactly one variable)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 49/74

Page 113: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition: Stochastic Local SearchAlgorithm (1)

For given problem instance π:

• search space S(π) (e.g., for SAT: set of all completetruth assignments to propositional variables)

• solution set S ′(π) ⊆ S(π) (e.g., for SAT: models ofgiven formula)

• neighbourhood relation N(π) ⊆ S(π)× S(π) (e.g., forSAT: neighbouring variable assignments differ in thetruth value of exactly one variable)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 49/74

Page 114: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition: Stochastic Local SearchAlgorithm (2)

• set of memory states M(π) (may consist of a singlestate, for SLS algorithms that do not use memory)

• initialisation function init : ∅ 7→ D(S(π)×M(π))(specifies probability distribution over initial searchpositions and memory states)

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

• termination predicateterminate : S(π)×M(π) 7→ D({>,⊥}) (determines thetermination probability for each search position andmemory state)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 50/74

Page 115: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition: Stochastic Local SearchAlgorithm (2)

• set of memory states M(π) (may consist of a singlestate, for SLS algorithms that do not use memory)

• initialisation function init : ∅ 7→ D(S(π)×M(π))(specifies probability distribution over initial searchpositions and memory states)

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

• termination predicateterminate : S(π)×M(π) 7→ D({>,⊥}) (determines thetermination probability for each search position andmemory state)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 50/74

Page 116: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition: Stochastic Local SearchAlgorithm (2)

• set of memory states M(π) (may consist of a singlestate, for SLS algorithms that do not use memory)

• initialisation function init : ∅ 7→ D(S(π)×M(π))(specifies probability distribution over initial searchpositions and memory states)

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

• termination predicateterminate : S(π)×M(π) 7→ D({>,⊥}) (determines thetermination probability for each search position andmemory state)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 50/74

Page 117: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition: Stochastic Local SearchAlgorithm (2)

• set of memory states M(π) (may consist of a singlestate, for SLS algorithms that do not use memory)

• initialisation function init : ∅ 7→ D(S(π)×M(π))(specifies probability distribution over initial searchpositions and memory states)

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

• termination predicateterminate : S(π)×M(π) 7→ D({>,⊥}) (determines thetermination probability for each search position andmemory state)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 50/74

Page 118: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

procedure SLS-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 SLS-Decision

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 51/74

Page 119: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

procedure SLS-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 SLS-Decision

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 51/74

Page 120: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

procedure SLS-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 SLS-Decision

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 51/74

Page 121: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

procedure SLS-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 SLS-Decision

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 51/74

Page 122: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

procedure SLS-Minimisation(π′)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 SLS-Minimisation

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 52/74

Page 123: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

• Procedural versions of init, step and terminateimplement sampling from respective probabilitydistributions.

• Memory state m can consist of multiple independentattributes, i.e., M(π) := M1 ×M2 × . . .×Ml(π).

• SLS algorithms realise Markov processes: behaviour inany search state (s,m) depends only on current positions and (limited) memory m.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 53/74

Page 124: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

• Procedural versions of init, step and terminateimplement sampling from respective probabilitydistributions.

• Memory state m can consist of multiple independentattributes, i.e., M(π) := M1 ×M2 × . . .×Ml(π).

• SLS algorithms realise Markov processes: behaviour inany search state (s,m) depends only on current positions and (limited) memory m.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 53/74

Page 125: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

• Procedural versions of init, step and terminateimplement sampling from respective probabilitydistributions.

• Memory state m can consist of multiple independentattributes, i.e., M(π) := M1 ×M2 × . . .×Ml(π).

• SLS algorithms realise Markov processes: behaviour inany search state (s,m) depends only on current positions and (limited) memory m.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 53/74

Page 126: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT (1)

• search space S : set of all truth assignments tovariables in given formula F

• solution set S ′: set of all models of F

• neighbourhood relation N: 1-flip neighbourhood, i.e.,assignments are neighbours under N iff they differ in thetruth value of exactly one variable

• memory: not used, i.e., M := {0}

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 54/74

Page 127: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT (1)

• search space S : set of all truth assignments tovariables in given formula F

• solution set S ′: set of all models of F

• neighbourhood relation N: 1-flip neighbourhood, i.e.,assignments are neighbours under N iff they differ in thetruth value of exactly one variable

• memory: not used, i.e., M := {0}

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 54/74

Page 128: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT (1)

• search space S : set of all truth assignments tovariables in given formula F

• solution set S ′: set of all models of F

• neighbourhood relation N: 1-flip neighbourhood, i.e.,assignments are neighbours under N iff they differ in thetruth value of exactly one variable

• memory: not used, i.e., M := {0}

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 54/74

Page 129: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT(continued)

• initialisation: uniform random choice from S , i.e.,init()(a′,m) := 1/#S for all assignments a′ and memorystates m

• step function: uniform random choice from currentneighbourhood, i.e., step(a,m)(a′,m) := 1/#N(a)for all assignments a and memory states m,where N(a) := {a′ ∈ S | N(a, a′)} is the set of allneighbours of a.

• termination: when model is found, i.e.,terminate(a,m)(>) := 1 if a is a model of F , and 0otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 55/74

Page 130: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT(continued)

• initialisation: uniform random choice from S , i.e.,init()(a′,m) := 1/#S for all assignments a′ and memorystates m

• step function: uniform random choice from currentneighbourhood, i.e., step(a,m)(a′,m) := 1/#N(a)for all assignments a and memory states m,where N(a) := {a′ ∈ S | N(a, a′)} is the set of allneighbours of a.

• termination: when model is found, i.e.,terminate(a,m)(>) := 1 if a is a model of F , and 0otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 55/74

Page 131: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Uninformed random walk for SAT(continued)

• initialisation: uniform random choice from S , i.e.,init()(a′,m) := 1/#S for all assignments a′ and memorystates m

• step function: uniform random choice from currentneighbourhood, i.e., step(a,m)(a′,m) := 1/#N(a)for all assignments a and memory states m,where N(a) := {a′ ∈ S | N(a, a′)} is the set of allneighbours of a.

• termination: when model is found, i.e.,terminate(a,m)(>) := 1 if a is a model of F , and 0otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 55/74

Page 132: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• neighbourhood (set) of candidate solution s:N(s) := {s ′ ∈ S | N(s, s ′)}

• neighbourhood graph of problem instance π:GN(π) := (S(π),N(π))

Note: Diameter of GN = worst-case lower bound for numberof search steps required for reaching (optimal) solutions

Example: SAT instance with n variables, 1-flipneighbourhood: GN = n-dimensional hypercube; diameter ofGN = n.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 56/74

Page 133: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• neighbourhood (set) of candidate solution s:N(s) := {s ′ ∈ S | N(s, s ′)}

• neighbourhood graph of problem instance π:GN(π) := (S(π),N(π))

Note: Diameter of GN = worst-case lower bound for numberof search steps required for reaching (optimal) solutions

Example: SAT instance with n variables, 1-flipneighbourhood: GN = n-dimensional hypercube; diameter ofGN = n.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 56/74

Page 134: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• neighbourhood (set) of candidate solution s:N(s) := {s ′ ∈ S | N(s, s ′)}

• neighbourhood graph of problem instance π:GN(π) := (S(π),N(π))

Note: Diameter of GN = worst-case lower bound for numberof search steps required for reaching (optimal) solutions

Example: SAT instance with n variables, 1-flipneighbourhood: GN = n-dimensional hypercube; diameter ofGN = n.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 56/74

Page 135: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• neighbourhood (set) of candidate solution s:N(s) := {s ′ ∈ S | N(s, s ′)}

• neighbourhood graph of problem instance π:GN(π) := (S(π),N(π))

Note: Diameter of GN = worst-case lower bound for numberof search steps required for reaching (optimal) solutions

Example: SAT instance with n variables, 1-flipneighbourhood: GN = n-dimensional hypercube; diameter ofGN = n.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 56/74

Page 136: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

k-exchange neighbourhood: candidate solutions s, s ′ areneighbours iff s differs from s ′ in at most k solutioncomponents

Examples:

• 1-flip neighbourhood for SAT (solution components =single variable assignments)

• 2-exchange neighbourhood for TSP (solutioncomponents = edges in given graph)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 57/74

Page 137: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

k-exchange neighbourhood: candidate solutions s, s ′ areneighbours iff s differs from s ′ in at most k solutioncomponents

Examples:

• 1-flip neighbourhood for SAT (solution components =single variable assignments)

• 2-exchange neighbourhood for TSP (solutioncomponents = edges in given graph)

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 57/74

Page 138: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Search steps in the 2-exchange neighbourhood for theTSP

u4 u3

u1 u2

u4 u3

u1 u2

2-exchange

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 58/74

Page 139: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• Search step (or move): pair of search positions s, s ′ forwhich s ′ can be reached from s in one step, i.e., N(s, s ′)and step(s,m)(s ′,m′) > 0 for some memory statesm,m′ ∈ M.

• Search trajectory: finite sequence of search positions(s0, s1, . . . , sk) such that (si−1, si ) is a search step forany i ∈ {1, . . . , k} and the probability of initialising thesearch at s0 is greater zero, i.e., init(s0,m) > 0 for somememory state m ∈ M.

• Search strategy: specified by init and step function; tosome extent independent of problem instance and othercomponents of SLS algorithm.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 59/74

Page 140: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• Search step (or move): pair of search positions s, s ′ forwhich s ′ can be reached from s in one step, i.e., N(s, s ′)and step(s,m)(s ′,m′) > 0 for some memory statesm,m′ ∈ M.

• Search trajectory: finite sequence of search positions(s0, s1, . . . , sk) such that (si−1, si ) is a search step forany i ∈ {1, . . . , k} and the probability of initialising thesearch at s0 is greater zero, i.e., init(s0,m) > 0 for somememory state m ∈ M.

• Search strategy: specified by init and step function; tosome extent independent of problem instance and othercomponents of SLS algorithm.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 59/74

Page 141: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definitions

• Search step (or move): pair of search positions s, s ′ forwhich s ′ can be reached from s in one step, i.e., N(s, s ′)and step(s,m)(s ′,m′) > 0 for some memory statesm,m′ ∈ M.

• Search trajectory: finite sequence of search positions(s0, s1, . . . , sk) such that (si−1, si ) is a search step forany i ∈ {1, . . . , k} and the probability of initialising thesearch at s0 is greater zero, i.e., init(s0,m) > 0 for somememory state m ∈ M.

• Search strategy: specified by init and step function; tosome extent independent of problem instance and othercomponents of SLS algorithm.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 59/74

Page 142: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Uninformed Random Picking

• N := S × S

• does not use memory

• init, step: uniform random choice from S , i.e., for alls, s ′ ∈ S , init(s) := step(s)(s ′) := 1/#S

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 60/74

Page 143: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Uninformed Random Picking

• N := S × S

• does not use memory

• init, step: uniform random choice from S , i.e., for alls, s ′ ∈ S , init(s) := step(s)(s ′) := 1/#S

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 60/74

Page 144: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Uninformed Random Walk

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from currentneighbourhood, i.e., for all s, s ′ ∈ S ,step(s)(s ′) := 1/#N(s) if N(s, s ′),and 0 otherwise

Note: These uninformed SLS strategies are quite ineffective,but play a role in combination with more directed searchstrategies.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 61/74

Page 145: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Uninformed Random Walk

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from currentneighbourhood, i.e., for all s, s ′ ∈ S ,step(s)(s ′) := 1/#N(s) if N(s, s ′),and 0 otherwise

Note: These uninformed SLS strategies are quite ineffective,but play a role in combination with more directed searchstrategies.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 61/74

Page 146: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Uninformed Random Walk

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from currentneighbourhood, i.e., for all s, s ′ ∈ S ,step(s)(s ′) := 1/#N(s) if N(s, s ′),and 0 otherwise

Note: These uninformed SLS strategies are quite ineffective,but play a role in combination with more directed searchstrategies.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 61/74

Page 147: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Evaluation function:

• function g(π) : S(π) 7→ R that maps candidate solutionsof a given problem instance π onto real numbers, suchthat global optima correspond to solutions of π;

• used for ranking or assessing neighbhours of currentsearch position to provide guidance to search process.

Evaluation vs objective functions:

• Evaluation function: part of SLS algorithm.

• Objective function: integral part of optimisationproblem.

• Some SLS methods use evaluation functions differentfrom given objective function (e.g., dynamic localsearch).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 62/74

Page 148: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Evaluation function:

• function g(π) : S(π) 7→ R that maps candidate solutionsof a given problem instance π onto real numbers, suchthat global optima correspond to solutions of π;

• used for ranking or assessing neighbhours of currentsearch position to provide guidance to search process.

Evaluation vs objective functions:

• Evaluation function: part of SLS algorithm.

• Objective function: integral part of optimisationproblem.

• Some SLS methods use evaluation functions differentfrom given objective function (e.g., dynamic localsearch).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 62/74

Page 149: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Evaluation function:

• function g(π) : S(π) 7→ R that maps candidate solutionsof a given problem instance π onto real numbers, suchthat global optima correspond to solutions of π;

• used for ranking or assessing neighbhours of currentsearch position to provide guidance to search process.

Evaluation vs objective functions:

• Evaluation function: part of SLS algorithm.

• Objective function: integral part of optimisationproblem.

• Some SLS methods use evaluation functions differentfrom given objective function (e.g., dynamic localsearch).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 62/74

Page 150: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Iterative Improvement (II)

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from improving neighbours,i.e., step(s)(s ′) := 1/#I (s) if s ′ ∈ I (s), and 0 otherwise,where I (s) := {s ′ ∈ S | N(s, s ′) ∧ g(s ′) < g(s)}

• terminates when no improving neighbour available (tobe revisited later)

• different variants through modifications of step function(to be revisited later)

Note: II is also known as iterative descent or hill-climbing.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 63/74

Page 151: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Iterative Improvement (II)

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from improving neighbours,i.e., step(s)(s ′) := 1/#I (s) if s ′ ∈ I (s), and 0 otherwise,where I (s) := {s ′ ∈ S | N(s, s ′) ∧ g(s ′) < g(s)}

• terminates when no improving neighbour available (tobe revisited later)

• different variants through modifications of step function(to be revisited later)

Note: II is also known as iterative descent or hill-climbing.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 63/74

Page 152: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Iterative Improvement (II)

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from improving neighbours,i.e., step(s)(s ′) := 1/#I (s) if s ′ ∈ I (s), and 0 otherwise,where I (s) := {s ′ ∈ S | N(s, s ′) ∧ g(s ′) < g(s)}

• terminates when no improving neighbour available (tobe revisited later)

• different variants through modifications of step function(to be revisited later)

Note: II is also known as iterative descent or hill-climbing.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 63/74

Page 153: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Iterative Improvement (II)

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from improving neighbours,i.e., step(s)(s ′) := 1/#I (s) if s ′ ∈ I (s), and 0 otherwise,where I (s) := {s ′ ∈ S | N(s, s ′) ∧ g(s ′) < g(s)}

• terminates when no improving neighbour available (tobe revisited later)

• different variants through modifications of step function(to be revisited later)

Note: II is also known as iterative descent or hill-climbing.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 63/74

Page 154: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Iterative Improvement (II)

• does not use memory

• init: uniform random choice from S

• step: uniform random choice from improving neighbours,i.e., step(s)(s ′) := 1/#I (s) if s ′ ∈ I (s), and 0 otherwise,where I (s) := {s ′ ∈ S | N(s, s ′) ∧ g(s ′) < g(s)}

• terminates when no improving neighbour available (tobe revisited later)

• different variants through modifications of step function(to be revisited later)

Note: II is also known as iterative descent or hill-climbing.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 63/74

Page 155: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Iterative Improvement for SAT (1)

• search space S : set of all truth assignments tovariables in given formula F

• solution set S ′: set of all models of F

• neighbourhood relation N: 1-flip neighbourhood (asin Uninformed Random Walk for SAT)

• memory: not used, i.e., M := {0}• initialisation: uniform random choice from S , i.e.,

init()(a′) := 1/#S for all assignments a′

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 64/74

Page 156: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Iterative Improvement for SAT (1)

• search space S : set of all truth assignments tovariables in given formula F

• solution set S ′: set of all models of F

• neighbourhood relation N: 1-flip neighbourhood (asin Uninformed Random Walk for SAT)

• memory: not used, i.e., M := {0}• initialisation: uniform random choice from S , i.e.,

init()(a′) := 1/#S for all assignments a′

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 64/74

Page 157: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Iterative Improvement for SAT(continued)

• evaluation function: g(a) := number of clauses in Fthat are unsatisfied under assignment a (Note: g(a) = 0iff a is a model of F .)

• step function: uniform random choice from improvingneighbours, i.e., step(a)(a′) := 1/#I (a) if s ′ ∈ I (a),and 0 otherwise, whereI (a) := {a′ | N(a, a′) ∧ g(a′) < g(a)}

• termination: when no improving neighbour is availablei.e., terminate(a)(>) := 1 if I (a) = ∅, and 0 otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 65/74

Page 158: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Iterative Improvement for SAT(continued)

• evaluation function: g(a) := number of clauses in Fthat are unsatisfied under assignment a (Note: g(a) = 0iff a is a model of F .)

• step function: uniform random choice from improvingneighbours, i.e., step(a)(a′) := 1/#I (a) if s ′ ∈ I (a),and 0 otherwise, whereI (a) := {a′ | N(a, a′) ∧ g(a′) < g(a)}

• termination: when no improving neighbour is availablei.e., terminate(a)(>) := 1 if I (a) = ∅, and 0 otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 65/74

Page 159: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Iterative Improvement for SAT(continued)

• evaluation function: g(a) := number of clauses in Fthat are unsatisfied under assignment a (Note: g(a) = 0iff a is a model of F .)

• step function: uniform random choice from improvingneighbours, i.e., step(a)(a′) := 1/#I (a) if s ′ ∈ I (a),and 0 otherwise, whereI (a) := {a′ | N(a, a′) ∧ g(a′) < g(a)}

• termination: when no improving neighbour is availablei.e., terminate(a)(>) := 1 if I (a) = ∅, and 0 otherwise.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 65/74

Page 160: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Incremental updates (aka delta evaluations)

• Key idea: calculate effects of differences betweencurrent search position s and neighbours s ′ onevaluation function value.

• Evaluation function values often consist of independentcontributions of solution components; hence, g(s) canbe efficiently calculated from g(s ′) by differencesbetween s and s ′ in terms of solution components.

• Typically crucial for the efficient implementation of IIalgorithms (and other SLS techniques).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 66/74

Page 161: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Incremental updates (aka delta evaluations)

• Key idea: calculate effects of differences betweencurrent search position s and neighbours s ′ onevaluation function value.

• Evaluation function values often consist of independentcontributions of solution components; hence, g(s) canbe efficiently calculated from g(s ′) by differencesbetween s and s ′ in terms of solution components.

• Typically crucial for the efficient implementation of IIalgorithms (and other SLS techniques).

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 66/74

Page 162: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Incremental updates for TSP

• solution components = edges of given graph G

• standard 2-exchange neighbhourhood, i.e., neighbouringround trips p, p′ differ in two edges

• w(p′) := w(p) − edges in p but not in p′ +edges in p′ but not in p

Note: Constant time (4 arithmetic operations), compared tolinear time (n arithmethic operations for graph with nvertices) for computing w(p′) from scratch.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 67/74

Page 163: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Example: Incremental updates for TSP

• solution components = edges of given graph G

• standard 2-exchange neighbhourhood, i.e., neighbouringround trips p, p′ differ in two edges

• w(p′) := w(p) − edges in p but not in p′ +edges in p′ but not in p

Note: Constant time (4 arithmetic operations), compared tolinear time (n arithmethic operations for graph with nvertices) for computing w(p′) from scratch.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 67/74

Page 164: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition:

• Local minimum: search position without improvingneighbours w.r.t. given evaluation function g andneighbourhood N, i.e., position s ∈ S such thatg(s) ≤ g(s ′) for all s ′ ∈ N(s).

• Strict local minimum: search position s ∈ S such thatg(s) < g(s ′) for all s ′ ∈ N(s).

• Local maxima and strict local maxima: definedanalogously.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 68/74

Page 165: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Definition:

• Local minimum: search position without improvingneighbours w.r.t. given evaluation function g andneighbourhood N, i.e., position s ∈ S such thatg(s) ≤ g(s ′) for all s ′ ∈ N(s).

• Strict local minimum: search position s ∈ S such thatg(s) < g(s ′) for all s ′ ∈ N(s).

• Local maxima and strict local maxima: definedanalogously.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 68/74

Page 166: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational complexity of local search (1)

For a local search algorithm to be effective, searchinitialisation and individual search steps should be efficientlycomputable.

Complexity class PLS (Polynomial Local Search): class ofproblems for which a local search algorithm exists withpolynomial time complexity for:

• search initialisation

• any single search step, including computation of anyevaluation function value

For any problem in PLS . . .

• local optimality can be verified in polynomial time

• improving search steps can be computed in polynomialtime, but: finding local optima may requiresuper-polynomial time

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 69/74

Page 167: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational complexity of local search (1)

For a local search algorithm to be effective, searchinitialisation and individual search steps should be efficientlycomputable.

Complexity class PLS (Polynomial Local Search): class ofproblems for which a local search algorithm exists withpolynomial time complexity for:

• search initialisation

• any single search step, including computation of anyevaluation function value

For any problem in PLS . . .

• local optimality can be verified in polynomial time

• improving search steps can be computed in polynomialtime, but: finding local optima may requiresuper-polynomial time

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 69/74

Page 168: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational complexity of local search (1)

For a local search algorithm to be effective, searchinitialisation and individual search steps should be efficientlycomputable.

Complexity class PLS (Polynomial Local Search): class ofproblems for which a local search algorithm exists withpolynomial time complexity for:

• search initialisation

• any single search step, including computation of anyevaluation function value

For any problem in PLS . . .

• local optimality can be verified in polynomial time

• improving search steps can be computed in polynomialtime, but: finding local optima may requiresuper-polynomial time

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 69/74

Page 169: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational complexity of local search (1)

For a local search algorithm to be effective, searchinitialisation and individual search steps should be efficientlycomputable.

Complexity class PLS (Polynomial Local Search): class ofproblems for which a local search algorithm exists withpolynomial time complexity for:

• search initialisation

• any single search step, including computation of anyevaluation function value

For any problem in PLS . . .

• local optimality can be verified in polynomial time

• improving search steps can be computed in polynomialtime, but: finding local optima may requiresuper-polynomial time

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 69/74

Page 170: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational complexity of local search (2)

PLS-complete: Among the most difficult problems in PLS;if for any of these problems local optima can be found inpolynomial time, the same would hold for all problems inPLS.

Some complexity results:

• TSP with k-exchange neighbourhood with k > 3 isPLS-complete.

• TSP with 2- or 3-exchange neighbourhood is in PLS,but PLS-completeness is unknown.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 70/74

Page 171: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Computational complexity of local search (2)

PLS-complete: Among the most difficult problems in PLS;if for any of these problems local optima can be found inpolynomial time, the same would hold for all problems inPLS.

Some complexity results:

• TSP with k-exchange neighbourhood with k > 3 isPLS-complete.

• TSP with 2- or 3-exchange neighbourhood is in PLS,but PLS-completeness is unknown.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 70/74

Page 172: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Simple mechanisms for escaping from localoptima:

• Restart: re-initialise search whenever a local optimum isencountered. (Often rather ineffective due to cost ofinitialisation.)

• Non-improving steps: in local optima, allow selection ofcandidate solutions with equal or worse evaluationfunction value, e.g., using minimally worsening steps.(Can lead to long walks in plateaus, i.e., regions ofsearch positions with identical evaluation function.)

Note: Neither of these mechanisms is guaranteed to alwaysescape effectively from local optima.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 71/74

Page 173: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Simple mechanisms for escaping from localoptima:

• Restart: re-initialise search whenever a local optimum isencountered. (Often rather ineffective due to cost ofinitialisation.)

• Non-improving steps: in local optima, allow selection ofcandidate solutions with equal or worse evaluationfunction value, e.g., using minimally worsening steps.(Can lead to long walks in plateaus, i.e., regions ofsearch positions with identical evaluation function.)

Note: Neither of these mechanisms is guaranteed to alwaysescape effectively from local optima.

FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 71/74

Page 174: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Diversification vs Intensification

• Goal-directed and randomised components of SLSstrategy need to be balanced carefully.

• Intensification: aims to greedily increase solution qualityor probability, e.g., by exploiting the evaluation function.

• Diversification: aim to prevent search stagnation bypreventing search process from getting trapped inconfined regions.

Examples:

• Iterative Improvement (II): intensification strategy.

• Uninformed Random Walk (URW): diversificationstrategy.

Balanced combination of intensification and diversificationmechanisms forms the basis for advanced SLS methods.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 72/74

Page 175: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Diversification vs Intensification

• Goal-directed and randomised components of SLSstrategy need to be balanced carefully.

• Intensification: aims to greedily increase solution qualityor probability, e.g., by exploiting the evaluation function.

• Diversification: aim to prevent search stagnation bypreventing search process from getting trapped inconfined regions.

Examples:

• Iterative Improvement (II): intensification strategy.

• Uninformed Random Walk (URW): diversificationstrategy.

Balanced combination of intensification and diversificationmechanisms forms the basis for advanced SLS methods.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 72/74

Page 176: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Diversification vs Intensification

• Goal-directed and randomised components of SLSstrategy need to be balanced carefully.

• Intensification: aims to greedily increase solution qualityor probability, e.g., by exploiting the evaluation function.

• Diversification: aim to prevent search stagnation bypreventing search process from getting trapped inconfined regions.

Examples:

• Iterative Improvement (II): intensification strategy.

• Uninformed Random Walk (URW): diversificationstrategy.

Balanced combination of intensification and diversificationmechanisms forms the basis for advanced SLS methods.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 72/74

Page 177: Combinatorial problems and Search - Monash Universityusers.monash.edu.au/~aldeidaa/FIT4012/Lectures/lecture1.pdf · Combinatorial problems and Search FIT4012 Advanced topics in computational

monash un i v er s i ty f i t

Diversification vs Intensification

• Goal-directed and randomised components of SLSstrategy need to be balanced carefully.

• Intensification: aims to greedily increase solution qualityor probability, e.g., by exploiting the evaluation function.

• Diversification: aim to prevent search stagnation bypreventing search process from getting trapped inconfined regions.

Examples:

• Iterative Improvement (II): intensification strategy.

• Uninformed Random Walk (URW): diversificationstrategy.

Balanced combination of intensification and diversificationmechanisms forms the basis for advanced SLS methods.FIT4012 Advanced topics in computational science — Combinatorial problems and Search

Slide 72/74