滑らかでない関数の滑らかな定式化
滑らかでない他の問題を平滑化するため、補助関数を追加できる場合があります。たとえば、
f(x) = max(g(x),h(x))
は、以下の関数で示されるように、g(x) と h(x) が滑らかな場合でも、滑らかでない関数になることがあります。
f(x) は、点 x = π/4 および x = 5π/4 において滑らかではありません。
すべての Optimization Toolbox™ ソルバーは目的関数および非線形制約関数が連続的に微分可能であることを前提としているため、このように滑らかさに欠ける場合はソルバーで問題が発生する可能性があります。したがって、次を解こうとすると
x = mint(f(t)) (点 x0
= 1 から開始)
終了フラグの 1 を取得できません。これは、解が局所的最小化点 x = π/4 において微分可能でないためです。
fun1 = @sin; fun2 = @cos; fun = @(x)max(fun1(x),fun2(x)); [x1,fval1,eflag1] = fminunc(fun,1)
Local minimum possible. fminunc stopped because it cannot decrease the objective function along the current search direction. <stopping criteria details> x1 = 0.7854 fval1 = 0.7071 eflag1 = 5
補助変数を使用すると、滑らかでない問題を滑らかな問題に変換できる場合があります。前の例について、滑らかな制約をもつ補助変数 y を考えます。
これらの制約の下で最適化問題を検討します。
結果として得られる解 x
, y
は、元の問題に対する解です。
この定式化では、問題ベースのアプローチを使用します。
myvar = optimvar("myvar"); auxvar = optimvar("auxvar"); smprob = optimproblem("Objective",auxvar); smprob.Constraints.cons1 = auxvar >= sin(myvar); smprob.Constraints.cons2 = auxvar >= cos(myvar); x0.myvar = 1; x0.auxvar = 1; [sol2,fval2,eflag2] = solve(smprob,x0)
Solving problem using fmincon. Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. sol2 = struct with fields: auxvar: 0.7071 myvar: 0.7854 fval2 = 0.7071 eflag2 = OptimalSolution
これと同じ考え方が、関数 fminimax
の定式化の基盤にもなっています。ゴール到達法を参照してください。