42
Internet Engineering Internet Engineering Czesław Smutnicki Czesław Smutnicki Discrete Mathematics Discrete Mathematics – Discrete – Discrete Optimization Optimization

Internet Engineering Czesław Smutnicki Discrete Mathematics – Discrete Optimization

Embed Size (px)

Citation preview

Internet EngineeringInternet Engineering

Czesław SmutnickiCzesław Smutnicki

Discrete Mathematics Discrete Mathematics – Discrete – Discrete OptimizationOptimization

CONTENTS

• Numerical troubles• Packages• Tools• Useful methods

FIND EXTREMES OF THE FUNCTION

2D

1D

DE JONG TEST FUNCTION

OPTIMIZATION TROUBLES. NICE BEGINNINGS OF BAD NEWS

GRIEWANGK TEST FUNCTION

FIND EXTREMES OF THE FUNCTION

2D

OPTIMIZATION TROUBLES. MULTIPLE EXTREMES

LANGERMANN TEST FUNCTION

FIND EXTREMES OF THE FUNCTION

2D

OPTIMIZATION TROUBLES. EXPONENTAL NUMBER OF EXTREMES

FOX HOLES TEST FUNCTION

FIND EXTREMES OF THE FUNCTION2D

OPTIMIZATION TROUBLES. DECEPTION POINTS

Please wait. Calculations will last 3 289 years

INSTANCE FROM PRACTICE

! ! ?

NONLINEAR FUNCTION OF 1980 VARIABLES !!!

CURSE OF DIMENSIONALITY

OPTIMIZATION TROUBLES. TIME OF CALCULATIONS/COST OF CALCULATIONS

LAB INSTANCE

5..20 VARIABLES

NP-HARDNESS

SOLUTION SPACE

The smallest practical instance FT10 of the job-shop scheduling problem (waited 25 years for the solving), consists of 10 jobs, 10 machines, 100 operations; solution space contains 1048 discrete feasible solutions; each solution has dimension 90; the greatest currently used benchmarks have dimension 1980

dimension and size

FT 10 corresponds to printed area of 1032 km2 (Jupiter has 1010 km2) if single solution is a dot 0.01 x 0.01 mm

OPTIMIZATION TROUBLES. SIZE OF THE SOLUTION SPACE

0,0

0,2

0,4

0,6

0,8

1,0

1,2

0 10 20 30 40 50 60 70

DIST [%]

frequence [%]

FEAS ALL

0,00

0,05

0,10

0,15

0,20

0,25

0 25 50 75 100 125 150 175 200

RE [%]

frequence [%}

FEAS

Example: job-shop scheduling problem; relative Hamming distances DIST between a feasible solution and the „best” solution are distributed normally in the solution space

Goal function values are distributed normally in the solution space;

OPTIMIZATION TROUBLES. DISTRIBUTION OF THE GOAL FUNCTION VALUES

BEST

BESTRANDOMRE

0

10

20

30

40

50

60

70

80

90

1 21 41 61 81 101 121 141 161 181

DIST [%]

RE [%]

Example: job-shop scheduling problem

SIMULATION OF GOAL FUNCTION VALUES TOWARDS CENTER OF THE SPACE

OPTIMIZATION TROUBLES. FUR

0

2

4

6

8

10

12

14

16

18

0,01 0,21 0,41 0,61 0,81 1,01 1,21 1,41 1,61 1,81

DIST [%]

RE [%]

OPTIMIZATION TROUBLES. ZOOM IN ON THE FUR

Example: job-shop scheduling problem

SIMULATION OF GOAL FUNCTION VALUES TOWARDS CENTER (ZOOM)

Transformation of a sample of random solutions from the 90D space into 2D space.

OPTIMIZATION TROUBLES. STONE FOREST

PROPERTIES OF SOLUTION SPACE LANDSCAPE

BIG VALLEY – positive correlation between goal function value and the distance to optimal solution (the best found solution); in the big valley the concentration of local extremes is high. The size of the valley is usually relatively small in relation to the size of the whole solution space.

RUGGEDNESS – measure of diversity of goal function values of related (neighboring) solutions; rruggedness is greater if diversity of the goal function value in the neighborhood of this point is greater; less differentiation of the goal function value means the flat landscape.

THE NUMBER OF LOCAL EXTREMES (peaks) in relation to to the size of the solution space

DISTRIBUTION OF LOCAL EXTREMES experimental

OTHER MEASURESautocorrelation function, correlation function between random trajectories, landscape statistically isotropic, fractal landscape, correlation between genes (epitasis), correlation of the distance of fitness

CURRENT STATE IN DISCRETE OPTIMIZATION

