C# Class Accord.Math.Optimization.QuadraticObjectiveFunction

Quadratic objective function.

In mathematics, a quadratic function, a quadratic polynomial, a polynomial of degree 2, or simply a quadratic, is a polynomial function in one or more variables in which the highest-degree term is of the second degree. For example, a quadratic function in three variables x, y, and z contains exclusively terms x², y², z², xy, xz, yz, x, y, z, and a constant:

f(x,y,z) = ax² + by² +cz² + dxy + exz + fyz + gx + hy + iz + j

Please note that the function's constructor expects the function expression to be given on this form. Scalar values must be located on the left of the variables, and no term should be duplicated in the quadratic expression. Please take a look on the examples section of this page for some examples of expected functions.

References: Wikipedia, The Free Encyclopedia. Quadratic Function. Available on: https://en.wikipedia.org/wiki/Quadratic_function

Inheritance: NonlinearObjectiveFunction, IObjectiveFunction
Show file Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
QuadraticObjectiveFunction ( Expression function ) : System

Creates a new objective function specified through a string.

QuadraticObjectiveFunction ( double quadraticTerms, double linearTerms ) : System

Creates a new objective function specified through a string.

QuadraticObjectiveFunction ( string function ) : System

Creates a new objective function specified through a string.

QuadraticObjectiveFunction ( string function, CultureInfo culture ) : System

Creates a new objective function specified through a string.

ToString ( ) : string

Returns a System.String that represents this instance.

TryParse ( string str, CultureInfo culture, QuadraticObjectiveFunction &function ) : bool

Attempts to create a QuadraticObjectiveFunction from a System.String representation.

TryParse ( string str, QuadraticObjectiveFunction &function ) : bool

Attempts to create a QuadraticObjectiveFunction from a System.String representation.

Private Methods

Method Description
addTuple ( string>.Dictionary terms, double v, string v1, string v2 ) : string>.Tuple
createLinearTermsVector ( ) : double[]
createQuadraticTermsMatrix ( ) : ].double[
function ( double input ) : double
gradient ( double input ) : double[]
initialize ( string>.Dictionary terms ) : void
parseExpression ( string>.Dictionary terms, Expression expr, double &scalar, bool dontAdd = false ) : string>.Tuple
parseString ( string f, CultureInfo culture ) : Dictionary,double>

Method Details

QuadraticObjectiveFunction() public method

Creates a new objective function specified through a string.
public QuadraticObjectiveFunction ( Expression function ) : System
function Expression A containing /// the function in the form of a lambda expression.
return System

QuadraticObjectiveFunction() public method

Creates a new objective function specified through a string.
public QuadraticObjectiveFunction ( double quadraticTerms, double linearTerms ) : System
quadraticTerms double A Hessian matrix of quadratic terms defining the quadratic objective function.
linearTerms double The vector of linear terms associated with .
return System

QuadraticObjectiveFunction() public method

Creates a new objective function specified through a string.
public QuadraticObjectiveFunction ( string function ) : System
function string A containing /// the function in the form similar to "ax²+b".
return System

QuadraticObjectiveFunction() public method

Creates a new objective function specified through a string.
public QuadraticObjectiveFunction ( string function, CultureInfo culture ) : System
function string A containing /// the function in the form similar to "ax²+b".
culture System.Globalization.CultureInfo The culture information specifying how /// numbers written in the should /// be parsed. Default is CultureInfo.InvariantCulture.
return System

ToString() public method

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

TryParse() public static method

Attempts to create a QuadraticObjectiveFunction from a System.String representation.
public static TryParse ( string str, CultureInfo culture, QuadraticObjectiveFunction &function ) : bool
str string The string containing the function in textual form.
culture System.Globalization.CultureInfo The culture information specifying how /// numbers written in the should /// be parsed. Default is CultureInfo.InvariantCulture.
function QuadraticObjectiveFunction The resulting function, if it could be parsed.
return bool

TryParse() public static method

Attempts to create a QuadraticObjectiveFunction from a System.String representation.
public static TryParse ( string str, QuadraticObjectiveFunction &function ) : bool
str string The string containing the function in textual form.
function QuadraticObjectiveFunction The resulting function, if it could be parsed.
return bool