45
Empirical Hardness Models: Methods and Uses Lars Kotthoff University of British Columbia [email protected] 1QBit, 18 October 2016 1 / 44

Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Embed Size (px)

Citation preview

Page 1: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Empirical Hardness Models:Methods and Uses

Lars KotthoffUniversity of British Columbia

[email protected]

1QBit, 18 October 2016

1 / 44

Page 2: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Big Picture

▷ advance the state of the art through meta-algorithmictechniques

▷ rather than inventing new things, use existing things better▷ “supplement” our understanding of how algorithms work

▷ Algorithm Selection: choose the best algorithm to solve agiven problem

▷ Algorithm Configuration: find the best parameterisation▷ at the core of both: empirical performance models

2 / 44

Page 3: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Big Picture

▷ advance the state of the art through meta-algorithmictechniques

▷ rather than inventing new things, use existing things better▷ “supplement” our understanding of how algorithms work▷ Algorithm Selection: choose the best algorithm to solve a

given problem▷ Algorithm Configuration: find the best parameterisation▷ at the core of both: empirical performance models

2 / 44

Page 4: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Prominent Application

Fréchette, Alexandre, Neil Newman, Kevin Leyton-Brown. “Solving theStation Packing Problem.” In Association for the Advancement of ArtificialIntelligence (AAAI), 2016.

3 / 44

Page 5: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Performance Differences

0.1

1

10

100

1000

0.1 1 10 100 1000

Virt

ual B

est S

AT

Virtual Best CSP

Hurley, Barry, Lars Kotthoff, Yuri Malitsky, and Barry O’Sullivan. “Proteus:A Hierarchical Portfolio of Solvers and Transformations.” In CPAIOR, 2014.

4 / 44

Page 6: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Leveraging the Differences

Xu, Lin, Frank Hutter, Holger H. Hoos, and Kevin Leyton-Brown.“SATzilla: Portfolio-Based Algorithm Selection for SAT.” J. Artif. Intell. Res.(JAIR) 32 (2008): 565–606.

5 / 44

Page 7: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Performance Improvements

Configuration of a SAT Solver for Verification [Hutter et al, 2007]

Ran FocusedILS, 2 days × 10 machines

– On a training set from each benchmark

Compared to manually-engineered default

– 1 week of performance tuning

– Competitive with the state of the art

– Comparison on unseen test instances

10−2

10−1

100

101

102

103

104

10−2

10−1

100

101

102

103

104

SPEAR, original default (s)

SP

EA

R, optim

ized for

IBM

−B

MC

(s)

4.5-fold speedup

on hardware verification

10−2

10−1

100

101

102

103

104

10−2

10−1

100

101

102

103

104

SPEAR, original default (s)

SP

EA

R, optim

ized for

SW

V (

s)

500-fold speedup won category

QF BV in 2007 SMT competitionHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 17

Hutter, Frank, Domagoj Babic, Holger H. Hoos, and Alan J. Hu.“Boosting Verification by Automatic Tuning of Decision Procedures.” InFMCAD ’07: Proceedings of the Formal Methods in Computer Aided Design,27–34. Washington, DC, USA: IEEE Computer Society, 2007. 6 / 44

Page 8: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Algorithm Selection

Given a problem, choose the best algorithm to solve it.

7 / 44

Page 9: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Original Model

x ∈ PProblem space

A ∈ AAlgorithm space

p ∈ Rn

Performancemeasure space

‖p‖ = Algorithmperformance

S(x)

Selectionmapping

p(A,x)

Performancemapping

Normmapping

Rice, John R. “The Algorithm Selection Problem.” Advances in Computers15 (1976): 65–118.

8 / 44

Page 10: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Contemporary Model

x ∈ P

Problem spaceA ∈ A

Algorithm space

S

Selection modelS(x) = A

Prediction

p ∈ Rn

Performancemeasure

∀x ∈ P′⊂ P ,

A ∈ A :p(A,x)

Training data

Featureextraction

Feedback

9 / 44

Page 11: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Portfolios

▷ instead of a single algorithm, use several complementaryalgorithms

▷ idea from Economics – minimise risk by spreading it outacross several securities

▷ same for computational problems – minimise risk of algorithmperforming poorly

▷ in practice often constructed from competition winners

Huberman, Bernardo A., Rajan M. Lukose, and Tad Hogg. “An EconomicsApproach to Hard Computational Problems.” Science 275, no. 5296 (1997):51–54. doi:10.1126/science.275.5296.51.

10 / 44

Page 12: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Key Components of an Algorithm Selection System

▷ feature extraction▷ performance model▷ prediction-based selector/scheduler

optional:▷ presolver▷ secondary/hierarchical models and predictors (e.g. for feature

extraction time)

11 / 44

Page 13: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Features

▷ relate properties of problem instances to performance▷ relatively cheap to compute▷ specified by domain expert▷ syntactic – analyse instance description▷ probing – run algorithm for short time▷ dynamic – instance changes while algorithm is running

