Download presentation

Presentation is loading. Please wait.

Published byGage Fletcher Modified about 1 year ago

1
1 Transportation problem The transportation problem seeks the determination of a minimum cost transportation plan for a single commodity from a number of sources to a number of destinations. It requires the specification of the level of supply at each source, the amount of demand at each destination, and the transportation cost from each source to each destination. The transportation problem is linear if the cost on a route is directly proportional to the amount transported; otherwise it is nonlinear.

2
2 Assume there are n sources and k destinations. The amount of supply at source i is sour(i) and the demand at destination j is dest(j). The unit transportation cost between source i and destination j is cost(i,j). If x(i,j) is the amount transported from source i to destination j then the transportation problem is given as min i,j f(i,j) s.t. j x(i,j) sour(i) i=1,2, ,n i x(i,j) dest(j) j=1,2, ,k x(i,j) 0 i=1,2, ,n and j=1,2, ,k If f(i,j)=cost(i,j)*x(i,j) for all i and j, the problem is linear.

3
3 The above problem implies that the total supply sour(i) must at least equal total demand dest(j). When the total supply equals the total demand, the resulting formulation is called a balanced transportation problem. It differs from the above only in that all the corresponding constraints are equations. That is j x(i,j)=sour(i) i=1,2, ,n i x(i,j)=dest(j) j=1,2, ,k If all sour(i) and dest(j) are integers any optimal solution to a balanced linear transportation problem is an integer solution, i.e., all x(i,j) are integers. Moreover the number of positive integers among x(i,j) is at most k+n-1. In this section we assume a balanced transportation problem.

4
4 An example Assume 3 sources and 4 destinations. The supply is sour(1)=15, sour(2)=25, sour(3)=5 The demand is dest(1)=5, dest(2)=15, dest(3)=15, dest(4)=10 Note: the total supply and demand equal 45. The unit transportation cost cost(i,j) is given as

5
5 The optimal solution is shown below The total cost is 315.

6
6 Classical genetic algorithms A straightforward approach in defining the chromosome for a solution in the transportation problem is to create a vector (v(1), ,v(p)) where p=n k. Each component v(i) represents an integer associated with row j and column m in the allocation matrix, where j= (i-1)/k+1 and m=(i-1) mod k+1.

7
7 Constraint satisfaction It is clear that every solution vector must satisfy the following: v(q) 0 for all q=1,2, , n k v(c k+1)+v(c k+2)+ +v(c k+k)=sour(c+1) for c=0,1, ,n-1 v(m)+v(m+k)+v(m+2k)+ =dest(m) for m=1,2, ,k

8
8 Evaluation function fitness= v(i)cost(j,m) where j= (i-1)/k+1 and m=(i-1) mod k+1.

9
9 Genetic operators There is no natural definition of genetic operators the transportation problem with the above representation. Mutation is usually defined as a change in a single gene in a solution vector. This, for our problems, would trigger a series of changes in different places (at least three other changes) in order to maintain the constraint equalities. The situation is even worse if we try to define a crossover operator. Conclusion: the above vector representation is not the most suitable for defining genetic operators in our problems.

10
10 Incorporating problem-specific knowledge Can we improve the representation of a solution while preserving the basic structure of this vector representation? The answer is yes, but we have to incorporate problem- specific knowledge into the representation.

11
11 Initialization The following procedure will create a matrix of at most k+n-1 non-zero elements such that all constraints are satisfied. procedure initialization set all numbers from 1 to k n as unvisited repeat select an unvisited random number q from 1 to k n and set it as visited (row)i= (q-1)/k+1 (column)j=(q-1) mod k+1 val=min(sour[i],dest[j]) set v(i,j)=val sour[i]=sour[i]-val dest[j]=dest[j]-val until all numbers are visited

12
12 Assume 3 sources and 4 destinations. The supply is sour(1)=15, sour(2)=25, sour(3)=5 The demand is dest(1)=5, dest(2)=15, dest(3)=15, dest(4)=

13
13 The first random number is 10. This means row number i=3 and column number j=2. The val=min(sour[3],dest[2])=5, so v(3,2)=5. After the first iteration, sour[3]=0 and dest[2]= The next three random numbers are 8,5, and 3. What is the resulting matrix?

14
The random numbers is 8 (corresponding to row 2 and column 4)

15
The random numbers is 5 (corresponding to row 2 and column 1)

16
The random numbers is 3 (corresponding to row 1 and column 3)

17
17 If the further sequence of random number is 1,11,4,12,7,6,9,2, the final matrix produced is

18
18 This technique can generate any feasible solution that contains at most k+n-1 non-zero integer elements. It will not generate other solutions which, though feasible, do not share this characteristic. The initialization procedure would certainly have to be modified when we attempt to solve non-linear versions of the transportation problems.

19
19 The knowledge of the problem and its solution characteristic gives us an opportunity to represent a solution to the transportation problem as a vector. A solution vector will be a sequence of n k distinct integers from the range, which (according to the procedure initialization) would produce an acceptable solution. In other words we would view a solution-vector as a permutation of numbers, and we would look for particular permutations which correspond to the optimal solution.

20
20 Constraint satisfaction Any permutation of k n distinct numbers produces a unique solution which satisfies all constraints. This is guaranteed by procedure initialization.

21
21 Evaluation function This is relatively easy. Any permutation would correspond to a unique matrix. The evaluation function is i,j v(i,j) cost(i,j)

22
22 Genetic operators Inversion: any solution vector (x(1),x(2), , x(q)) (q=k n) can be easily inverted into another solution vector (x(q), x(q-1), , x(1)) Swap: any two elements of a solution vector, say x(i) and x(j) can be swapped easily resulting in another solution vector. Crossover: PMX, CX, OX

