• 沒有找到結果。

6. Results and Discussions

6.1 Parameter Setting in Genetic Algorithm

6.1.2 Crossover Rate Tuning

To determine which crossover rate is the most appropriate for solving the production planning and scheduling problem in PBC, we ran several tests using different rates. For each week, the code was run once using 3 different rates and fixing the mutation rate at 0.10. A population of 20 individuals was used and the maximum number of generations was 500. Table 11 summarizes the crossover rates tested for the genetic algorithm and linear programming runs.

Table 11 – Crossover rates used for Genetic Algorithm and Linear Programming

Crossover Rate

0.1 0.2 0.3 0.4

-0.130%

-0.110%

-0.090%

-0.070%

-0.050%

-0.030%

-0.010%

1 32 63 94 125 156 187 218 249 280 311 342 373 404 435 466 497 528 559 590 621 652 683 714 745 776 807 838 869 900 931 962 993

% of Reduction

Generation

Best Solution vs. Number of Generations

Week 2 Week 3 Week 4 Week 5 Week 6

Week 7 Week 8 Week 9 Week 10 Week 11

67

Table 12 and Figure 14 summarize the average costs obtained for each instance. The best result is presented in the last column of the table and corresponds to the yellow colored cell. The rate of 0.40 is not recorded because of an extremely high running time. Using a crossover rate of 0.40 took more than 3 hours of running time to create 33 generations and until that point solution was not better than the one obtained by smaller rates. Due to slow performance, we decide to use different strategies to deal with higher crossover rates, which is explained in the Section 6.1.2.1.

Table 12 – The impact of crossover rate (CR) on the total cost.

Week CR= 0.10 CR= 0.20 CR= 0.30 Minimum

2 $ 322,813.74 $ 322,815.84 $ 321,099.23 $ 321,099.23 3 $ 334,562.82 $ 334,570.88 $ 334,555.89 $ 334,555.89 4 $ 296,612.35 $ 291,963.73 $ 291,947.04 $ 291,947.04 5 $ 312,827.18 $ 312,821.75 $ 287,748.48 $ 287,748.48 6 $ 232,679.48 $ 232,679.49 $ 233,708.25 $ 232,679.48 7 $ 293,529.04 $ 293,533.51 $ 292,326.32 $ 292,326.32 8 $ 293,790.98 $ 293,785.28 $ 291,490.19 $ 291,490.19 9 $ 190,750.74 $ 190,654.92 $ 188,546.58 $ 188,546.58 10 $ 311,410.49 $ 311,401.35 $ 309,178.62 $ 309,178.62 11 $ 330,209.12 $ 331,556.85 $ 329,325.72 $ 329,325.72 12 $ 320,582.61 $ 320,281.61 $ 319,504.89 $ 319,504.89 13 $ 283,233.86 $ 281,524.75 $ 283,374.89 $ 281,524.75 14 $ 368,499.30 $ 368,743.18 $ 368,563.63 $ 368,499.30 15 $ 268,590.02 $ 268,588.88 $ 269,011.56 $ 268,588.88 16 $ 254,396.83 $ 254,394.64 $ 254,307.41 $ 254,307.41 17 $ 281,041.64 $ 281,391.36 $ 281,205.55 $ 281,041.64 18 $ 270,977.63 $ 270,976.44 $ 270,991.17 $ 270,976.44 19 $ 279,197.67 $ 279,370.83 $ 279,211.77 $ 279,197.67 20 $ 326,377.03 $ 326,375.92 $ 326,372.10 $ 326,372.10 21 $ 325,372.24 $ 325,401.65 $ 325,380.52 $ 325,372.24

68

Figure 14 – The impact of crossover rate on the total cost

Table 13 presents the variation between the total costs obtained using each crossover rate and the minimum cost obtained. The percentage of variation was calculated using eq. (6.1).

% of variation =

(6.1)

The GA-LP using a rate of 0.30 outperforms the results from a rate of 0.10 in 12 weeks and also a rate of 0.20 in 16 weeks. The highest difference between rates was obtained in week 5, where the minimum total cost obtained with crossover 0.30 was 8% better than the others. The smallest variations were obtained after week 5.

$170,000.00 $190,000.00 $210,000.00 $230,000.00 $250,000.00 $270,000.00 $290,000.00 $310,000.00 $330,000.00 $350,000.00 $370,000.00 $390,000.00

Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 Week 8 Week 9 Week 10 Week 11 Week 12 Week 13 Week 14 Week 15 Week 16 Week 17 Week 18 Week 19 Week 20 Week 21

Total Cost ($)

Crossover Rate Impact in Total Cost