12 / 44

Page 14: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Syntactic Features

▷ number of variables, number of clauses/constraints/…▷ ratios▷ order of variables/values▷ clause/constraints–variable graph or variable graph:

▷ node degrees▷ connectivity▷ clustering coefficient▷ …

▷ …

13 / 44

Page 15: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Probing Features

▷ number of nodes/propagations within time limit▷ estimate of search space size▷ tightness of problem/constraints▷ …

14 / 44

Page 16: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Dynamic Features

▷ change of variable domains▷ number of constraint propagations▷ number of failures a clause participated in▷ …

15 / 44

Page 17: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

What Features do we need in Practice?

▷ trade-off between complex features and complex models▷ in practice, very simple features (e.g. problem size) can

perform well, depending on the model used

16 / 44

Page 18: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Types of Performance Models

▷ models for entire portfolios▷ models for individual algorithms▷ models that are somewhere in between (e.g. pairs of

algorithms)

17 / 44

Page 19: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Models for Entire Portfolios▷ predict the best algorithm in the portfolio▷ alternatively: cluster and assign best algorithms to clusters

optional (but important):▷ attach a “weight” during learning (e.g. the difference between

best and worst solver) to bias model towards the “important”instances

▷ special loss metric

Gent, Ian P., Christopher A. Jefferson, Lars Kotthoff, Ian Miguel, NeilMoore, Peter Nightingale, and Karen E. Petrie. “Learning When to Use LazyLearning in Constraint Solving.” In 19th European Conference on ArtificialIntelligence, 873–78, 2010.

Kadioglu, Serdar, Yuri Malitsky, Meinolf Sellmann, and Kevin Tierney.“ISAC – Instance-Specific Algorithm Configuration.” In 19th EuropeanConference on Artificial Intelligence, 751–56, 2010.

18 / 44

Page 20: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Models for Individual Algorithms

▷ predict the performance for each algorithm separately▷ combine the predictions to choose the best one▷ for example: predict the runtime for each algorithm, choose

the one with the lowest runtime

Xu, Lin, Frank Hutter, Holger H. Hoos, and Kevin Leyton-Brown.“SATzilla: Portfolio-Based Algorithm Selection for SAT.” J. Artif. Intell. Res.(JAIR) 32 (2008): 565–606.

19 / 44

Page 21: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Hybrid Models

▷ get the best of both worlds▷ for example: consider pairs of algorithms to take relations into

account▷ for each pair of algorithms, learn model that predicts which

one is faster

Xu, Lin, Frank Hutter, Holger H. Hoos, and Kevin Leyton-Brown.“Hydra-MIP: Automated Algorithm Configuration and Selection for MixedInteger Programming.” In RCRA Workshop on Experimental Evaluation ofAlgorithms for Solving Problems with Combinatorial Explosion at theInternational Joint Conference on Artificial Intelligence (IJCAI), 16–30, 2011.

Kotthoff, Lars. “Hybrid Regression-Classification Models for AlgorithmSelection.” In 20th European Conference on Artificial Intelligence, 480–85,2012.

20 / 44

Page 22: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Types of Predictions/Algorithm Selectors

▷ best algorithm▷ n best algorithms ranked▷ allocation of resources to n algorithms▷ change the currently running algorithm?

Kotthoff, Lars. “Ranking Algorithms by Performance.” In LION 8, 2014.

Kadioglu, Serdar, Yuri Malitsky, Ashish Sabharwal, Horst Samulowitz, andMeinolf Sellmann. “Algorithm Selection and Scheduling.” In 17th InternationalConference on Principles and Practice of Constraint Programming, 454–69,2011.

Stergiou, Kostas. “Heuristics for Dynamically Adapting Propagation inConstraint Satisfaction Problems.” AI Commun. 22, no. 3 (2009): 125–41.

21 / 44

Page 23: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Time of Prediction

before problem is being solved▷ select algorithm(s) once▷ no recourse if predictions are bad

while problem is being solved▷ continuously monitor problem features and/or performance▷ can remedy bad initial choice or react to changing problem

22 / 44

Page 24: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Example System – SATzilla

▷ 7 SAT solvers, 4811 problem instances▷ syntactic (33) and probing features (15)▷ ridge regression to predict log runtime for each solver, choose

the solver with the best predicted performance▷ later version uses random forests to predict better algorithm

for each pair, aggregation through simple voting scheme▷ pre-solving, feature computation time prediction, hierarchical

model▷ won several competitions

Xu, Lin, Frank Hutter, Holger H. Hoos, and Kevin Leyton-Brown.“SATzilla: Portfolio-Based Algorithm Selection for SAT.” J. Artif. Intell. Res.(JAIR) 32 (2008): 565–606.

23 / 44

Page 25: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Algorithm Configuration

Given a (set of) problem(s), find the best parameter configuration.

