3

so I have a function like

int f(int i, int j, int c, double d) {
    /*...any operations with i, j, c, d affect on some return int we have*/
}

Is there any thing in boost or STD that would take my function and find the input arguments that minimize my function output?

Dan Breslau
  • 11,472
  • 2
  • 35
  • 44
Rella
  • 65,003
  • 109
  • 363
  • 636
  • Boost cannot magically know what your function does with the arguments at run-time. – GManNickG Feb 04 '11 at 16:28
  • 1
    This isn't a question that anyone can answer in its current form. Please provide more details about what your function is supposed to do (ideally including the function's code), and explain what you mean by "[minimizing] my function output." – Dan Breslau Feb 04 '11 at 16:29
  • 5
    There are techniques for finding the arguments that minimize or maximize the output of a black-box function, provided it is a function in the mathematical sense. I think that's what Kabumbus wants. – zwol Feb 04 '11 at 16:31
  • @Zack: Thanks for the helpful interpretation. I'd withdraw my vote to close, but there doesn't seem to be a way that I can do that. I made some slight edits to the question to slant it towards your interpretation. – Dan Breslau Feb 04 '11 at 16:36

3 Answers3

5

I assume you're trying to do a "simple" mathematical multi-dimensional minimization.

GSL has some functions to help you with this. I wouldn't look any further ;)

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • Please read the information given to you: http://www.gnu.org/software/gsl/manual/html_node/Multimin-Examples.html – rubenvb Feb 05 '11 at 14:22
4

I understand you to be looking for code to perform mathematical optimization.

Boost does not have anything to do this as far as I know, and neither does the standard library; however, NLopt may be what you're looking for.

zwol
  • 135,547
  • 38
  • 252
  • 361
2

You can use Brent's algorithm to minimise simple functions.

http://www.boost.org/doc/libs/1_65_0/libs/math/doc/html/math_toolkit/roots/brent_minima.html

Brice M. Dempsey
  • 1,985
  • 20
  • 16
  • The documentation is missing in newer versions of Boost but you can still use the code. Just follow the example found in your Boost download: boost_1_62_0\libs\math\example\brent_minimise_example.cpp – Niels Holst Aug 24 '17 at 10:32