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' '.')
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''.')
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.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' '.')
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 # 交叉概率
def __init__(self, problem, population): ea.MoeaAlgorithm.__init__(self, problem, population) # 先调用父类构造方法 if population.ChromNum != 1: raise RuntimeError('传入的种群对象必须是单染色体的种群类型。') self.name = 'MOEA/D-DE' if population.Encoding == 'RI': self.F = 0.5 # 差分变异的F self.recOper = ea.Xovbd( XOVR=1, Half=True) # 生成二项式分布交叉算子对象,这里的XOVR实际就是二项式分布交叉算法中的Cr self.mutOper = ea.Mutpolyn(Pm=1 / self.problem.Dim, DisI=20) # 生成多项式变异算子对象 else: raise RuntimeError('编码方式必须为' 'RI' '.') self.neighborSize = None # 邻域大小,当设置为None时,将会自动设置为等于种群规模的十分之一 if self.problem.M <= 2: self.decomposition = ea.tcheby # 采用切比雪夫权重聚合法 else: self.decomposition = ea.pbi # 采用pbi权重聚合法 self.Ps = 0.9 # (Probability of Selection)表示进化时有多大的概率只从邻域中选择个体参与进化 self.Nr = 2 # MOEAD-DE中的参数Nr,默认为2