23
23 A matrix as representation structure Perhaps the most natural representation of a solution for the transportation problem is a two dimensional structure. After all, this is how the problem is presented and solved by hand. In other words, a matrix V=(v(i,j)) (1 i k, 1 j n) may represent a solution.

24
24 Constraint satisfaction Every solution matrix V=(v(i,j)) should satisfy the following: j v(i,j)=sour(i) i=1,2, ,k i v(i,j)=dest(j) j=1,2, ,n v(i,j) 0 i=1,2, ,k and j=1,2, ,n This is similar to the set of constraints in the straightforward approach, but the constraints are expressed in an easier and more natural way.

25
25 Mutation Assume that {i(1), i(2), , i(p)} is a subset of {1,2, ,k} and {j(1),j(2), ,j(q)} is a subset of {1,2, ,n} such that 2 p k, 2 q n. Let us consider the matrix V=(v(i,j)). We can create a p q submatrix W=(w(i,j)) from all elements of the matrix V in the following way: an element v(i,j) V is in W if and only if i {i(1), i(2), , i(p)} and j {j(1),j(2), ,j(q)}. If i=i(r) and j=j(s) then the element v(i,j) is placed in the r-th row and s-th column of the matrix W.

26
26 We assign new values sour_w(i) and dest_w(j) (1 i p, 1 j q) for matrix W: sour_w(i)= j {j(1), j(q)} v(i,j) 1 i p dest_w(j)= i {i(1), i(p)} v(i,j) 1 j q We then use the procedure initialization to assign new values too the matrix W such that all constraints sour_w(i) and dest_w(j) are satisfied. After that we replace appropriate elements of matrix V by a new elements from the matrix W. In this way all global constraints (sour(i) and dest(j)) are preserved.

27
27 Example Given a problem with 4 sources and 5 destinations and the following constraints: sour(1)=8, sour(2)=4, sour(3)=12, sour(4)=6 dest(1)=3, dest(2)=5, dest(3)=10, dest(4)=7, dest(5)=5

28
28 The following matrix V is selected as a parent for mutation

29
29 Select (at random) the two rows{2,4} and three columns {2,3,5}. The corresponding submatrix W is Note that sour_w(1)=4, sour_w(2)=3, dest_w(1)=5, dest_w(2)=0, dest_w(3)=2. After the reinitialization, the matrix W may get the following values

30
30 So finally the offspring of matrix V after mutation is

31
31 Crossover Assume that two matrices V1=(v1(i,j)) and V2=(v2(i,j)) are selected as parents for the crossover operation. Create two temporary matrices DIV=(div(i,j)) and REM=(rem(i,j)) in the following way: div(i,j)= (v1(i,j)+v2(i,j))/2 rem(i,j)=(v1(i,j)+v2(i,j)) mod 2 Matrix DIV keeps rounded average values from both parents, the matrix REM keeps track of whether any rounding was necessary.

32
32 Matrix REM has some interesting properties: the number of 1s in each row and each column is even. In other words, the values of sour_REM(i) and dest_REM(j) are even integers. We use this property to transform the matrix REM into two matrices REM1 and REM2 such that REM=REM1+REM2 sour_REM1(i)=sour_REM2(i)=sour_REM(i)/2 dest_REM1(j)=dest_REM2(j)=dest_REM(j)/2 Then we produce two offspring of V1 and V2 V3=DIV+REM1 V4=DIV+REM2

33
33 Example Given a problem with 4 sources and 5 destinations and the following constraints: sour(1)=8, sour(2)=4, sour(3)=12, sour(4)=6 dest(1)=3, dest(2)=5, dest(3)=10, dest(4)=7, dest(5)=5

34
34 Assume the following matrices V1 and V2 are selected as parents V1V The matrices DIV and REM are DIVREM

35
35 DIVREM The two matrices REM1 and REM2 are REM1REM

36
36 Finally two offspring V3 and V4 are V3V

37
37 Job shop problem n/m JSP: It is a production scheduling problem in which n jobs must be processed in m machines. A job is a set of tasks. Every task can be labeled by three numbers: i is the job number, j is the task number and k is the machine number. The following is a 5/3 JSP: Job1: 1,1,2 1,2,3 1,3,3 1,4,2, 1,5,2 Job2: 2,1,1 2,2,2 2,3,1 2,4,2 Job3: 3,1,1 3,2,3 Job4: 4,1,1 4,2,2 4,3,1 4,4,1 4,5,3 Job5: 5,1,3 5,2,2 5,3,3

38
38 Representation The schedule can be represented by a set of permutations.Each permutation stands for the task carried out by the machine. chromosome={m1,m2,m3} m1={3,1,1 2,1,1 2,3,1 4,1,1 4,3,1 4,4,1} m2={1,1,2 1,4,2 2,2,2 1,5,2 4,2,2 2,4,2 5,2,2} m3={1,2,3 3,2,3 5,1,3 1,3,3 5,3,3 4,5,3}

39
39 Fitness function The total cost according to the chromosome

40
40 Initialization while(not all the jobs are finished) { time forward; for(every machine) if (the machine is idle || the task is finished) the machine is available;

41
41 for(every machine) if(the machine is available) { calculate the available task set; if(the available task set is not empty) choose a new task and set the machine as unavailable; } The available task set contains the tasks that all the pre- tasks are finished.

42
42 Genetic operators Swap: any two elements of a machine can be swapped easily and check the feasibility Modified-OX: choose the crossover points in one machine and calculate the similar crossover points (the beginning time is similar for the first point while the ending time is similar for the second point) for other machines. Then do like normal OX operator.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google