A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://accord-framework.net/docs/html/T_Accord_Math_Optimization_LinearConstraint.htm below:

LinearConstraint Class

Constraint with only linear terms.

Inheritance Hierarchy

SystemObject
  Accord.Math.OptimizationLinearConstraint

Namespace:  Accord.Math.Optimization
Assembly:

Accord.Math (in Accord.Math.dll) Version: 3.8.0

Syntax

The LinearConstraint type exposes the following members.

Constructors Properties   Name Description CombinedAs

Gets the scalar coefficients combining the

variables

specified by the constraints.

NumberOfVariables

Gets the number of variables in the constraint.

ShouldBe

Gets the type of the constraint.

Tolerance

Gets the violation tolerance for the constraint. Equality constraints should set this to a small positive value.

Value

Gets the value to be compared to the combined values of the variables.

VariablesAtIndices

Gets the index of the variables (in respective to the objective function) of the variables participating in this constraint.

Top Methods   Name Description Equals

Determines whether the specified object is equal to the current object.

(Inherited from Object.) Finalize

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

(Inherited from Object.) Function

Calculates the left hand side of the constraint equation given a vector x.

GetHashCode

Serves as the default hash function.

(Inherited from Object.) GetType

Gets the Type of the current instance.

(Inherited from Object.) Gradient

Calculates the gradient of the constraint.

MemberwiseClone

Creates a shallow copy of the current Object.

(Inherited from Object.) ToString

Returns a string that represents the current object.

(Inherited from Object.) TryParse(String, IObjectiveFunction, LinearConstraint)

Attempts to create a LinearConstraint from a String representation.

TryParse(String, CultureInfo, IObjectiveFunction, LinearConstraint)

Attempts to create a LinearConstraint from a String representation.

Top Fields Extension Methods   Name Description GetViolation

Gets how much the constraint is being violated.

(Defined by ConstraintExtensions.) HasMethod

Checks whether an object implements a method with the given name.

(Defined by ExtensionMethods.) IsEqual

Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.

(Defined by Matrix.) IsViolated

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

(Defined by ConstraintExtensions.) To(Type) Overloaded.

Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.

(Defined by ExtensionMethods.) ToT Overloaded.

Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.

(Defined by ExtensionMethods.) Top Examples

Linear constraints are commonly used in optimisation routines. The framework provides support for linear constraints to be specified using a String representation, an Expression or using a vector of constraint values.

var f = new QuadraticObjectiveFunction("2x² + 4y² - 2xy + 6");


var lc1 = new LinearConstraint(f, "3*x + 5*y <= 7");

double x = 0, y = 0; 
var lc2 = new LinearConstraint(f, () => 3*x + 5*y <= 7);

var lc3 = new LinearConstraint(numberOfVariables: 2)
{
    CombinedAs = new double[] { 3, 5 },
    ShouldBe = ConstraintType.LesserThanOrEqualTo,
    Value = 7
};



double[] vector = { -2, 3 };

if (lc1.IsViolated(vector))
{
    
}

double violation = lc2.GetViolation(vector); 
See Also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4