• Packages and solvers (LINDO, CPLEX, ILOG, …)• Exact methods (B&B, DP, ILP, BLP, MILP, SUB,…)• Approximate methods (…): heuristics, metaheuristics, meta2heuristics• Quality measures of approximation (absolute, relative, …)• Analysis of quality measure (worst-case, probabilistic, experimental)• Calculation cost (pessimistic, average, experimentally tested)• Approximation schemes (AS, polynomial-time PTAS, fully polynomial-time FPTAS)• Inapproximality• Useful experimental methods (…)• „No free lunch” theorem• Public benchmarks• Parallel and distributed methods: new class of algorithms

OPTIMIZATION HISTORY/TRENDS

• Priority rules• Theory of NP-completeness• Plynomial-time algorithms• Exact methods (B&B, DP, ILP, BLP,…) • Approximation methods: quality analysis• Approximation schemes (AS, PTAS, FPTAS, …)• Inapproximality theory• Competitive analysis (on-line algorithms)• Metaheuristics• Theoretical foundations of metaheuristics• Parallel metahuristics• Theoretical foundations of parallel metaheuristics

• constructive/improvement• priority rules• random search• greedy randomized adaptive • simulated annealing• simulated jumping• estimation of distribution• tabu search• adaptive memory search• variable neighborhood search• evolutionary, genetic search• differential evolution• biochemistry methods • immunological methods• ant colony optimization• particle swarm optimization• neural networks• threshold accepting

• path search• beam search • scatter search• harmony search• path relinging• adaptive search• constraint satisfaction• descending, hill climbing• multi-agent• memetic search• bee search • intelligent water drops

* * * * *

METHODS RESISTANT

TO LOCAL EXTREMES

APPROXIMATE METHODS

EVOLUTION: DARWIN’S VIEW. GENETIC ALGORITHMS

individual, gene, chromosome, traitpopulation (structure, size, composition)crossing-over (what is the key of progress?)mutation (insurance?)sex ?democracy/elitarism

theoretical properties

individual=solution=genotype≠fenotype

GOAL OF THE NATURE? optimization, fitness, continuity preservation, follow up changes

SUCCESION: genetic material carries data for body constructionEVOLUTION: crossing over, mutationSELECTION: soft/hard

EVOLUTION: DARWIN’S VIEW. COMPONENTS

SOLUTIONSOLUTION

FEASIBILITYFEASIBILITY

SELECTION SCHEMESELECTION SCHEME

CROSSING OVERCROSSING OVER

MATTING POOLMATTING POOL

CHROMOSOMCHROMOSOM

MUTATIONMUTATION

OPERATOR MSXFOPERATOR MSXF

BIG VALLEY PHENOMENONBIG VALLEY PHENOMENON

GENOTYPEGENOTYPE

FENOTYPEFENOTYPEREPAIRINGREPAIRING

CONTROL OF CONTROL OF POPULATION DYNAMICSPOPULATION DYNAMICS

INTENSIFICATIONINTENSIFICATION

MORE …MORE …

GENE EXPRESSIONGENE EXPRESSION

CODINGCODING

LETHALITYLETHALITY

EVOLUTION: DARWIN’S VIEW. COPYING FROM THE NATURE

• control of population dynamics/preserving diversity• parents matching strategies: (sharing function to prevent too close relative

parents; incest preventing by using Hamming distance to evaluate genotype similarity)

• structures of the population (migration, diffusion models)• social behavior patterns (satisfied, glad, disappointed -> clonning, crossing-

over, mutation)• adaptive mutation• gene expression• distributed populations• …

EVOLUTION: DARWIN’S VIEW. MULTISTEP FUSION MSXF

SOURCE SOLUTION (PARENT)

NEIGHBORHOOD OF THE SOURCE

TARGET SOLUTIONTARGET SOLUTION(PARENT)(PARENT)

TARGET NEIGHBORHOOD

TRAJECTORY = GOAL ORIENTED PATH

SUCCESSIVE NEIGHBOURHOODS SEARCHED IN THE STOCHASTIC WAY DEPENDING THE DISCTANCE TO TARGET

DISTANCE TO TARGET

EVOLUTION: LAMARCK/BALDWIN’S VIEW. MEMETIC ALGORITHMS

GOAL OF THE NATURE? optimization, fitness, continuity preservation, follow up changes, transfer knowledge to successors

SUCCESION: genetic material carries data for body building plus acquired knowledge

EVOLUTION: crossing over, mutation, learningSELECTION: soft/hard

• individual, meme, chromosome, trait• population (structure, size, composition, learning)• crossing-over, mutation, learning

• theoretical properties ?

individual=solution=memotype≠fenotype

DIFFERENTIAL EVOLUTION

Differential evolution is a subclass of genetic search methods. Democracy in creating successors with using crossover and mutation in GS has been replaced in DE by directed changes to fathom solution space. DE starts from the random population of individuals (solutions). In each iteration something similar to mutation and crossover is performed, however in completely different way than in GS.

