• Ingen resultater fundet

NP-completeness, NFL and Statistical Testing

N/A
N/A
Info
Hent
Protected

Academic year: 2022

Del "NP-completeness, NFL and Statistical Testing"

Copied!
27
0
0

Indlæser.... (se fuldtekst nu)

Hele teksten

(1)

NP-completeness, NFL and Statistical Testing

Thomas Stidsen

thst@man.dtu.dk

DTU-Management

Technical University of Denmark

(2)

Thomas Stidsen 2

Outline

NP completeness:

What are the hard problems ? ... and how hard are they ?

No-Free-Lunch theorem:

Are there any best search algorithms ? Statistical Testing:

How to maximize performance ...

(3)

(Time) Complexity Theory

(Time) Complexity Theory is:

How many “simple” operations needs to be performed by an algorithm to “solve” a task ? This time is measured in big O notation: E.g.

sorting: O(N log(N)) where N is the number of entries which needs to be sorted.

NOTICE: We are talking about asymptotic behavior which may only be relevant for large problems.

(4)

Thomas Stidsen 4

Types of tasks

In general we differentiate between 3 types of tasks to perform:

1. The impossible (the Halting Theorem): Not many ...

2. The hard (time consuming): Many important ....

3. The easy problems: Many important ... (but already solved !)

For now we will ignore the impossible problems, which we usually do not encounter and concentrate on the difference between the easy and the hard problems.

(5)

Turing Machines (TM)

I do not want to go into (too many) details on Turing Machines:

They are theoretical models for (almost) all kinds of computation today ...

Can be divided into two types:

The deterministic TM

The non-deterministic TM

(6)

Thomas Stidsen 6

Deterministic TM

Somewhat corresponding to computers today Can read and execute programs

(7)

Non-deterministic TM

A very special type of machine !

The machine is able to make lucky decisions ! Can branch in polynomial time through a

branch-and-bound tree ...

0 S1

S S

S S

S S

S S

S S

00 S

x3=0 x2=0

x1=0 x1=1

110 111 101

100 010 011

001 000

10 11

S 01

S

S

(8)

Thomas Stidsen 8

The computable problems

First we will only consider decision problems (yes/no problems):

P

NP

NP−complete

(9)

NP-complete

A special and hard set of decision problems:

It should belong the set NP

It should be at least as hard as any other NP problem

Most often a problem is proven to be hard by

proving that it belongs to the NP-complete class of problems.

(10)

Thomas Stidsen 10

Proving NP-completeness

Given a new decision problem Q

Prove that Q NP , i.e. given a solution there should be a polynomial algorithm to check if the answer is yes or no.

Make a (polynomial) transformation algorithm to convert some known problem to Q

(11)

Decision problems

An important detail: Complexity Theory deals with decision problems with a yes/no result. It is however easy to convert an optimization problem to a

decision problem: Introduce a "question": Is the result less/more than x ?

We call optimization problems which have

NP-complete decision problem counterparts for:

NP-hard optimization problems.

(12)

Thomas Stidsen 12

P 6= NP ????

The classes, P, NP and NP complete were

formulated in the 70’ies, but has not yet been proved !!! One of the most important unsolved mathematical problems. Most (all !) researchers assume that P 6= NP .

(13)

What is the point showing NP-completeness ?

It feels stupid to used advanced

metaheuristics/decomposition algorithms, if other people can solve the problem fast to optimality ...

If a problem is NP-complete is EXTREMELY UNLIKELY to be a simple problem to solve ...

... because then thousands of other peoples problems can be solved to optimality ...

Optimization problems can be changed into decision problems by asking if solutions of a

(14)

Thomas Stidsen 14

The No Free Lunch Theorem for Search

Assume to have two heuristic optimisation

algorithms a1 and a2. Further assume to have a function f to optimize and a maximum of m

evaluations encountered during the search. The vector −→c is a histogram over all the evaluations during the search. The NFL theorem says:

X

f

P (−→c |f, m, a1) = X

f

P (−→c |f, m, a2)

(15)

The No Free Lunch Theorem for Search

Originates from an article of David H. Wolpert and William G. Macready, both at the Santa Fe Institute, from 1995

