Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

AugmentedLagrangian with NonlinearConstraints - Gradient NullReferenceException issue #177

@jamesbascle

Description

@jamesbascle

When using the AugmentedLagrangian solver, with a NonlinearObjectiveFunction, and a number of NonlinearConstraints in a List, if one or more of the constraints is constructed using the NonlinearConstraint(IObjectiveFunction objective, Expression<Func<double[], bool>> constraint) constructor, a NullReferenceException is thrown.

This is because the Gradient function of the constraint is null upon construction.

I see why this happens, but why is there not a constructor that looks like NonlinearConstraint(IObjectiveFunction objective, Expression<Func<double[], bool>> function, Func<double[], double[]> gradient) that allows the gradient to be defined along with the objective function and constraint function, rather than having to use the less clear public NonlinearConstraint(IObjectiveFunction objective, Func<double[], double> function, Func<double[], double[]> gradient) signature which specifies only the left hand side of the equation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions