libprima / prima

PRIMA is a package for solving general nonlinear optimization problems without using derivatives. It provides the reference implementation for Powell's derivative-free optimization methods, i.e., COBYLA, UOBYQA, NEWUOA, BOBYQA, and LINCOA. PRIMA means Reference Implementation for Powell's methods with Modernization and Amelioration, P for Powell.
http://libprima.net
BSD 3-Clause "New" or "Revised" License
291 stars 35 forks source link

Refactor examples #131

Closed nbelakovski closed 6 months ago

nbelakovski commented 6 months ago

In this PR I have:

The goal is to provide at least one example using a trivial objective function (in this context 'trivial' implies that the optimal point of the function is obvious without having to take any derivative or do any math) so that the user can focus on the API and usage.

The previous C objective function was actually a little strange, its optimal point was $(2.99, 2 - \frac{1}{140})$ which is not obvious and looks close enough to $(3,2)$ that when the optimization algorithm settles on $(2.99, 1.99)$ it looks "close enough" when in fact it is exact (within the limits of finite precision).

nbelakovski commented 6 months ago

@zaikunzhang Any comments?

zaikunzhang commented 6 months ago

Thank you @nbelakovski . I made some small modifications to the examples:

https://github.com/libprima/prima/commit/c342289a014c29d6297efc153f20d9b9f12dd587 https://github.com/libprima/prima/commit/4347d535bee41bf08d022c8effcbc3b053d6c75f

I hope you agree with them. Tell me if this is not the case.

nbelakovski commented 6 months ago

Those mods seem fine to me, thank you.