http://www.santafe.edu/˜wgm/papers.html In the beginning it was extremely controversial.

It was discussed for more than 2 years on the GA mailing list ...

It is both very elegant mathematically and very sur-

(16)

Thomas Stidsen 16

But is it useful ?

The fundamental problem with NFL is: Which problems does it actually consider ?

All ?! But what do we mean by all ? This might include many problems we will never encounter ...

The majority of problems we encounter has some “continuity”.

The lesson to be learned by NFL: All heuristic

search algorithms favors certain problems where they perform well, make sure that your algorithms are good for the particular problems.

(17)

Statistical Testing

How can we scientifically examine the performance of two different meta-heuristics for a specific

problem ? This is hard because:

The meta-heuristics are parameter dependent The meta-heuristics are stochastic algorithms The performance is problem-sample dependent This part of the lecture is about statistical testing and the exercise today deals with this subject. Probably

(18)

Thomas Stidsen 18

Parameter Tuning I

Now comes the time when you will hate that there are so many parameters in the meta-heuristics. We cannot evaluate the performance of an algorithm without properly tuning the parameters.

(19)

Parameter Tuning Cookbook

1. Decide how long time the algorithm should run 2. Make a list of the parameters

3. Make a list of test values for each parameter 4. Select a small set of diverse data-samples 5. Select a sample number S (small 3-10)

6. Run the meta-heuristic for each parameter setting a S times for each data-sample.

7. Calculate the average performance for each dataset, for each parameter setting.

(20)

Thomas Stidsen 20

Algorithm Running Time

Because time is usually given by external

requirements, and there always is a time-efficiency trade off, we will always use the time available.

Hence, for this assignment you should select the time you want to allow your algorithm to run.

(21)

List of parameters

Make a list of all parameters (remember the hidden parameters). For Simulated Annealing this could

be:

Initial temperature

Temperature decrease rate α

Notice we do not need a “finish temperature” that is given by the.

(22)

Thomas Stidsen 22

Make a list of test values

For each parameter select “intelligently” some values, ex:

Initial temperature: {10, 50, 100}

Temperature decrease rate:

{0.85, 0.9, 0.95, 0.98, 0.99}

(23)

Select a small set of diverse data-samples

Select a few of the data-samples for parameter tuning:

1. Covering all sizes

2. .. and all problem characteristics.

This set of data samples we will call the parameter tuning data samples.

(24)

Thomas Stidsen 24

Select a sample number

Your algorithms are stochastic so we have to

calculate average performance, for each parameter combination, for each parameter tuning data

sample. We do that by running our algorithm a number of times and calculate average

performance.

(25)

Calculate Average

Calculate Average performance and standard deviation for each parameter setting for each parameter tuning data sample. Select as

parameters the best parameters for the algorithm based on the results on the whole parameter tuning data set.

(26)

Thomas Stidsen 26

Test the algorithms

Now, given the best performing parameters,

compare the two algorithms performance on the remaining data samples.

(27)

Comparing Algorithms

Only properly tuned algorithms running the same time can be compared.

Referencer

RELATEREDE DOKUMENTER

Each Nordic TSO shall provide to the CCC for each CNEC, each long-term capacity calculation time frame and each scenario the operational security limits, which are needed by CCC

Det er således en faktor der har indflydelse på energieffektiviteten, men på energiforbruget, og derfor skal de operative energinøgletal ikke korrigeres for denne parameter..

HEATING FLEXIBILITY USING BUILDING THERMAL MASS FOR STORAGE. PARAMETER

As data collection and access vary within each continent, and the quality of collected data is not easily verifiable, we utilize standardized data from the Institute for

The analysis of the pairs trading and pairs trend models consisted of analyzing colored scale tables of average monthly returns and Sharpe ratios, varying the different

To calculate Active Share and the correlation between Active Share and performance, two primary types of data is gathered, monthly returns and monthly holdings (weights of

As such, we believe that classes B and C, for instance, should be rated AAA (except for the parameter-

When decreasing the cost parameter of a two-player coalition between the EU and NO or the cost parameter of all coalitions involving NO, the actual coalition formation during