MCMC Simulated Annealing Exercises.

Similar documents
Markov Chain Monte Carlo. Simulated Annealing.

Simulated Annealing. Local Search. Cost function. Solution space

5. Simulated Annealing 5.1 Basic Concepts. Fall 2010 Instructor: Dr. Masoud Yaghini

Monte Carlo Integration I [RC] Chapter 3

Tractable & Intractable Problems

SIMU L TED ATED ANNEA L NG ING

Motivation, Basic Concepts, Basic Methods, Travelling Salesperson Problem (TSP), Algorithms

Travelling Salesman Problem

Optimization Methods II. EM algorithms.

7.1 Basis for Boltzmann machine. 7. Boltzmann machines

Motivation, Basic Concepts, Basic Methods, Travelling Salesperson Problem (TSP), Algorithms

6 Markov Chain Monte Carlo (MCMC)

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 20 Travelling Salesman Problem

The quest for finding Hamiltonian cycles

ECS122A Handout on NP-Completeness March 12, 2018

8.3 Hamiltonian Paths and Circuits

Spin Glas Dynamics and Stochastic Optimization Schemes. Karl Heinz Hoffmann TU Chemnitz

Who Has Heard of This Problem? Courtesy: Jeremy Kun

Data Structures and Algorithms (CSCI 340)

Ant Colony Optimization: an introduction. Daniel Chivilikhin

NP-Completeness. Until now we have been designing algorithms for specific problems

Algorithm Design Strategies V

Optimization Methods via Simulation

Data Structures in Java

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

1 Heuristics for the Traveling Salesman Problem

x 2 i 10 cos(2πx i ). i=1

Algorithms and Complexity theory

Methods for finding optimal configurations

Finding optimal configurations ( combinatorial optimization)

NP-completeness. Chapter 34. Sergey Bereg

July 18, Approximation Algorithms (Travelling Salesman Problem)

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness.

Nondeterministic Polynomial Time

Design and Analysis of Algorithms

Zebo Peng Embedded Systems Laboratory IDA, Linköping University

PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE

5. Simulated Annealing 5.2 Advanced Concepts. Fall 2010 Instructor: Dr. Masoud Yaghini

SAT, Coloring, Hamiltonian Cycle, TSP

Simulated Annealing applied to the Traveling Salesman Problem. Eric Miller

Monte Carlo methods for sampling-based Stochastic Optimization

Turing Machines and Time Complexity

Correctness of Dijkstra s algorithm

Mathematics for Decision Making: An Introduction. Lecture 8

Combinatorial Optimization

P vs. NP. Data Structures and Algorithms CSE AU 1

Introduction to Machine Learning CMU-10701

Methods for finding optimal configurations

Data Structures in Java. Session 22 Instructor: Bert Huang

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint

The Traveling Salesman Problem: An Overview. David P. Williamson, Cornell University Ebay Research January 21, 2014

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

CMSC 441: Algorithms. NP Completeness

TRAVELING SALESMAN PROBLEM WITH TIME WINDOWS (TSPTW)

VIII. NP-completeness

Quantum Complexity Theory. Wim van Dam HP Labs MSRI UC Berkeley SQUINT 3 June 16, 2003

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

6. APPLICATION TO THE TRAVELING SALESMAN PROBLEM

Computational statistics

P, NP, NP-Complete. Ruth Anderson

Algorithms Re-Exam TIN093/DIT600

Checking for optimal solutions in some N P -complete problems

CS/COE

Hertz, Krogh, Palmer: Introduction to the Theory of Neural Computation. Addison-Wesley Publishing Company (1991). (v ji (1 x i ) + (1 v ji )x i )

Computational Complexity

Single Machine Models

Lecture 4: NP and computational intractability

Simulated Annealing. 2.1 Introduction

Computational Complexity

NP Completeness and Approximation Algorithms

NP-Complete Problems. More reductions

NP-Complete Problems and Approximation Algorithms

SYSTEMS SCIENCE AND CYBERNETICS Vol. III Simulated Annealing: From Statistical Thermodynamics to Combinatory Problems Solving - D.

The P = NP Problem Bristol Teachers Circle, June P.D.Welch, University of Bristol

Lin-Kernighan Heuristic. Simulated Annealing

The Traveling Salesman Problem New Mexico Supercomputing Challenge Final Report April 6 th, 2016 Team 104 School of Dreams Academy

Bounds on the Traveling Salesman Problem

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

Topics in Complexity Theory

Chapter 34: NP-Completeness

Swarm Intelligence Traveling Salesman Problem and Ant System

Hill climbing: Simulated annealing and Tabu search

ECS 120 Lesson 24 The Class N P, N P-complete Problems

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

Metaheuristics. 2.3 Local Search 2.4 Simulated annealing. Adrian Horga

from notes written mostly by Dr. Matt Stallmann: All Rights Reserved

Local Search. Shin Yoo CS492D, Fall 2015, School of Computing, KAIST

Data Structures and Algorithms

Computer Practical: Metropolis-Hastings-based MCMC

A Survey on Travelling Salesman Problem

NP and Computational Intractability

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

An electronic algorithm to find the optimal solution for the travelling salesman problem

Lecture 4: Simulated Annealing. An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved

Why Water Freezes (A probabilistic view of phase transitions)

Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005

Principles of Computing, Carnegie Mellon University. The Limits of Computing

1.1 P, NP, and NP-complete

Transcription:

Aula 10. Simulated Annealing. 0 MCMC Simulated Annealing Exercises. Anatoli Iambartsev IME-USP

