6

私は'COBYLA'scipyのoptimize.minimize機能でアルゴリズムを使用しています(cygwin用のv.0.11ビルド)。この場合、パラメーターboundsが使用されていないようです。たとえば、簡単な例:

from scipy.optimize import minimize

def f(x):
    return -sum(x)

minimize(f, x0=1, method='COBYLA', bounds=(-2,2))

戻り値:

status: 2.0
nfev: 1000
maxcv: 0.0
success: False
fun: -1000.0
x: array(1000.0)
message: 'Maximum number of function evaluations has been exceeded.'

の期待の代わり2x

誰かが同じ問題を認識しましたか? 既知のバグまたはドキュメント エラーはありますか? scipy 0.11 のドキュメントでは、このオプションはCOBYLAアルゴリズムから除外されていません。実際、関数にはパラメーターfmin_cobylaがありません。boundsヒントをありがとう。

4

2 に答える 2

4

元のCOBYLA(2) FORTRAN アルゴリズムは、変数の境界を明示的にサポートしていません。一般的な制約のコンテキストで境界を定式化する必要があります。

ここでSciPy minimizeインターフェースの現在のソース コードを見ると、SciPy ではこの制限を処理するための対策がまだ講じられていないことが明らかです。

したがって、SciPy関数でcobylaアルゴリズムの境界を適用するには、変数の境界を不等式制約として定式化し、それらを関連する制約パラメーターに含める必要があります。 minimize

(ソースコード抜粋)

// bounds set to anything else than None yields warning
if meth is 'cobyla' and bounds is not None:
    warn('Method %s cannot handle bounds.' % method,
         RuntimeWarning)
...
// No bounds argument in the internal call to the COBYLA function
elif meth == 'cobyla':
    return _minimize_cobyla(fun, x0, args, constraints, **options)
于 2012-10-30T20:46:31.273 に答える