For each solution x from the space, an offspring y is generated as the trial solution being the extension of a selected random solution a and two directional solutions b and c (analogy to parents) selected at random. Generation is based on linear combination with some random parameters.

Separate mechanism prevents generating an offspring by simple copying of the parent. Significant role plays the mutation, which due to specific strategy, is self-adaptive and goal-oriented with respect to the direction, scale and range. If the trial solution is better, it is accepted; otherwise it is released. Iterations are repeated until the fixed a priori number of iterations has been reached, or stagnation has been detected. The method owns some specific tuned parameters: differential weight, crossover probability, … selected experimentally.

]2,0[),( RcbRay iiii

ARTIFICIAL IMMUNE SYSTEM

Antigen (invasive protein) represents new problem to solve or new (or temporary) constraints set for the solution of already solved problem. Variety of possible antigens is huge, frequently infinite. Moreover, sequence of presented antigens is not known a priori.

Antibody (protein blocking antigent, directed against intruder) corresponds to an algorithm which produces a solution to the problem. Variety of antibodies is usually small, however mechamisms exist of their aggregation and recombination in order to produce new antibodies with various properties. Patterns of antibodies are collected in the library, which constitutes memory of the system.

Matching (fitness) is the selection of antibody for the antigen. Matching is ideal, if the antibody allow us to generate solution of the problem which is globally optimal under given constraints. Otherwise, certain defined measure is used to evaluate quality of the maching. Bad maching forces the system to seek for new types of antibodies, usually by using evolution.

antigen = problem or instance

antibody = solution

LIBRARY OF ANTIBODIESfitness

recombination

ANT SEARCH. COOPERATIVE SWARMS

ANT

• seeks for food• leaves pheromone on the trail • moves at random, but prefers pheromone trails• pheromone density decreases in time

control system pheromone

generator

moving drive

Pheromone detectors

ANT SEARCH. SEEKING FOODS. DISCOVERING THE PATH

A

E

B

CH

E

A

D D

B

CH

E

A

D

B

CH

E

A

ANT SEARCH. PHEROMONE DISTRIBUTION

m

k

kijij

1

ijijij tnt )()(

PARTICLE SWARM OPTIMIZATION

• swarm is a large set of individuals (particles) moving together• each individual performs the search trajectory in the solution space• trajectories are distributed, correlated and take into account experiences of individuals• location of the individual (solution) is described by the location vector x, changes of

location is described by velocity vector v• velocity equation containts an inertiA term and two directional terms weighted by using

some random parameters• location of the individual depends on: recent (previous) position, experience (best

location up to now), location of the leader of the swarm,• the best up to now solution form the most promising direction of the search

BEE SEARCH

Neighborhood search combined with random search and supported by cooperation (learning).

• bee swarm collects honey in hive• each bee performs the random path (solution) to the search region of nectar • selected elite bees in hive perform „waggle dance” in order to inform other bees about

promising search regions (direction, distance, quality)

flowers & nectar

hive

bee

waggle dance = distribution of knowledge

bee trajectory = solution

visited site = neighborhood

nectar amount = goal function

TABU SEARCH

• human thinking in the process of seeking a solution

• the method „best in local neighborhood”

• repeated from the best recently found• forbidding the return to solutions

already visited to prevent cyclic (wandering around); short term memory

NEIGHBOURHOOD

SUCCESSIVE NEIGHBOURHOODSEXPLORED EXHAUSTIVELY

STARTING SOLUTION

ADAPTIVE MEMORY SEARCH

• gathering data in human brain during the process of seeking a solution

• the method „best” in the current heighbourhood (a few solution relatively close to the current)

• repetition from the best recently found; intensification of the search

• operational (short term) memory: prohibition of coming back to solutions already visited to prevent wandering

• tactic memory: set direction of the search• strategic memory: selection of search regions (basins of

attraction); diversification• recency based, frequency based memory

INTELLIGENT WATER DROPS

Based on the dynamic of the river systems, action and reaction, that happen among water drops in rivers:

• a drop has some (static) parameters, namely velocity, soil;• these parameters may change during the lifetime (e.g. iterative cost)• drops flow from a source to destination• a drop starts with some initial velocity and zero soil• during the flow, drop removes some soil from the environment• speed of the drop incereases non-linearly inversely to the amount of soil; path with less soil is

faster than path with more soil• soil is gathered in the drop and removed from the environment• drop statistically prefers path with lower soil

annealing = slow cooling of ferromagnetic or antyferromagnetic solid in order to eliminate internal stretches

Boltzman (harmonic)

Logarithmic (Hajek lemay)

Geometric

SIMULATED ANNEALING. COOLING SCHEMES

)( kk aT

....,1,0)2(ln

k

kTk

k

Tk1 0

01 111 Tk

T

T

TT

k

kk

• Random starting solution• Sequence of k trial moves in the space• K steps in each fixed temperature• Starting temperature adjusted automatically• Adaptive speed of cooling

SIMULATED ANNEALING. AUTOTUNING

SIMULATED ANNEALING. AUTOTUNING

pT

lnmax

0

)()'(maxmax )('max xKxKxNxYx

