def __init__(self,
              problem,
              population,
              MAXGEN=None,
              MAXTIME=None,
              MAXEVALS=None,
              MAXSIZE=None,
              logTras=None,
              verbose=None,
              outFunc=None,
              drawing=None,
              trappedValue=None,
              maxTrappedCount=None,
              dirName=None,
              **kwargs):
     # 先调用父类构造方法
     super().__init__(problem, population, MAXGEN, MAXTIME, MAXEVALS,
                      MAXSIZE, logTras, verbose, outFunc, drawing,
                      trappedValue, maxTrappedCount, dirName)
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'DE/current-to-rand/1'
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=[
             0.5, None
         ])  # 生成差分变异算子对象,这里F=[0.5, None]表示F1 = 0.5, F2 = [0, 1)之间的随机数
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
Exemplo n.º 2
0
 def __init__(self,
              problem,
              population,
              MAXGEN=None,
              MAXTIME=None,
              MAXEVALS=None,
              MAXSIZE=None,
              logTras=None,
              verbose=None,
              outFunc=None,
              drawing=None,
              dirName=None,
              **kwargs):
     # 先调用父类构造方法
     super().__init__(problem, population, MAXGEN, MAXTIME, MAXEVALS,
                      MAXSIZE, logTras, verbose, outFunc, drawing, dirName)
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'NSGA3-DE'
     if self.problem.M < 10:
         self.ndSort = ea.ndsortESS  # 采用ENS_SS进行非支配排序
     else:
         self.ndSort = ea.ndsortTNS  # 高维目标采用T_ENS进行非支配排序,速度一般会比ENS_SS要快
     self.selFunc = 'tour'  # 基向量选择方式,采用锦标赛选择
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=0.5)  # 生成差分变异算子对象
         self.recOper = ea.Xovbd(
             XOVR=0.5, Half_N=True)  # 生成二项式分布交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
     self.F = 0.5  # 差分变异缩放因子(可以设置为一个数也可以设置为一个列数与种群规模数目相等的列向量)
     self.pc = 0.2  # 交叉概率
 def __init__(self,
              problem,
              population,
              MAXGEN=None,
              MAXTIME=None,
              MAXEVALS=None,
              MAXSIZE=None,
              logTras=None,
              verbose=None,
              outFunc=None,
              drawing=None,
              trappedValue=None,
              maxTrappedCount=None,
              dirName=None,
              **kwargs):
     # 先调用父类构造方法
     super().__init__(problem, population, MAXGEN, MAXTIME, MAXEVALS,
                      MAXSIZE, logTras, verbose, outFunc, drawing,
                      trappedValue, maxTrappedCount, dirName)
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'DE/best/1/bin'
     self.selFunc = 'ecs'  # 基向量的选择方式,采用精英复制选择
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=0.5)  # 生成差分变异算子对象
         self.recOper = ea.Xovbd(
             XOVR=0.5, Half_N=True)  # 生成二项式分布交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
Exemplo n.º 4
0
 def __init__(self, problem, population):
     ea.SoeaAlgorithm.__init__(self, problem, population) # 先调用父类构造方法
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'DE/current-to-rand/1'
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F = [0.5, None]) # 生成差分变异算子对象,这里F=[0.5, None]表示F1 = 0.5, F2 = [0, 1)之间的随机数
     else:
         raise RuntimeError('编码方式必须为''RI''.')
Exemplo n.º 5
0
 def __init__(self, problem, population):
     ea.SoeaAlgorithm.__init__(self, problem, population) # 先调用父类构造方法
     if str(type(population)) != "<class 'Population.Population'>":
         raise RuntimeError('传入的种群对象必须为Population类型')
     self.name = 'DE/best/1/bin'
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F = 0.5) # 生成差分变异算子对象
         self.recOper = ea.Xovbd(XOVR = 0.5, Half = True) # 生成二项式分布交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为''RI''.')
Exemplo n.º 6
0
 def __init__(self, problem, population):
     ea.SoeaAlgorithm.__init__(self, problem, population)  # 先调用父类构造方法
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'DE/current-to-best/1/bin'
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=0.5)  # 生成差分变异算子对象
         self.recOper = ea.Xovbd(
             XOVR=0.5, Half_N=True)  # 生成二项式分布交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
 def __init__(self, problem, population):
     ea.SoeaAlgorithm.__init__(self, problem, population) # 先调用父类构造方法
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'DE/rand/1/L'
     self.selFunc = 'rcs' # 基向量的选择方式,采用随机补偿选择
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F = 0.5) # 生成差分变异算子对象
         self.recOper = ea.Xovexp(XOVR = 0.5, Half = True) # 生成指数交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为''RI''.')
 def __init__(self, problem, population):
     ea.SoeaAlgorithm.__init__(self, problem, population)  # 先调用父类构造方法
     if str(type(population)) != "<class 'Population.Population'>":
         raise RuntimeError('传入的种群对象必须为Population类型')
     self.name = 'DE_rand_1_L'
     self.selFunc = 'rws'  # 基向量的选择方式,采用轮盘赌选择
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=0.5)  # 生成差分变异算子对象
         self.recOper = ea.Xovexp(XOVR=0.5,
                                  Half=True)  # 生成指数交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
Exemplo n.º 9
0
 def __init__(self, problem, population):
     ea.SoeaAlgorithm.__init__(self, problem, population)  # 先调用父类构造方法
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'DE/target-to-best/1/bin'
     self.k = 0.5  # target-to-best中的参数k
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=[self.k, 0.5])  # 生成差分变异算子对象
         self.recOper = ea.Xovexp(XOVR=0.5,
                                  Half=True)  # 生成指数交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
Exemplo n.º 10
0
 def __init__(self, problem, population):
     ea.MoeaAlgorithm.__init__(self, problem, population)  # 先调用父类构造方法
     self.name = 'NSGA2-DE'
     if self.problem.M < 10:
         self.ndSort = ea.ndsortESS  # 采用ENS_SS进行非支配排序
     else:
         self.ndSort = ea.ndsortTNS  # 高维目标采用T_ENS进行非支配排序,速度一般会比ENS_SS要快
     self.selFunc = 'tour'  # 选择方式,采用锦标赛选择
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=0.5)  # 生成差分变异算子对象
         self.recOper = ea.Xovbd(XOVR=0.5,
                                 Half=True)  # 生成二项式分布交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
Exemplo n.º 11
0
 def __init__(self, problem, population):
     ea.MoeaAlgorithm.__init__(self, problem, population)  # 先调用父类构造方法
     if population.ChromNum != 1:
         raise RuntimeError('传入的种群对象必须是单染色体的种群类型。')
     self.name = 'NSGA3-DE'
     if self.problem.M < 10:
         self.ndSort = ea.ndsortESS  # 采用ENS_SS进行非支配排序
     else:
         self.ndSort = ea.ndsortTNS  # 高维目标采用T_ENS进行非支配排序,速度一般会比ENS_SS要快
     self.selFunc = 'tour'  # 基向量选择方式,采用锦标赛选择
     if population.Encoding == 'RI':
         self.mutOper = ea.Mutde(F=0.5)  # 生成差分变异算子对象
         self.recOper = ea.Xovbd(
             XOVR=0.5, Half_N=True)  # 生成二项式分布交叉算子对象,这里的XOVR即为DE中的Cr
     else:
         raise RuntimeError('编码方式必须为' 'RI' '.')
     self.F = 0.5  # 差分变异缩放因子(可以设置为一个数也可以设置为一个列数与种群规模数目相等的列向量)
     self.pc = 0.2  # 交叉概率