0
$\begingroup$

I have a problem under the form of a set of 2 ODE that includes 6 free parameters. I need to optimize these parameters based on experimental results. So far, basically, I have implemented a C++ object that solves the problem (using RK4 method), can interpolate these results, can load an experimental file and determine the distance between model and results using the interpolated function. All this is in one big fat class. Its constructor takes 2 filenames: one for the experimental results and the other one for time parameters driving the system (strain and strain rate, to be more precise).

Now, I am looking for a method to adjust my parameters (which differ greatly in magnitude : some are of the order of 1e-28, others 0.02 and others 1e9 or even 1e13). I have tried various options in C++ without success so far, because I just don't know how to start (I have had a look at nlopt - which is the only one I managed to compile for a simple example case. But apparently it needs simple functions and not whole objects - such as a functor, which would be the best. I have looked at ceres and dlib, but compiling them is so far above my skills... I would not be against using python, possibly (I don't know it well, but at this point I am quite desperate). Would anyone have suggestions at this stage ?

Thanks in advance !

Edit - because some progress were made : I managed to compile basic code with ceres, however I really don't see how I can use my own class solving my ODEs and loading experimental results with it...

$\endgroup$
4
  • 1
    $\begingroup$ If you are willing to rewrite your ODE solver in PETSc, it has optimization wrappers for its ODE classes. What you are trying to do is a pretty common setup so I imagine there should be a simple solution but C++ is not my specialty $\endgroup$
    – whpowell96
    Commented Aug 27 at 17:37
  • $\begingroup$ Thanks for your suggestion @whpowell96 ! I don't know PETSc at all. After what Iread, wouldn't it be a bit overkill ? $\endgroup$
    – user22744
    Commented Aug 28 at 13:26
  • $\begingroup$ It likely would be overkill. nlopt seems reasonable but you would have to refactor or wrap your code so you have a function to input. This is pretty common and has to be done even in high level languages. $\endgroup$
    – whpowell96
    Commented Aug 28 at 15:49
  • $\begingroup$ OK, but then is it possible to handle data file read at execution and avoid reading them several times by using just a function ? I guess it should be C and not C++, then... Thanks again for your help ! $\endgroup$
    – user22744
    Commented Aug 28 at 16:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.