Skip to content

Report invalid Jacobian values at the starting parameters #593

@timmens

Description

@timmens
  • optimagic version used, if any: 0.5.2

What would you like to enhance and why? Is it related to an issue/problem?

If the Jacobian value is invalid (infinite or NaN) at the starting parameters, an error should be thrown. Currently, no error is thrown, and the optimization simply fails.

MRE

import numpy as np

import optimagic as om
from optimagic.optimization.optimize import minimize


def fun(x):
    return np.sum(x ** 2)

def jac(x):
    return np.full_like(x, np.nan)

# the following runs without error
minimize(
    fun,
    np.arange(2),
    jac=jac,
    algorithm=om.algos.scipy_lbfgsb,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions