📄 al_obj.m
字号:
%AL_function
% the N_equ the number of the equality , and the N_inequ the number of the
% inequality
function f =AL_obj(x)
global r_al pena N_equ N_inequ;
h_equ=0;
h_inequ=0;
N=N_equ+N_inequ;
temp_constrains=constrains( x );
%% the equality constrains part;
for i=1:N
%% the equality constrains part;
if N_equ~=0 && N_equ>=i
h_equ=h_equ - r_al(i)*temp_constrains(i) + (pena/2)* temp_constrains(i).^2;
end
%% the inequality
if N_inequ~=0 && i>N_equ
temp=0;
temp=max(0,( r_al(i)-pena*temp_constrains(i)));
h_inequ=h_inequ + (0.5/pena)*( temp.^2- r_al(i).^2 );
end
end
f=obj(x)+h_equ+h_inequ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -