Constraint with only linear terms.
Inheritance HierarchySystemObject
Accord.Math.OptimizationLinearConstraint
Accord.Math (in Accord.Math.dll) Version: 3.8.0
SyntaxThe LinearConstraint type exposes the following members.
Constructors Properties Name Description CombinedAsGets the scalar coefficients combining the
variablesspecified by the constraints.
NumberOfVariablesGets the number of variables in the constraint.
ShouldBeGets the type of the constraint.
ToleranceGets the violation tolerance for the constraint. Equality constraints should set this to a small positive value.
ValueGets the value to be compared to the combined values of the variables.
VariablesAtIndicesGets the index of the variables (in respective to the objective function) of the variables participating in this constraint.
Top Methods Name Description EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object.) FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.) FunctionCalculates the left hand side of the constraint equation given a vector x.
GetHashCodeServes as the default hash function.
(Inherited from Object.) GetTypeGets the Type of the current instance.
(Inherited from Object.) GradientCalculates the gradient of the constraint.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object.) ToStringReturns 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 GetViolationGets how much the constraint is being violated.
(Defined by ConstraintExtensions.) HasMethodChecks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) IsEqualCompares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.) IsViolatedGets 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 ExamplesLinear 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