我对 F# 很陌生并且遇到了问题。我想解决一个非线性的、有约束的优化问题。目标是最小化minFunc
具有六个参数a
、b
、c
、d
和gamma
的rho_infty
函数(该函数很长,所以我不在这里发布)和附加条件:
a + d > 0,
d > 0,
c > 0,
gamma > 0,
0 <= gamma <= -ln(rho_infty),
0 < roh_infty <= 1.
我已经使用 Microsoft Solver Foundation 的 Nelder Mead Solver 进行了尝试,但我不知道如何添加非线性条件a + d > 0
和0 <= gamma <= -ln(rho_infty)
.
到目前为止我的代码:
open Microsoft.SolverFoundation.Common
open Microsoft.SolverFoundation.Solvers
let funcFindParameters (startValues:float list) minimizationFunc =
let xInitial = startValues |> List.toArray
let lowerBound = [|-infinity; -infinity; 0.0; 0.0; 0.0; 0.0|]
let upperBound = [|infinity; infinity; infinity; infinity; infinity; 1.0|]
let solution = NelderMeadSolver.Solve(Func<float [], _>(fun parameters -> (minimizationFunc
parameters.[0] parameters.[1] parameters.[2] parameters.[3] parameters.[4] parameters.[5])),
xInitial, lowerBound, upperBound)
where parameters.[0] = a, and so one...
是否有可能使用 Nelder Mead Solver 或其他求解器来解决它?