1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding...

28
1 Exact and heuristics algorithms

Transcript of 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding...

Page 1: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

1

Exact and heuristics algorithms

Page 2: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

2

Introduction An optimization problem is the problem of finding the best solution from all feasible solutions

• Example: we want the minimum cost path from s to a goal t

Page 3: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

3

Introduction• Navigation

– path-cost = distance to node in miles – minimum => minimum time, least fuel

Page 4: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

4

Introduction• VLSI Design (Very-large-scale

integration)– path-cost = length of wires between chips– minimum => least clock/signal delay

Page 5: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

5

Introduction• Puzzle

– path-cost = number of pieces moved– minimum => least time to solve the puzzle

Page 6: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

6

Combinatorial optimization problem

• A set of solution for combinatory optimization problem can be mathematically modeled using:

• Variables vector x = (x1, x2, ..., xn),• Variable domaine D = (D1, D2, ..., Dn), or (Di)

i=1,...,n finite sets,• Constraints set,• F: Objective function to minimize or to

maximize,• A set of all feasible solutions

• S = {x = (x1, x2, , xn)} ϵ D / x satisfies all the constraints S is also called search space.

Page 7: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

7

Combinatorial optimization problem

• Facilities layout problem is consisted of a variety of problems. The main problems are: Storage (warehouses) architectural design and general layout

problem, picking, response time for the order processing, minimization of travel distances in the

warehouse, routing of pickers or automated guided vehicles,

personnel and machine Scheduling.

Page 8: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

8

Combinatorial optimization problem

• Example: Warehouse location problem Warehouses location problem: It aims to compute optimal

location for the warehouses in given area based on location of factories with their production capacities, the location of clients with their demands, warehouse storage capacities.

MathModelMathModel SolutionSolution

Inputs

Inputs

Outputs

Outputs

Page 9: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

9

Combinatorial optimization problem

• Example: Warehouse location problem

• We need to answer these questions: – how many warehouse are needed in a given

area? – Where can we deploy them? – How to assign clients to the warehouse and

respect constraints?

Page 10: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

10

Combinatorial optimization problem

• So, we can model this problem as follows:– Let I={1,…,m} be the set of possible locations to

establish a warehouse, – J={ 1,…,n} be the set of customers,

– Cij denoting the amount of transportation from warehouse i to customer j,

– dj be the demand of customer j.

– ai be the opening cost of warehouse i.

– Let Yi be a decision variable that is not null if the warehouse i is opened and Xij a binary variable not null if the client j is assigned to warehouse i, and Wi is the ith warehouse capacity. These variables are summarized in the following table.

Page 11: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

11

Combinatorial optimization problemVariable Notation

Investment cost to build warehouse i ai

ith warehouse capacity Wi

Binary decision variable of affecting client j to warehouse i

Xij

Decision variable to open or not warehouse i yiTransportation Cost of client j toward the warehouse i

Cij

Client j demand djMax number of initial warehouse mClient number n

Page 12: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

12

Combinatorial optimization problem

• Objectives functions: • F1 minimizes the investment cost , • F2 minimizes the transportation cost, • We combine the two functions into a single

objective function F:

• With:

F F1 F2

m

iyiaiF

1min1

m

i

n

jxijcijF

1 1min2

Page 13: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

13

Combinatorial optimization problem

• Constraints • Ensures that client j is affected only to one warehouse;

• guarantees that the sum of the demand dj is smaller than the warehouse capacity;

• Integrity constraints

ijxi 1

m 1

jd ijxj 1

n iW iy

ijx {0,1} 1,0jy

Page 14: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

14

Exact and heuristic solution

Exact Heuristic

An exact algorithm is typically deterministic and proven to yield an optimal result.

A heuristic has no proof of correctness, often involves random elements, and may not yield optimal results.

Lot of iterations, lot of constraints Big computation resources Long time

Does not explore all possible states of the problem short time

Exact solution Optimal (Good solution)

What to use? When?

Page 15: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

15

Complexity of a problem• The theory of classifying problems based on how

difficult they are to solve:• P-problem (polynomial-time) • NP-problem (nondeterministic polynomial-time)

Page 16: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

16

Complexity of a problem• The theory of classifying problems based on how

difficult they are to solve.

– A problem is assigned to the P-problem (polynomial-time) class if the number of steps needed to solve it is bounded by some power of the problem's size.

