このページは機械翻訳を使用して翻訳されました。最新版の英語を参照するには、ここをクリックします。
実行可能な開始点のみを使用して最適化する
StartPointsToRun オプションを設定すると、MultiStart と GlobalSearch は不等式制約を満たす開始点のみを使用するようになります。このオプションを使用すると、ローカル ソルバーが実行可能な領域を探索する必要がないため、最適化が高速化されます。ただし、このオプションを使用すると、ソルバーがいくつかの引き込み領域を見逃す可能性があります。
StartPointsToRun オプションには 3 つの設定があります。
all— すべての開始点を受け入れるbounds— 境界を満たさない開始点を拒否しますbounds-ineqs— 境界または不等式制約を満たさない開始点を拒否します
例えば、目的関数が
function y = tiltcircle(x) vx = x(:)-[4;4]; % ensure vx is in column form y = vx'*[1;1] + sqrt(16 - vx'*vx); % complex if norm(x-[4;4])>4
tiltcircle は norm(x - [4 4]) > 4 の複素数値を返します。

norm(x - [4 4]) > 4となる集合上で正となる制約関数を書きなさい。
function [c ceq] = myconstraint(x) ceq = []; cx = x(:) - [4;4]; % ensure x is a column vector c = cx'*cx - 16; % negative where tiltcircle(x) is real
不等式制約を満たす開始点のみを使用するように GlobalSearch を設定します。
gs = GlobalSearch('StartPointsToRun','bounds-ineqs');
例を完了するには、問題構造を作成し、ソルバーを実行します。
opts = optimoptions(@fmincon,'Algorithm','interior-point'); problem = createOptimProblem('fmincon',... 'x0',[4 4],'objective',@tiltcircle,... 'nonlcon',@myconstraint,'lb',[-10 -10],... 'ub',[10 10],'options',opts); rng(7,'twister'); % for reproducibility [x,fval,exitflag,output,solutionset] = run(gs,problem)
GlobalSearch stopped because it analyzed all the trial points.
All 5 local solver runs converged with a positive local solver exit flag.
x =
1.1716 1.1716
fval =
-5.6530
exitflag =
1
output =
struct with fields:
funcCount: 3242
localSolverTotal: 5
localSolverSuccess: 5
localSolverIncomplete: 0
localSolverNoSolution: 0
message: 'GlobalSearch stopped because it analyzed all the trial po...'
solutionset =
1x4 GlobalOptimSolution array with properties:
X
Fval
Exitflag
Output
X0局所最小値を持つ傾斜円

tiltcircle 関数には局所的最小値が 1 つだけあります。しかし、GlobalSearch (fmincon) はいくつかの時点で停止します。これはfminconがエラーを起こしていることを意味しますか?
fmincon が複数の境界点で停止する理由は微妙です。tiltcircle 関数は、1 次元の計算からわかるように、境界上で無限の勾配を持ちます。
したがって、境界に対して垂直な勾配が非常に大きくなります。この勾配は線形項からの小さな追加傾斜を圧倒します。fmincon が知る限り、境界点は制約問題に対する定常点です。
この動作は、平方根を持つ関数があるときはいつでも発生する可能性があります。
