Class Term
A term represents a variable and a coefficient which belongs to this variable (e.g. 2*x
).
Note that Terms are immutable.
Inherited Members
Namespace: OPTANO.Modeling.Optimization
Assembly: Optimization.dll
Syntax
[DataContract]
[Serializable]
public class Term : Expression
Constructors
Term(Variable, Double)
Initializes a new instance of the Term class.
Declaration
public Term(Variable variable, double factor = 1)
Parameters
Type | Name | Description |
---|---|---|
Variable | variable | The variable. |
System.Double | factor | The constant. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Properties
ContainsAtMostOneVariable
Declaration
public override bool ContainsAtMostOneVariable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
ContainsNoVariables
Declaration
public override bool ContainsNoVariables { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Factor
Gets the factor.
Declaration
public double Factor { get; }
Property Value
Type | Description |
---|---|
System.Double |
IsLinear
Gets or sets a value indicating whether this instance is linear.
Declaration
public override bool IsLinear { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Overrides
Terms
Gets the terms.
Declaration
public override IEnumerable<Term> Terms { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Term> |
Overrides
Variable
Gets the variable.
Declaration
public Variable Variable { get; }
Property Value
Type | Description |
---|---|
Variable |
Variables
Gets the variables.
Declaration
public override IEnumerable<Variable> Variables { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Variable> |
Overrides
Methods
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
Operators
Addition(Term, Term)
Implements the operator +.
Declaration
public static Expression operator +(Term term, Term term2)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The first term. |
Term | term2 | The second term. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Addition(Term, Variable)
Implements the operator +.
Declaration
public static Expression operator +(Term term, Variable variable)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
Variable | variable | The variable. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Addition(Term, Double)
Implements the operator +.
Declaration
public static Expression operator +(Term term, double constant)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
System.Double | constant | The constant. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Addition(Variable, Term)
Implements the operator +.
Declaration
public static Expression operator +(Variable variable, Term term)
Parameters
Type | Name | Description |
---|---|---|
Variable | variable | The variable. |
Term | term | The term. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Addition(Double, Term)
Implements the operator +.
Declaration
public static Expression operator +(double constant, Term term)
Parameters
Type | Name | Description |
---|---|---|
System.Double | constant | The constant. |
Term | term | The term. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Implicit(Variable to Term)
Declaration
public static implicit operator Term(Variable variable)
Parameters
Type | Name | Description |
---|---|---|
Variable | variable | The variable. |
Returns
Type | Description |
---|---|
Term | The result of the conversion. |
Multiply(Term, Term)
Implements the operator *.
Declaration
public static Expression operator *(Term term, Term term2)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
Term | term2 | The term2. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Multiply(Term, Variable)
Implements the operator *.
Declaration
public static Expression operator *(Term term, Variable variable)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
Variable | variable | The variable. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Multiply(Term, Double)
Implements the operator *.
Declaration
public static Term operator *(Term term, double factor)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
System.Double | factor | The factor. |
Returns
Type | Description |
---|---|
Term | The result of the operator. |
Multiply(Variable, Term)
Implements the operator *.
Declaration
public static Expression operator *(Variable variable, Term term)
Parameters
Type | Name | Description |
---|---|---|
Variable | variable | The variable. |
Term | term | The term. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Multiply(Double, Term)
Implements the operator *.
Declaration
public static Term operator *(double factor, Term term)
Parameters
Type | Name | Description |
---|---|---|
System.Double | factor | The factor. |
Term | term | The term. |
Returns
Type | Description |
---|---|
Term | The result of the operator. |
Subtraction(Term, Term)
Implements the operator -.
Declaration
public static Expression operator -(Term term, Term term2)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
Term | term2 | The term2. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Subtraction(Term, Variable)
Implements the operator -.
Declaration
public static Expression operator -(Term term, Variable variable)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
Variable | variable | The variable. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Subtraction(Term, Double)
Implements the operator -.
Declaration
public static Expression operator -(Term term, double constant)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
System.Double | constant | The constant. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Subtraction(Variable, Term)
Implements the operator -.
Declaration
public static Expression operator -(Variable variable, Term term)
Parameters
Type | Name | Description |
---|---|---|
Variable | variable | The variable. |
Term | term | The term. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
Subtraction(Double, Term)
Implements the operator -.
Declaration
public static Expression operator -(double constant, Term term)
Parameters
Type | Name | Description |
---|---|---|
System.Double | constant | The constant. |
Term | term | The term. |
Returns
Type | Description |
---|---|
Expression | The result of the operator. |
UnaryNegation(Term)
Implements the operator -.
Declaration
public static Term operator -(Term term)
Parameters
Type | Name | Description |
---|---|---|
Term | term | The term. |
Returns
Type | Description |
---|---|
Term | The result of the operator. |