⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compare.m

📁 Augmented Lagrangian Algorithms 求解非线性最化的局部最优解
💻 M
字号:
%% the compare function is the stop condition
%% 
function f=compare( x )
global r_al pena N_equ N_inequ;
h_equ=0;
h_inequ=0;
temp_constrains=constrains( x );
N=N_equ+N_inequ;

for i=1:N
    %% the equality constrains part;
    if N_equ~=0 && N_equ>=i
            h_equ=h_equ + temp_constrains(i).^2;
    end
    %% the inequality constrains part;
    if N_inequ~=0 && i>N_equ       
            h_inequ=h_inequ + ( max( -temp_constrains(i), -r_al(i)/pena ) ).^2;     
    end
end
f=sqrt( h_equ +h_inequ );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -