CardiacModelling / BenNevis

"Where is Ben Nevis" presents the landscape of Great Britain as a testbed for optimisation and sampling methods.
Other
2 stars 1 forks source link

Add optional gradients to linear interpolant #27

Closed MichaelClerx closed 2 years ago

MichaelClerx commented 2 years ago

Easy addition to linear interpolant. Will be discontinuous at nodes. Can just pick positive direction for both (2 point deriv, not averaged from current & last line segment!)

EricWay1024 commented 2 years ago

I'm considering doing this before making a NLopt example, so that the example can make use of gradients. Looking into the code for linear_interpolant, I wonder

EricWay1024 commented 2 years ago

if we can calculate using grad_x = (h21 - h11) / self._resolution and grad_x = (h12 - h11) / self._resolution?

Seems that this calculation method is fine after testing it with a gradient-based method in NLopt.

MichaelClerx commented 2 years ago

Closed in #68