计算智能01_2022秋_第一次作业

Homework1_CI_2022F

The first course assignment of Computational Intelligence 01 in Fall 2022
用遗传算法编码求解Dejong1和Dejong2:

Dejong1:

%MATLAB:
function y = dejong1(x1, x2)
    y = x1.^2 + x2.^2;
end

% -5.12<= x <= 5.12

Dejong2:

%MATLAB:
function y = dejong2(x1, x2)
    y = 100*(x1.^2 - x2).^2 + (1-x1).^2; 
end

% -2.048<= x <= 2.048

Requirements:

Design a genetic algorithm to solve for the minimum value of dejong1 and dejong2 in a given range and follow the following requirements:

1. clearly pointintg out the following steps in the implementations:

  • initialization
  • fitness evaluation
  • selection for crossover and mutation
  • environmental selection

2. please set the following components based on your own preferences:

  • the probabilities of crossover, mutation, elitsm
  • the size of population, the types of crossover and mutation
  • and etc.

3. please independently run the algorithms at least 30 times, and finally report the mean and std values

4. please draw the evolutionary process using the data from any run

  • collecting the data (the generation number as well as its corresponding fitness value) during some run, say the fifth run;
  • plot the data in a two-dimension axis;
  • the horizontal axis denotes the generation number, and the vertical axis denotes the fitness value.
  • try to conclude something from this figure plotted.

5. please draw the mean, max, and min values of the same generation in different runs (boxplot?)

  • collecting the fitness values of the same generations in all runs;
  • using boxplot to plot the data collected from the 30 runs;
  • try to conclude something from this figure plotted.

要求:

#设计一个遗传算法来求解dejong1和dejong2在给定范围内的最小值,并遵循以下要求:

1.在实现中明确指出以下步骤:

  • 初始化;
  • 适度值评估;
  • 交叉和变异的选择;
  • 环境选择。

2.请根据你自己的喜好来设置以下组件:

  • 交叉、变异概率;
  • 精英主义的比例;
  • 群体的大小,交叉和变异的类型;
  • 等等。

3、请独立运行算法至少30次,最后报告平均值和标准值

4. 请用任何一次运行的数据画出进化过程

  • 在某次运行中收集相应的数据(代数以及相应的适度值),例如第五次运行中,适度值为多少…;
  • 将数据绘制在一个二维轴上;
  • 横轴表示代数,纵轴表示适度值;
  • 试着从这个图中得出一些结论。

5.请画出同一代在不同运行中的平均值、最大值和最小值(boxplot?)

  • 收集所有运行中同一世代的适度值;
  • 使用boxplot绘制从30次运行中收集的数据;
  • 试着从这幅图中得出一些结论。

算法实现参考链接:https://blog.csdn.net/silence1214/article/details/48409383?locationNum=14&fps=1
请各位同学自行设计实现,作业检查会在百度和Github中进行查重。

猜你喜欢

转载自blog.csdn.net/DENGSHUCHAO152/article/details/123048196