– A problem is assigned to the NP-problem (nondeterministic polynomial-time) class if it permits a nondeterministic solution and the number of steps to verify the solution is bounded by some power of the problem's size.

Page 17: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

17

Complexity of a problem• Problem complexity:• We measure the time to solve a problem

of input size n by a function T(n).• Example:

Page 18: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

18

Complexity of a problem• Problem complexity:• Algorithm complexity can be expressed in

Order notation, e.g. “at what rate does work grow with N?”:– O(1) Constant– O(logN) Sub-linear– O(N) Linear– O(NlogN) Nearly linear– O(N2) Quadratic– O(XN) Exponential

Page 19: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

19

Solution• Solution for combinatorial optimization problem

includes different types of algorithms such as :– Algorithms based on geometry – “cut trees” algorithms – Genetic Algorithms – Neighborhood search algorithms – Dynamic programming – Linear and non-linear programming – Mixed integer programming – Particle swarm optimization – Simulated annealing algorithms

Page 20: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

20

Genetic algorithm: introduction• Genetic Algorithms (GAs) are adaptive

heuristic search algorithm premised on the evolutionary ideas of natural selection and genetic. The basic concept of GAs is designed to simulate processes in natural system necessary for evolution, specifically those that follow the principles first laid down by Charles Darwin of survival of the fittest. As such they represent an intelligent exploitation of a random search within a defined search space to solve a problem.

Page 21: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

21

Genetic algorithm: Chromosomes

• Chromosomes are used to code information.

• Example: 3 warehouses, 5 clients

W1 W2 W3 C1 C2 C3 C4 C5

1 0 1 3 2 1 1 2

Page 22: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

22

Genetic algorithm: OperatorsPopulationPopulation

SelectSelect

CrossoverCrossover

MutationMutation

Recombination

Recombination

Best solution

Best solution

Final iterati

on

Final iterati

on

Yes

No

Page 23: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

23

Genetic algorithm: OperatorsPopulationPopulation

SelectSelect

1- Randomly generate an initial population (random chromosomes)

3-Select some chromosomes from the population as an offspring individual:

-Randomly - using stochastic method

2 -Compute and save the fitness (Objective function F) for each individual (chromosomes) in the current population

Page 24: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

24

Genetic algorithm: Operators• The crossover is done on a selected part of

population (offspring) to create the basis of the next generation (exchange information).

• This operator is applied with propability Pc

CrossoverCrossover

W1 W2 W3 C1 C2 C3 C4 C5

1 0 1 3 2 1 1 2

W1 W2 W3 C1 C2 C3 C4 C5

1 0 1 3 2 1 1 2

Father

Mother

Page 25: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

25

Genetic algorithm: Operators

CrossoverCrossover

Child 1

Child 2

W1

W2

W3

C1 C2 C3 C4 C5

1 0 1 3 2 1 1 2

W1

W2

W3

C1 C2 C3 C4 C5

1 0 1 3 3 1 2 2

W1

W2

W3

C1 C2 C3 C4 C5

1 0 1 3 3 1 1 2

W1

W2

W3

C1 C2 C3 C4 C5

1 0 1 3 2 1 2 2

Father

Mother

Page 26: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

26

Genetic algorithm: Operators• This operation is a random change in

the population. It modifies one or• more gene values in a chromosome to

have a new chromosom value in the pool.

• This operator is applied with propability Pm

MutationMutation

W1 W2 W3 C1 C2 C3 C4 C5

1 0 1 3 2 1 1 2

W1 W2 W3 C1 C2 C3 C4 C5

0 0 1 3 2 1 1 2

Current

New

Page 27: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

27

Genetic algorithm: Operators• Recombination combines the

chromosomes from the initial population and the new offspring chromosomes.

Recombination

Recombination

Final iterati

on

Final iterati

on

• Repeat a fixed number of iteration or until the solution converge to one solution (always with the best fitness) .

Page 28: 1 Exact and heuristics algorithms. 2 Introduction An optimization problem is the problem of finding the best solution from all feasible solutions Example:

28

Genetic algorithm: OperatorsPopulationPopulation

SelectSelect

CrossoverCrossover

MutationMutation

Recombination

Recombination

Best solution

Best solution

Final iterati

on

Final iterati

on

Yes

No