I am trying to optimize a complex PDE using differential_evolution. Sometimes my function for specific cases returns 'nan' and the differential evolution evaluation report takes that as the result of the evaluation. How can I tell the optimizer to ignore the results when it gets a 'nan' value?
Asked
Active
Viewed 91 times
0
-
If you get a NaN, it means there is something that is clearly wrong in your algorithm. Many optimizers assume the search space is differentiable. If this is not the case then you will get issues. I would say a function with NaN is not differentiable since it is not even continuous! This seriously breaks many optimizations methods. One solution to this problem is to extend the contiguity of the function but having many NaN can cause this extension method to be very hard to do in practice (and very expensive). – Jérôme Richard Feb 12 '23 at 00:35
-
it's a mass/heat transfer system. as long as parameters are describable onlywith empirical equations, that produces erroneous results sometimes, when you don't know how to manage your range of parameters. ANYWAYS, my response is a dataframe and I managed to take care of this issue by replacing all 'nan' values with zeros (that worked particularly well for my case). So any time my response is 'nan', it gets replaced with zeros, and that make my objective function so large which makes my optimizer consider that as a bad result unlike in the past that it would consider 'nan' as the minimum!! – user3015729 Feb 12 '23 at 12:56