kk

kk T

TT

11

kk

3

)1ln(

p  0.9

SIMULATED JUMPING SIMULATED JUMPING

annealing by successive heating and cooling, in order to eliminate internal stretches of the spin-glass solid (mixed ferromagnetic and antyferromagnetic material); the aim is to penetrate high barriers that exist between domains

]...,2,1[],0[)()1( NRR

tTtT iepodgrzewan

],0()()1( iapodgrzewanstudzenia tTtT

DISTANCE MEASURES IN THE SOLUTION SPACE

4

)1( nn

72

)52)(1( nnn

)( 2nO )(nO )log( nnO

)2(nn HH

nHn

)( 3

1

n

nn 2

complexity

variance

mean

receiptnumber of inversionin -1 o

n minus the numberof cycles in -1 o

n minus the lenght of the maximal increasing subsequence in -1 o

measure DA (, ) DS (, ) DI (, )

Move type A S I

DISCRETE OPTIMIZATION. SOLUTION SPACE PROPERTIES

0

20

40

60

80

100

120

140

160

180

0 5 10 15 20 25 30

DIST [%]

RE [%]

-14

-12

-10

-8

-6

-4

-2

0

2

4

-18 -14 -10 -6 -2 2 6 10

x

y

There exists strong correlation between quality of the function value (RE) and distance to the best solution (DIST); this correlation is preserved after transformation of the solution to x/y coordinates

BIG VALLEYstartstart

bestbest

SELECTED INSTANCES. BIG VALLEY

RAN

0

5

10

15

20

25

30

35

40

0 2 4 6 8 10 12

DIST [%]

RE [%]RAN

-14

-12

-10

-8

-6

-4

-2

0

-18 -16 -14 -12 -10 -8 -6 -4 -2

x

y

startstart

bestbest

SELECTED METHODS. RANDOM SEARCH

RANDOM SEARCH TRAJECTORY

Random search offers slow convergence to the good solution because it doesn’t use any information about structure of the solution space

SA

0

5

10

15

20

25

30

35

40

0 2 4 6 8 10 12

DIST [%]

RE [%]SA

-14

-12

-10

-8

-6

-4

-2

0

-18 -16 -14 -12 -10 -8 -6 -4 -2

x

y

startstart

bestbest

Simulated annealing offers moderate speed of convergence to the good solution; it is much more similar to the random search than to goal-oriented search

SELECTED METHODS. SIMULATED ANNEALING

SIMULATED ANNEALING TRAJECTORY

TS

-14

-12

-10

-8

-6

-4

-2

0

-18 -16 -14 -12 -10 -8 -6 -4 -2

x

yTS

0

5

10

15

20

25

30

35

40

0 2 4 6 8 10 12

DIST [%]

RE [%]

startstart

bestbestTABU SEARCH TRAJECTORY

Tabu search offers quick convergence to the good solution; this is the fast descent method supported by adaptive memory

SELECTED METHODS. TABU SEARCH

PARALLEL OPTIMIZATION: NEW CLASS OF ALGORITHMS

• Theoretical models of parallel calculation: SISD, SIMD, MISD, MIMD • Theoretical models of memory access: EREW, CREW, CRCW• Parallel calculation environments: hardware, software, GPGPU• Shared memory programming: Pthreads (C), Java threads, Open MP (FORTRAN, C, C++)• Distributed memory programing, message-passing, object-based, Internet computing: PVM, MPI,

Sockets, Java RMI, CORBA, Globus, Condor• Measures of quality of parallel algorithms: runtime, speedup, effciency, cost• Single/multiple searching threads; granularity• Independent/cooperative search threads• Distributed (reliable) calculations in the net

PARALLEL OPTIMIZATION: FESTIVAL OF APPROACHES

• SIMULATED ANNEALING: – Single thread, conventional SA, parallel calculation of the goal function value; fine grain;

theory of convergence– Single thread, pSA, parallel moves, subset of random trial solutions selected in the

neighborhood, parallel evaluation of trial solutions; theory of convergence– Exploration of equilibrium state at fixed temperature in parallel– Multiple independent threads; coarse grain– Multiple cooperative threads; coarse grain

• GENETIC SEARCH:– Single thread, conventional GA, parallel calculation of the goal function value; small grain;

theory of convergence– Single thread, parallel evaluation of population;– Multiple independent threads; coarse grain – Multiple cooperative threads, distributed subpopulations: migration, diffusion, island models– …

Thank you for your attention

DISCRETE MATHEMATICSCzesław Smutnicki