abolfazlshirazi / EDAPP

EDA++: Estimation of Distribution Algorithms with Feasibility Conserving Mechanisms for Constrained Continuous Optimization
5 stars 2 forks source link

help #1

Closed MohammedQaraad closed 2 years ago

MohammedQaraad commented 2 years ago

hi i hope this message finds you well I just wondering about your way to calculate Vio term I am working on the python version def p1(x):

Heat Exchanger Network Design (case 1)

out = constant.benchmark_function(1)
D, g, h, xmin, xmax = out["D"], out["g"], out["h"], out["xmin"], out["xmax"]
fx = 35 * x[0] ** 0.6 + 35 * x[1] ** 0.6
gx = 0
hx = zeros(h)
hx[0] = 200 * x[0] * x[3] - x[2]
hx[1] = 200 * x[1] * x[5] - x[4]
hx[2] = x[2] - 1000 * (x[6] - 100)
hx[3] = x[4] - 10000 * (300 - x[6])
hx[4] = x[2] - 10000 * (600 - x[7])
hx[5] = x[4] - 10000 * (900 - x[8])
hx[6] = x[3] * log(abs(x[7] - 100) + 1e-8) - x[3] * log((600 - x[6]) + 1e-8) - x[7] + x[6] + 500
hx[7] = x[5] * log(abs(x[8] - x[6]) + 1e-8) - x[5] * log(600) - x[8] + x[6] + 600
return fx, gx, hx

how to evaluate fx according to g(x) and (hx) thanks in advance

abolfazlshirazi commented 2 years ago

Hi,

Assuming that you are referring to the constraint violation, it can be computed as cx:

cx = (sum([sum(g.*(g>0),1); sum(abs(h).*(abs(h)>eps),1)])./const_num);

where g and h are the vectors of inequality and equality constraints, const_num is the total number of constraints, and eps is the threshold for the conversion of equality constraints, which has been set to 1e-4 in the research.

See EDAPP/COMPARISON/ALG_EDAPP/conFcnCEC2020.m as:

function out = conFcnCEC2020(x)
    global fcnNum const_num;
    [~,g,h] = cec20_func(x,fcnNum);    
    out = (sum([sum(g.*(g>0),1); sum(abs(h).*(abs(h)>1e-4),1)])./const_num);
end
MohammedQaraad commented 2 years ago

salam 3alekom i hope this email finds you well thank you for your reply I have the problem to develop a platform to solve cec2020 MO Eng problems I have tried to solve these benchmarks with PSO (attached) but I still have a problem I hope you can help me to fix it you can delete any part in my code or update it (feel free) finally Ramadan Kareem

On Thu, Mar 31, 2022 at 6:57 PM Abolfazl Shirazi @.***> wrote:

Hi,

Assuming that you are referring to the constraint violation, it can be computed as cx:

cx = (sum([sum(g.(g>0),1); sum(abs(h).(abs(h)>eps),1)])./const_num);

where g and h are the vectors of inequality and equality constraints, const_num is the total number of constraints, and eps is the threshold for the conversion of equality constraints, which has been set to 1e-4 in the research.

See EDAPP/COMPARISON/ALG_EDAPP/conFcnCEC2020.m https://github.com/abolfazlshirazi/EDAPP/blob/master/COMPARISON/ALG_EDAPP/conFcnCEC2020.m as:

function out = conFcnCEC2020(x) global fcnNum const_num; [~,g,h] = cec20_func(x,fcnNum); out = (sum([sum(g.(g>0),1); sum(abs(h).(abs(h)>1e-4),1)])./const_num); end

— Reply to this email directly, view it on GitHub https://github.com/abolfazlshirazi/EDAPP/issues/1#issuecomment-1084844780, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMAYL7RTFPE7FVZZEKQPSM3VCXKOZANCNFSM5SAATEXQ . You are receiving this because you authored the thread.Message ID: @.***>