Menu

Adigator using loop and ipopt

Help
2017-08-28
2017-08-28
  • Dorian Henricot

    Dorian Henricot - 2017-08-28

    Hello,
    I want to optimize a function f(x,k_n) with x optimization variable and k(n) parameter. We iterate N times over k_n. The way that works is for each k(n) to use adigatorGenFiles4Ipopt and feed the output functions to ipopt. However, this requires to recalculate N times the gradient, jacobian, etc. I would like to know whether it is possible to generate upfront the gradient(x,k0), jacobian(x,k0), etc, and then for each iteration define funcs.gradient=funcs.gradient(x,k_n), etc, and feed funcs to ipopt. So far I get the following error message: "Struct contents reference from a non-struct array object." Hope this is clear and would be glad to get some help.
    Best,

     
  • Matthew J. Weinstein

    Hi Dorian,

    In general, adigator generated files are only valid for fixed dimensional inputs, with fixed reference/assignment input indices. If k_n is an integer which changes the dimension of the problem or is used as a reference/assignment index, then I don't know that adigator can create a file valid for any k_n. If it is just an auxiliary consant (for instance, a cost function multiplier), then it can be declared as an adigatorAuxInput and everything should work for all values of k_n, but that doesn't sound like the case.

    Another thing to look into is the vectorized mode, assuming your problem is changing dimensions. In order to use this, however, generally requires you to ask adigator to differentiate a vectorized portion of the problem and write a wrapper derivative routine which takes those derivatives and completes the chain rule.

    Matt W.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.