24 / 44

Page 26: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Algorithm Configuration

Frank Hutter and Marius Lindauer, “Algorithm Configuration: A Hands onTutorial”, AAAI 2016

25 / 44

Page 27: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search

▷ start with random configuration▷ change a single parameter (local search step)▷ if better, keep the change, else revert▷ repeat▷ optional (but important): restart with new random

configurations

Hutter, Frank, Holger H. Hoos, Kevin Leyton-Brown, and Thomas Stützle.“ParamILS: An Automatic Algorithm Configuration Framework.” J. Artif. Int.Res. 36, no. 1 (2009): 267–306.

26 / 44

Page 28: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Initialisation)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

27 / 44

Page 29: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Initialisation)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

28 / 44

Page 30: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Local Search)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

29 / 44

Page 31: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Local Search)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

30 / 44

Page 32: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Perturbation)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

31 / 44

Page 33: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Local Search)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

32 / 44

Page 34: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Local Search)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

33 / 44

Page 35: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

(Local Search)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

34 / 44

Page 36: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Local Search ExampleGoing Beyond Local Optima: Iterated Local Search

?

Selection (using Acceptance Criterion)

Animation credit: Holger HoosHutter & Lindauer AC-Tutorial AAAI 2016, Phoenix, USA 33

graphics by Holger Hoos

35 / 44

Page 37: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Model-Based Search

▷ build model of parameter-response surface▷ allows targeted exploration of new configurations▷ (can take instance features into account like algorithm

selection)

Hutter, Frank, Holger H. Hoos, and Kevin Leyton-Brown. “SequentialModel-Based Optimization for General Algorithm Configuration.” In LION 5,507–23, 2011.

36 / 44

Page 38: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Model-Based Search Example

● ●

●0.00

0.25

0.50

0.75

0.000

0.025

0.050

0.075

yei

0.00 0.25 0.50 0.75 1.00x

type

● init

prop

type

y

yhat

ei

Iter = 1, Gap = 0.0000e+00

graphics by Bernd Bischl with mlrMBO R package 37 / 44

Page 39: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Model-Based Search Example

● ●

●0.0

0.2

0.4

0.6

0.000

0.005

0.010

0.015

0.020

yei

0.00 0.25 0.50 0.75 1.00x

type

● init

prop

seq

type

y

yhat

ei

Iter = 6, Gap = 0.0000e+00

graphics by Bernd Bischl with mlrMBO R package 38 / 44

Page 40: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Model-Based Search Example

● ●

●0.0

0.2

0.4

0.6

0.000

0.002

0.004

0.006

0.008

yei

0.00 0.25 0.50 0.75 1.00x

type

● init

prop

seq

type

y

yhat

ei

Iter = 13, Gap = 0.0000e+00

graphics by Bernd Bischl with mlrMBO R package 39 / 44

Page 41: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Model-Based Search Example

● ●

●0.0

0.2

0.4

0.6

0.0000

0.0005

0.0010

0.0015

0.0020

0.0025

yei

0.00 0.25 0.50 0.75 1.00x

type

● init

prop

seq

type

y

yhat

ei

Iter = 20, Gap = 0.0000e+00

graphics by Bernd Bischl with mlrMBO R package 40 / 44

Page 42: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Overtuning

▷ similar to overfitting in machine learning▷ performance improves on training instances, but not on test

instances▷ configuration is too “tailored”, e.g. specific to satisfiable

instances▷ but can be combined with Algorithm Selection

41 / 44

Page 43: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Summary

Algorithm Selection choose the best algorithm for solving aproblem

Algorithm Configuration choose the best parameter configurationfor solving a problem with an algorithm

▷ mature research areas▷ can combine configuration and selection▷ effective tools are available

42 / 44

Page 44: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

Tools and Resources

Algorithm Selectionautofolio https://bitbucket.org/mlindauer/autofolio/LLAMA https://bitbucket.org/lkotthoff/llamaSATzilla http://www.cs.ubc.ca/labs/beta/Projects/SATzilla/

Algorithm ConfigurationiRace http://iridia.ulb.ac.be/irace/

mlrMBO https://github.com/mlr-org/mlrMBOSMAC http://www.cs.ubc.ca/labs/beta/Projects/SMAC/

Spearmint https://github.com/HIPS/SpearmintTPE https://jaberg.github.io/hyperopt/

Kotthoff, Lars. “Algorithm Selection for Combinatorial Search Problems: ASurvey.” AI Magazine 35, no. 3 (2014): 48–60.

43 / 44

Page 45: Empirical Hardness Models: Methods and Useslarsko/slides/1qb.pdf · Empirical Hardness Models: Methods and Uses ... “Boosting Verification by Automatic Tuning of Decision Procedures.”

COSEAL

Conf

igur

ation

and Selection of Algorithms

CO S E AL

Interested? Join the COSEAL group!

http://coseal.net 44 / 44