bound.m

来自「数学优化工具箱」· M 代码 · 共 37 行

M
37
字号
function cube=bound(cube,opts);% perform the bounding operation for the bandb algorithm% assume that opts already contains most of the hardwork for sedumi% doneif cube.refined ==0;    cube = bandb_refine_bounds(cube,opts);    if cube.feasible ==0;      return;    end;    cube.refined=1;end;uopts=bandb_update(cube.H,opts);[x,y,info]=sedumi(uopts.A,uopts.b,uopts.c,uopts.K,uopts.pars);if info.numerr > 1;    % error to begin with    cube.feasible=0;    fprintf('Error encountered (numerical problems): %d\n',info.numerr);    uopts.ybounds    info    return;endif info.dinf == 0;    % program is feasible    cube.feasible = 1;    [cube.lb,cube.v,cube.obj,cube.lbr,cube.vr,cube.objr,cube.den]=bandb_eval(y,opts);    cube.point = y;        if (cube.lb > (cube.v+1e-6))        fprintf('envelope violated %f %f %f \n', cube.lb,cube.v,cube.obj );	fprintf('envelope violated %f %f %f \n\n', cube.lb-cube.v,cube.v-cube.obj );	cube.feasible = 0;    endend

⌨️ 快捷键说明

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