forum.alglib.net
http://forum.alglib.net/

maximize function of two variables
http://forum.alglib.net/viewtopic.php?f=2&t=597
Page 1 of 1

Author:  MrBrownstone [ Wed Jul 11, 2012 3:38 am ]
Post subject:  maximize function of two variables

Hello All -

First of all, thank you very much for providing such a great library and an invaluable learning resource.

I have a function of two variables which I'd like to maximize using Alglib for C#. I've decided to use the BFGS optimizer, only passing in the function, no gradient. After reading through the reference manual, it looks like the call to alglib.minlbfgssetcond() is where I define the conditions for the optimization. In the manual, however, it's not clear how I would specify that I'm looking to maximize the function result. I'm thinking I just need to pass in a value for the EpsF argument, but which value would tell the library that I'm looking for a max? Also, is it valid to pass in zeroes for the other arguments? Will that change the optimization?

I'm very new to this, so I apologize in advance for the rookie nature of these questions.

Thanks for your help.

- MrBrownstone

Author:  Sergey.Bochkanov [ Wed Jul 11, 2012 6:09 am ]
Post subject:  Re: maximize function of two variables

1. You can minimize g(x)=-f(x) instead of maximizing f. There is no way to tell ALGLIB optimizer that it should maximize instead of minimization, but it is easy to replace maximization by minimization.
2. You can set one of the stopping criteria to non-zero value and set other ones to zero. Algorithm will correctly stop using the only non-zero criteria.

Author:  MrBrownstone [ Wed Jul 11, 2012 10:52 am ]
Post subject:  Re: maximize function of two variables

Sergey -

Thank you very much for the prompt response. I will give this a try today.

-MrBrownstone

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/