C# Class Accord.Math.Optimization.NonlinearConstraint

Constraint with only linear terms.
Show file Open project: accord-net/framework

Public Methods

Method Description
GetViolation ( double input ) : double

Gets how much the constraint is being violated.

IsViolated ( double input ) : bool

Gets whether this constraint is being violated (within the current tolerance threshold).

NonlinearConstraint ( IObjectiveFunction objective, Expression function, ConstraintType shouldBe, double value, Expression gradient = null, double withinTolerance = DEFAULT_TOL ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( IObjectiveFunction objective, bool>.Expression constraint ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( IObjectiveFunction objective, double>.Func function ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, ConstraintType shouldBe, double value ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient, double withinTolerance = DEFAULT_TOL ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, double[]>.Func gradient ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( int numberOfVariables, bool>.Expression constraint ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( int numberOfVariables, double>.Func function ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( int numberOfVariables, double>.Func function, ConstraintType shouldBe, double value ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( int numberOfVariables, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient, double withinTolerance = DEFAULT_TOL ) : System

Constructs a new nonlinear constraint.

NonlinearConstraint ( int numberOfVariables, double>.Func function, double[]>.Func gradient, ConstraintType shouldBe = ConstraintType.GreaterThanOrEqualTo, double value, double withinTolerance = DEFAULT_TOL ) : System

Constructs a new nonlinear constraint.

ToString ( ) : string

Returns a System.String that represents this instance.

ToString ( string format, IFormatProvider formatProvider ) : string

Returns a System.String that represents this instance.

Protected Methods

Method Description
Create ( int numberOfVariables, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient, double tolerance ) : void

Creates a nonlinear constraint.

NonlinearConstraint ( ) : System

Creates an empty nonlinear constraint.

Private Methods

Method Description
parse ( bool>.Expression constraint, double>.Func &function, ConstraintType &shouldBe, double &value ) : void

Method Details

Create() protected method

Creates a nonlinear constraint.
protected Create ( int numberOfVariables, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient, double tolerance ) : void
numberOfVariables int
function double>.Func
shouldBe ConstraintType
value double
gradient double[]>.Func
tolerance double
return void

GetViolation() public method

Gets how much the constraint is being violated.
public GetViolation ( double input ) : double
input double The function point.
return double

IsViolated() public method

Gets whether this constraint is being violated (within the current tolerance threshold).
public IsViolated ( double input ) : bool
input double The function point.
return bool

NonlinearConstraint() protected method

Creates an empty nonlinear constraint.
protected NonlinearConstraint ( ) : System
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( IObjectiveFunction objective, Expression function, ConstraintType shouldBe, double value, Expression gradient = null, double withinTolerance = DEFAULT_TOL ) : System
objective IObjectiveFunction The objective function to which this constraint refers.
function Expression A lambda expression defining the left hand side of the constraint equation.
shouldBe ConstraintType How the left hand side of the constraint /// should be compared to the given .
value double The right hand side of the constraint equation.
gradient Expression A lambda expression defining the gradient of the /// left hand side of the constraint equation.
withinTolerance double The tolerance for violations of the constraint. Equality /// constraints should set this to a small positive value. Default is 1e-8.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( IObjectiveFunction objective, bool>.Expression constraint ) : System
objective IObjectiveFunction The objective function to which this constraint refers.
constraint bool>.Expression A boolean lambda expression expressing the constraint. Please /// see examples for details.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( IObjectiveFunction objective, double>.Func function ) : System
objective IObjectiveFunction The objective function to which this constraint refers.
function double>.Func A lambda expression defining the left hand side of the constraint.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, ConstraintType shouldBe, double value ) : System
objective IObjectiveFunction The objective function to which this constraint refers.
function double>.Func A lambda expression defining the left hand side of the /// constraint equation.
shouldBe ConstraintType How the left hand side of the constraint should be /// compared to the given .
value double The right hand side of the constraint equation. Default is 0.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient ) : System
objective IObjectiveFunction The objective function to which this constraint refers.
function double>.Func A lambda expression defining the left hand side of the /// constraint equation.
shouldBe ConstraintType How the left hand side of the constraint should be /// compared to the given .
value double The right hand side of the constraint equation. Default is 0.
gradient double[]>.Func A lambda expression defining the gradient of the /// left hand side of the constraint equation.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient, double withinTolerance = DEFAULT_TOL ) : System
objective IObjectiveFunction The objective function to which this constraint refers.
function double>.Func A lambda expression defining the left hand side of the constraint equation.
shouldBe ConstraintType How the left hand side of the constraint should be compared to the given .
value double The right hand side of the constraint equation. Default is 0.
gradient double[]>.Func A lambda expression defining the gradient of the /// left hand side of the constraint equation.
withinTolerance double The tolerance for violations of the constraint. Equality /// constraints should set this to a small positive value. Default is 1e-8.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( IObjectiveFunction objective, double>.Func function, double[]>.Func gradient ) : System
objective IObjectiveFunction The objective function to which this constraint refers.
function double>.Func A lambda expression defining the left hand side of the /// constraint equation.
gradient double[]>.Func A lambda expression defining the gradient of the /// left hand side of the constraint equation..
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( int numberOfVariables, bool>.Expression constraint ) : System
numberOfVariables int The number of variables in the constraint.
constraint bool>.Expression A boolean lambda expression expressing the constraint. Please /// see examples for details.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( int numberOfVariables, double>.Func function ) : System
numberOfVariables int The number of variables in the constraint.
function double>.Func A lambda expression defining the left hand side of the /// constraint equation.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( int numberOfVariables, double>.Func function, ConstraintType shouldBe, double value ) : System
numberOfVariables int The number of variables in the constraint.
function double>.Func A lambda expression defining the left hand side of the constraint equation.
shouldBe ConstraintType How the left hand side of the constraint should be compared to /// the given . Default is .
value double The right hand side of the constraint equation. Default is 0.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( int numberOfVariables, double>.Func function, ConstraintType shouldBe, double value, double[]>.Func gradient, double withinTolerance = DEFAULT_TOL ) : System
numberOfVariables int The number of variables in the constraint.
function double>.Func A lambda expression defining the left hand side of the constraint equation.
shouldBe ConstraintType How the left hand side of the constraint should be compared to the given .
value double The right hand side of the constraint equation. Default is 0.
gradient double[]>.Func A lambda expression defining the gradient of the /// left hand side of the constraint equation.
withinTolerance double The tolerance for violations of the constraint. Equality /// constraints should set this to a small positive value. Default is 1e-8.
return System

NonlinearConstraint() public method

Constructs a new nonlinear constraint.
public NonlinearConstraint ( int numberOfVariables, double>.Func function, double[]>.Func gradient, ConstraintType shouldBe = ConstraintType.GreaterThanOrEqualTo, double value, double withinTolerance = DEFAULT_TOL ) : System
numberOfVariables int The number of variables in the constraint.
function double>.Func A lambda expression defining the left hand side of the /// constraint equation.
gradient double[]>.Func A lambda expression defining the gradient of the /// left hand side of the constraint equation.
shouldBe ConstraintType How the left hand side of the constraint should be /// compared to the given .
value double The right hand side of the constraint equation. Default is 0.
withinTolerance double The tolerance for violations of the constraint. Equality /// constraints should set this to a small positive value. Default is 1e-8.
return System

ToString() public method

Returns a System.String that represents this instance.
public ToString ( ) : string
return string

ToString() public method

Returns a System.String that represents this instance.
public ToString ( string format, IFormatProvider formatProvider ) : string
format string The format.
formatProvider IFormatProvider The format provider.
return string