artofscience / SAOR

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

Approximated approximations #122

Open artofscience opened 2 years ago

artofscience commented 2 years ago

We can currently do:

intvar = MixedIntervening(problem.n, problem.m + 1, default=Linear())
intvar.set_intervening(MMA(), var=1)
approx = Taylor1(intvar)
subproblem = Subproblem(approx)

To make the approximated approximations we "only" need to do:

intvar = MixedIntervening(problem.n, problem.m + 1, default=Linear())
intvar.set_intervening(MMA(), var=1)
approx = Taylor1(intvar)
approx_of_approx = Taylor2(approx)
subproblem = Subproblem(approx_of_approx))

This means we need to make Approximation accept Approximation.

How can we do this?

artofscience commented 2 years ago

Note the intervening object holds the y and dy methods, and the Approximation holds the g and dg methods. Basically both are functions and their derivatives, maybe give them the same name? Then Approximation only needs to accept "an object" that has these methods.

artofscience commented 2 years ago

Short discussion with Arnoud gave some conclusions; what we could do is something like:

subprob1 = Subproblem(Taylor1(Reciprocal())) subprob2 = Subproblem(Taylor2())

while not converged:

  f = problem.g(x)
  df = problem.dg(x)
  subproblem1.build(x,f,df)

  ddf = subproblem1.ddg(x)
  subproblem2.build(x,f,df,ddf)

  x = solver(subproblem2)