Aula 10. Simulated Annealing. 1 [Wiki] Salesman problem. The travelling salesman problem (TSP), or, in recent years, the travelling salesperson problem, asks the following question: Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city? It is an NP-hard problem in combinatorial optimization, important in operations research and theoretical computer science. (NP-hardness (non-deterministic polynomial-time hard), in computational complexity theory, is the defining property of a class of problems that are, informally, at least as hard as the hardest problems in NP.... A common misconception is that the NP in NP-hard stands for non-polynomial when in fact it stands for Non-deterministic Polynomial acceptable problems. Although it is suspected that there are no polynomial-time algorithms for NP-hard problems, this has not been proven. Moreover, the class P in which all problems can be solved in polynomial time, is contained in the NP class.)

Aula 10. Simulated Annealing. 2 Salesman problem. We will consider this problem without the condition returns to the origin city. n=20 # number of cities L=10 # side of square where cities are x=l*runif(n) # x-coordinates of cities y=l*runif(n) # y-coordinates of cities path=seq(1:n) # path of a salesman plot(x,y,xlim=c(0,l),ylim=c(0,l),type="b")

Aula 10. Simulated Annealing. 3 Salesman problem. dist=function(path){ d=0; #for (i in 2:length(path)){ # x1=x[path[i-1]] # y1=y[path[i-1]] # x2=x[path[i]] # y2=y[path[i]] # d=d+sqrt((x1-x2)^2+(y1-y2)^2) #} k=length(path) xx=x[path]; yy=y[path] d=d+sum(sqrt((xx[1:(k-1)]-xx[2:k])^2+(xx[1:(k-1)]-xx[2:k])^2)) d; }

Aula 10. Simulated Annealing. 4 Salesman problem.

Aula 10. Simulated Annealing. 5 Salesman problem. Walks on the set of paths. Choose a subpath of a path and revert the order pair=sample.int(n,2); nmin=min(pair) nmax=max(pair) newpath=path newpath[nmin:nmax]=rev(path[nmin:nmax]) Observe that P(path newpath) = P(newpath path) = 1 ( n 2)

Aula 10. Simulated Annealing. 6 Salesman problem.

Aula 10. Simulated Annealing. 7 Salesman problem. Exercises. 1. Rewrite the algorithm for the salesman problem with the condition returns to the origin city. 2. Suggest another walk g on symmetric group S n (set of all permutations of sequence 1, 2,..., n). 3. Instead of the (super-)fast annealing cooling schedule T t+1 /T t = α (0, 1), use in simulated annealing different cooling schedule: T t = 1/ log(1 + t) (Boltzman s annealing), T t = 1/t (Cauchy s annealing). 4. Matching problem. In a square there are n red and n blue points. We connect one red and one blue point by an interval, the weight of this connection (matching) is the distance between them. The aim is to match any red point with blue one such that a total weight of matching should be minimal.

Aula 10. Simulated Annealing. 8 [RC] Example 5.8. For the simple function h(x) = [cos(50x) + sin(20x)] 2, we can compare the impact of using different temperature schedules on the performance of the simulated annealing sequences. Note that, besides setting a temperature sequence, we also need to set a scale value (or sequence) for the distribution g of the perturbations as well as a stopping rule. Since the domain is [0, 1], we use a uniform U( ρ, ρ) distribution for g and our stopping rule is that the algorithm will stop when the observed maximum of h has not changed in the second half of the sequence {x t }.

Aula 10. Simulated Annealing. 9

Aula 10. Simulated Annealing. 10 [RC] Example 5.8. The constraint involving unique is cancelling the stopping rule when no perturbation has been accepted in the second half of the iterations, meaning that the scale may then be inappropriate. (Note that the updates of temp and scale need to be included in the loop.) For a scale defined by T t and a temperature decrease in 1/ log(1+ t), the sequence almost always ends up at a value close to the true maximum. Similarly, a scale defined by 5 T t and a temperature decrease in 1/(1 + t) 2 leads almost certainly to the global maximum, as shown on Figure 5.8 (where the last example was obtained after several runs). Decreasing the scale by a factor of ten has a clear and negative impact on the performance of the algorithm.

Aula 10. Simulated Annealing. 11 Fig. 5.8. Realizations of four simulated annealing sequences for T t =1/(t+1) 2 and ρ =5 T t over the graph of the function h (grey). Note that the points represented on the graph of h correspond to successive accepted values in Algorithm 2 and do not reflect the number of iterations.

Aula 10. Simulated Annealing. 12 [Wiki] Cooling schedule. The physical analogy that is used to justify SA assumes that the cooling rate is low enough for the probability distribution of the current state to be near thermodynamic equilibrium at all times. Unfortunately, the relaxation time the time one must wait for the equilibrium to be restored after a change in temperature strongly depends on the topography of the energy function and on the current temperature. In the SA algorithm, the relaxation time also depends on the candidate generator, in a very complicated way. Note that all these parameters are usually provided as black box functions to the SA algorithm. Therefore, the ideal cooling rate cannot be determined beforehand, and should be empirically adjusted for each problem. Adaptive simulated annealing algorithms address this problem by connecting the cooling schedule to the search progress.

Aula 10. Simulated Annealing. 13 References. [RC] Cristian P. Robert and George Casella. Introducing Monte Carlo Methods with R. Series Use R!. Springer Further reading. Adaptive simulated annealing. https://www.ingber.com/asa-readme.html Constantino Tsallis and Daniel A. Stariolo. Generalized simulated annealing, Physica A 233 (1996) 395 406. Heikki Haario and Eero Saksman. Simulated Annealing Process in General State Space, Advances in Applied Probability, Vol. 23, No. 4 (Dec., 1991), pp. 866 893