コード例 #1
0
ファイル: MOEAD.py プロジェクト: Y1fanHE/moead-levy-python
beta = params['beta']  # set stability parameter of levy flight mutation
etam = params['etam']  # set index parameter of polynomial mutation

#################
# start program #
#################

os.makedirs(f'./{prefix}',
            exist_ok=True)  # create a folder to include running results
os.makedirs(f'./{prefix}/history/', exist_ok=True)
os.makedirs(f'./{prefix}/history/{args.seed}', exist_ok=True)

W = das_dennis(n_part, n_obj)  # generate a set of weight vectors
B = determine_neighbor(W, n_neb)  # determine neighbor
X = init_pop(n_pop, n_var, xl, xu)  # initialize a population
F = eval_pop(X, f)  # evaluate fitness
z = init_ref_point(F)  # determine a reference point

for c_gen in range(1, n_gen):  # star main loop

    result = np.hstack([F,
                        X])  # record objective values and decision variables
    np.savetxt(f'./{prefix}/history/{args.seed}/{c_gen}.csv', result)

    for i in np.random.permutation(n_pop):  # traverse the population

        xi, fi = X[i, :], F[i, :]  # get current individual

        if random.random() < sigma:  # determine selection pool by probability
            pool = B[i, :]  # neighbor as the pool
        else:
コード例 #2
0
problem = set_problem(prob_name, n_var, n_obj, xu, xl)                          # set optimization problem

###############################
# define MOEA/D configuration #
###############################
W = get_weights(decomp_method, params)

n_pop = len(W)

params['n_pop'] = n_pop

B = determine_neighbor(W, T)                                                    # determine neighbor

X = init_pop(n_pop, n_var, xl, xu)                                              # initialize a population

Y = eval_pop(X, problem, prob_name)                                                    # evaluate fitness

ref_point = init_ref_point(Y)                                                           # determine a reference point
EP = init_EP(X, Y, n_pop, n_obj)                                                #initialize External population

beta = 0.3
P = np.zeros(n_pop) + beta                                                      # generate a set of stability beta parameters 
# P = np.random.uniform(params['betal'],params['betau'], n_pop)                                      # generate a set of stability parameters
nr = params['nr']

delta = params['delta']

##################################
# set self adaptive parameters #
##################################
betal = params['betal']                                                         # set lower bound for stability parameter of levy flight mutation
コード例 #3
0
    'beta for param']  # set stability factor of levy flight to search parameters
n_step = params['n_step']  # set number of generations to assess a parameter

#################
# start program #
#################

os.makedirs(f'./{output}',
            exist_ok=True)  # create a folder to include running results
os.makedirs(f'./{output}/history/', exist_ok=True)
os.makedirs(f'./{output}/history/{args.seed}', exist_ok=True)

W = das_dennis(sld_n_part, n_obj)  # generate a set of weight vectors
B = determine_neighbor(W, T)  # determine neighbor
X = init_pop(n_pop, n_var, xl, xu)  # initialize a population
Y = eval_pop(X, problem)  # evaluate fitness
z = init_ref_point(Y)  # determine a reference point

P = np.random.uniform(betal, betau,
                      n_pop)  # generate a set of stability parameters
P_parent = P[:]  # initialize a list to store parameters in parent generations
P_offspring = np.full(
    n_pop,
    np.nan)  # initialize a list to store parameters in offspring generations

I = np.zeros(n_pop)  # initialize a set of indicator vaules
I_parent = I[:]  # initialize a list to store indicators in parent generations
I_offspring = I[:]  # initialize a list to store indicators in offspring generations

n_fe = n_pop