artofscience / SAOR

Sequential Approximate Optimization Repository
GNU General Public License v3.0
5 stars 1 forks source link

Enable approximated approximations #19

Closed artofscience closed 3 years ago

artofscience commented 3 years ago

In addition accepting function calls g, dg, ddg it would also be nice to accept analytical function g, dg, ddg such that we can easily make approximations of approximations of approximations etc.

As far as I see now, this should be easily possible in current structure.

aatmdelissen commented 3 years ago

@artofscience do you mean as a string? We could use sympy library to convert a string to a function (sympy.lambdify) and differentiate (sympy.diff).

Giannis1993 commented 3 years ago

I think it is nice to be able to perform the approximated approximations concept in the exact same format as the single approximation. That way, we can show that it is nothing more than performing 2 concecutive Taylor-like approximations. Since this issue is closely related to #24, I'll try to solve this one and @artofscience can work on #24 (?). I think with the current format (no need for using lambda functions or sympy library) I should be able to include the approximated approximations.

aatmdelissen commented 3 years ago

As per #57, this is easily done by nesting subproblems. Example

subprob1  = Subproblem(Taylor1(MMA()))
subprob2  = Subproblem(Taylor1(Linear())

prob.evaluate(x)
subprob1.update(x, prob.g, prob.dg)
subprob2.update(x, subprob1.g, subprob1.dg)