artofscience / SAOR

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

Should SphericalTaylor2 inherit from Taylor1? #86

Closed MaxvdKolk closed 2 years ago

MaxvdKolk commented 2 years ago

Browsing through the code, I noticed the following here

The SphericalTaylor2 class is defined as class SphericalTaylor2(Taylor2) but only seems to use Taylor1.update(self, x, f, df, ddf) and nothing from super() (i.e. Taylor2).

Does it make sense to inherit from Taylor1 instead and use super().update in the reference line?

A similar remark holds for NonSphericalTaylor2

artofscience commented 2 years ago

@MaxvdKolk the NonSphericalTaylor2 and SphericalTaylor2 use the ddgddy property, which is an attribute of Taylor2.

I think @Giannis1993 can best respond to this.

Giannis1993 commented 2 years ago

Indeed, @artofscience is correct. Both SphericalTaylor2 and NonSphericalTaylor2 inherit as much code as possible from Taylor2, but can only inherit the update method from Taylor1 becuz they compute ddgddy differently.