0

I am trying to solve a problem where a number of parameters (let's say 5, can be n) result in a float through a convoluted function that I cannot retro-engineer

f(a,b,c,d,e) = result

I can run the function ad libitum with anything as a,b,c,d and e, and the code will give a result. Running the function twice with the same parameters will give the same result. The parameters can be float, booleans or string. Also, running the function takes about 30 minutes.

I am now trying to determine a,b,c,d and e in such a way that the result is the maximum possible value.

I am currently simulations non-stop where a,b,c,d and e differ slightly from the last found maximum. Little by little, all the variable "crawl" towards the maximum.

This works reasonably well but I was wondering whether I could use a smart Python package to achieve that?

Nicolas Berthier
  • 459
  • 1
  • 8
  • 17
  • 2
    [This answer](https://stackoverflow.com/a/44182285/1782792) is for hypeparameter optimization in machine learning, but it pretty much applies to your use case, since all the listed tools aim to optimize an opaque function that possibly takes a long time to compute. – jdehesa Jun 17 '19 at 16:06
  • 1
    The first question you need to answer is do you think your function is convex or might be? If it's the case, a basic search algorithm will do the job pretty well. Otherwise, you might want to looking into things like GridSearch (which tries every combination) – Philippe Jun 17 '19 at 16:06
  • 1
    Looks like it was answered here https://stackoverflow.com/questions/17814169/maximize-a-function-with-many-parameters-python – Deepstop Jun 17 '19 at 16:07
  • Thank you, I'll check this out. Apologies for the double post. – Nicolas Berthier Jun 17 '19 at 16:11

0 Answers0