C# Класс 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

Наследование: NonlinearObjectiveFunction, IObjectiveFunction
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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>

Описание методов

QuadraticObjectiveFunction() публичный метод

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.
Результат System

QuadraticObjectiveFunction() публичный метод

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 .
Результат System

QuadraticObjectiveFunction() публичный метод

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".
Результат System

QuadraticObjectiveFunction() публичный метод

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.
Результат System

ToString() публичный метод

Returns a System.String that represents this instance.
public ToString ( ) : string
Результат string

TryParse() публичный статический метод

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.
Результат bool

TryParse() публичный статический метод

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.
Результат bool