Minimize cost function with BFGS algorithm FreeFem?


I have a cost function and its gradient calculated with finite element discretization (values at integrations points) and I have the data in a text file.
How to minimize this function? any idea?
Thanks for your help.

Best regards,


I never tried that but I think that this page Algorithms & Optimization could interest you.
Moreover, I saw the example plugin/IpoptMinSurf.edp, that may help you.



Thank you so much Lucas for your response.
I have examined the link above but The problem is my cost function and its gradient not mathematically explicit, calculated numerically at some points xi in volume V (integration point) at each increment of time t using another FE solver. The results for the function and its gradient are stored in an array format. My question is how to handle the cost function and its gradient to give them as input for the BFGS algorithm.

Thanks for your help

Excuse me, I did not understood at first your problem. But actually there is still something I do not understand, if the cost function and the gradient are calculated by an other FE solver and stored in a file, why do you want to perform the optimization in FreeFem?


The choice of freefem solver because It is finite element solver and also optimization solver and I think it’s easy for freefem to handle the data generated by FEA solver (discretization) and minimizing the cost function giving the cost, its gradient, and initial guess.

Thanks for your help