Is there a way to use fmincon without function handles?

1 回表示 (過去 30 日間)
Andrew Poissant
Andrew Poissant 2017 年 4 月 26 日
編集済み: Stephen23 2017 年 5 月 3 日
I want to use fmincon as part of an optimization study but I have that inside a MonteCarlo simulation. Using function handles inside a for loop is a pain so I was wondering if there is a way to use fmincon without function handles. Does anyone have any helpful links or a simple example?
  1 件のコメント
Stephen23
Stephen23 2017 年 5 月 3 日
編集済み: Stephen23 2017 年 5 月 3 日
"Using function handles inside a for loop is a pain"
How exactly is using function handles "a pain"? Function handles are the data type/class designed specifically for containing functions. They are exactly the right tool for the job, because that is the job they were designed for.
If you find them "a pain", perhaps you are doing something awkward with your code (which you did not show us). How would you imagine specifying the function to be optimized without defining a function?

サインインしてコメントする。

回答 (2 件)

Prannay Jain
Prannay Jain 2017 年 5 月 2 日
編集済み: Stephen23 2017 年 5 月 3 日
According to the documentation of fmincon - http://www.mathworks.com/help/optim/ug/fmincon.html, you can also use problem structure,
>> x = fmincon(problem)
But this problem structure will eventually have a function as one of its fields. The definition of fmincon says to find the minimum of constrained nonlinear multivariable function, so you have to use function handler.

Walter Roberson
Walter Roberson 2017 年 5 月 3 日
Possibly linprog() or quadprog() or intlinprog() would be of interest to you: they allow minimization specified in terms of matrices.
quadprog() is the only nonlinear minimization that can be specified as matrices in the MATLAB toolboxes.
There is third-party GA toolboxes that specify the problem as arrays.

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by