Cross 0.1 Cross 0.2 Cross 0.3

69

Table 13 - Variation between crossover rates.

Week Minimum Pc = 0.10 Pc = 0.20 Pc = 0.30

Figure 15 presents the execution time according to different crossover rates. The results show that the minimum time is obtained with the crossover rate being 0.1, and it remains almost the same with 0.2. In this case the Linear Programming function costs more than 90% of its run time. As mention in previous chapter, the LP solver in MATLAB solves the LP model within 2 seconds in our experiments.

The run time for the crossover rate of 0.30 results in a run time almost five times higher than others. In this case, ranking selection process represents around 70% of its run time. This is caused by the setting, that all individual to be mate need to be “unique”, making more difficult to obtain individuals if the number of parents to be selected increased.

70

Figure 15 - Execution time to find best solution with different crossover rates.

6.1.2.1 Modified Selection Process

In order to improve the execution time of the GA-LP, the selection process was slightly changed. Originally was set that all individuals in the parents’ matrix need to be “unique”, however this caused an abrupt increase in running time when the number of parents to be selected increases. For this reason, it was decided to modify the algorithm by requiring the selection of individuals to form "unique couples”. This means that one individual can be in more than one couple as long as the mating is different.

After this modification, two crossover rates were tested, 0.30 and 0.40, to detect if any improvement can be obtained in running time and total cost. All weeks were run one time and with 500 maximum generations. Table 14 summarizes the parameters used for these tests.

0 200 400 600 800 1,000 1,200 1,400 1,600 1,800 2,000

Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 Week 8 Week 9 Week 10 Week 11 Week 12 Week 13 Week 14 Week 15 Week 16 Week 17 Week 18 Week 19 Week 20 Week 21

Time (seconds)

Crossover Rate Impact in Run Time

Cross 0.1 Cross 0.2 Cross 0.3

71

Table 14 - Parameters used for GA-LP with modified Selection Process.

Crossover Rate Mutation Rate

0.30 0.10

0.40 0.10

Table 15 – The impact of crossover rate on the total cost.

Week CR = 0.10 CR =0.20 CR =0.30 CR = 0.40 Minimum

We compare the results were for different crossover rates and summarize them in Table 15. The GA-LP approach using a crossover rate of 0.30 in general outperforms 9 weeks.

Comparing with each rate it outperforms the rate of 0.10 in 11 weeks, 15 weeks for the rate of 0.20 and 13 weeks for the rate of 0.40. Again the highest improvement was 8% in week 5. Very small changes in the total cost were obtained after the week 5. Also the variations in the total costs obtained using each crossover rate and the minimum cost obtain were calculated; the

72

results are summarized in Table 16.

Table 16 – The variation between the crossover rates

Week Pc = 0.10 Pc = 0.20 Pc = 0.30 Pc = 0.40

2 -2.66% -2.67% -2.66% 0.00%

3 -0.002% -0.004% 0.00% -2.15%

4 -1.57% 0.00% -2.08% -6.63%

5 -8.08% -8.08% 0.00% -8.16%

6 0.00% -0.000001% -0.44% -0.09%

7 -0.35% -0.35% 0.00% -0.35%

8 -0.78% -0.78% 0.00% -0.78%

9 -1.16% -1.11% 0.00% -1.17%

10 -0.72% -0.71% 0.00% -0.72%

11 -0.27% -0.68% 0.00% -0.67%

12 -0.45% -0.35% -0.12% 0.00%

13 -0.60% 0.00% -0.63% -0.66%

14 0.00% -0.07% -0.02% -0.01%

15 -0.0004% 0.00% -0.16% -0.16%

16 -0.05% -0.05% 0.00% -0.05%

17 0.00% -0.12% -0.06% -0.12%

18 -0.0002% -0.0002% -0.0002% 0.00%

19 0.00% -0.06% -0.06% -0.01%

20 -0.01% -0.01% 0.00% -0.0004%

21 -0.0003% -0.01% -0.01% 0.00%

Total running time was greatly improved with the new selection process. Figure 16 depicts the total time for each week. We were satisfied with the situation that we reduce the running time for higher crossover rates without sacrificing the solution quality.

73

Figure 16 – The impact of crossover rates on the total run time.

The sum of all instances also helps us to verify which crossover rate perform better in overall. Figure 17 show that the crossover rate of 0.30 performs better. Therefore this is picked as the best crossover rate, which is going to be tested with different mutation rates.

Figure 17 - Total Cost vs. Crossover Rate.

200

Cross 0.1 Cross 0.2 Cross 0.3 Cross 0.4

$5,897,454.77

74