F# Microsoft Solver Foundation - NelderMeadSolver 类
谁能向我展示在 F# 中使用 NelderMeadSolver 类的示例代码?
例如,我想最小化以下函数: F(X, Y)
F = (X-1)^2 + (y-1)^2 其中 0< X< 2 , 0< Y< 2 答案显然是 X = 1, Y = 1
我找到了 C# 的示例:
http://msdn.microsoft.com/en- us/library/hh404040(v=VS.93).aspx
如果有人能给我简单的 F# 代码来最小化上述函数,我将非常感激。谢谢。
Could anyone show me a sample code to use NelderMeadSolver class in F#?
For example, I want to minimize the following function: F(X, Y)
F = (X-1)^2 + (y-1)^2 where 0< X < 2 , 0< Y < 2 Answer is obviousely X = 1, Y = 1
I found an example for C#:
http://msdn.microsoft.com/en-us/library/hh404040(v=VS.93).aspx
I would appreciate very much if someone can give me simple F# code to minimize the function above. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前从未使用过 Solver Foundation,但这里有一个来自 MSDN 中的 C# 示例(适应您的优化功能):
您应该能够添加 Solver Foundation 的引用并构建程序。如果您在 F# Interactive 中使用代码,请记住通过引用 Solver Foundation 的 dll 文件的确切路径来添加它们。
I've never used Solver Foundation before, but here is a straightforward translation from C# example in MSDN (adapted to your optimization function):
You should be able to add Solver Foundation's references and build the program. If you use the code in F# Interactive, remember to add Solver Foundation's dll files by referencing their exact paths.