Class VariableCollection<T>
This is a strongly typed helper class that allows you to model your Variables more intuitively
It groups variable with the same meaning.
In a mathematical model a VariableCollection is represented by a single symbol (like x); a variable by a symbol with indices (like x_{i,j}).
Some (optional) generators are used to calculate parameters for each of the VariableCollection's variable:
DebugNameGenerator
LowerBoundGenerator
UpperBoundGenerator
VariableTypeGenerator
BranchingPriorityGenerator
Inheritance
Inherited Members
Namespace: OPTANO.Modeling.Optimization
Assembly: Optimization.dll
Syntax
[Serializable]
public class VariableCollection<T> : GenericVariableCollectionBase<VariableCollection<T>>, IInternalVariableCollection, IVariableCollection
Type Parameters
| Name | Description |
|---|---|
| T | Element type for the 1st index set. |
Constructors
VariableCollection(Model, IEnumerable<T>, String, Func<T, String>, Func<T, Double>, Func<T, Double>, Func<T, VariableType>, Func<T, Nullable<Int32>>, Func<T, BranchingDirection>)
Initializes a new instance of the VariableCollection<T> class.
Declaration
public VariableCollection(Model model, IEnumerable<T> indexSet1, string name = "", Func<T, string> debugNameGenerator = null, Func<T, double> lowerBoundGenerator = null, Func<T, double> upperBoundGenerator = null, Func<T, VariableType> variableTypeGenerator = null, Func<T, int? > branchingPriorityGenerator = null, Func<T, BranchingDirection> branchingDirectionGenerator = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Model | model | The Model this VariableCollection<T> belongs to. A VariableCollection<T> needs to belong to exactly one Model. |
| System.Collections.Generic.IEnumerable<T> | indexSet1 | The index set with elements of type |
| System.String | name | The name for this variable collection.
It must be |
| System.Func<T, System.String> | debugNameGenerator | A function that takes an |
| System.Func<T, System.Double> | lowerBoundGenerator | A function that takes an |
| System.Func<T, System.Double> | upperBoundGenerator | A function that takes an |
| System.Func<T, VariableType> | variableTypeGenerator | A function that takes an |
| System.Func<T, System.Nullable<System.Int32>> | branchingPriorityGenerator | A function that takes an element from each index set and returns the branching priority as integer (or |
| System.Func<T, BranchingDirection> | branchingDirectionGenerator | A function that takes an element from each index set and returns the branching priority as integer (or |
Properties
ExistingIndicesGeneric
Returns all existing indices as generically typed index object.
Declaration
public IEnumerable<GenericVariableCollectionIndex<T>> ExistingIndicesGeneric { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<GenericVariableCollectionIndex<T>> |
Item[T]
Gets the Variable with the specified index.
Declaration
public Variable this[T element1] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| T | element1 | Element of the index |
Property Value
| Type | Description |
|---|---|
| Variable | The variable for the given |
Item[GenericVariableCollectionIndex<T>]
Gets the Variable with the specified index.
Declaration
public Variable this[GenericVariableCollectionIndex<T> index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| GenericVariableCollectionIndex<T> | index | All index elements combined in a single tuple. |
Property Value
| Type | Description |
|---|---|
| Variable |
Methods
CreateTypedInstance(VariableCollection)
Declaration
protected override VariableCollection<T> CreateTypedInstance(VariableCollection internalCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| VariableCollection | internalCollection |
Returns
| Type | Description |
|---|---|
| VariableCollection<T> |
Overrides
IsVariableForIndexInstanciated(GenericVariableCollectionIndex<T>)
Checks if a variable was created for the given index.
Declaration
public bool IsVariableForIndexInstanciated(GenericVariableCollectionIndex<T> genericIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| GenericVariableCollectionIndex<T> | genericIndex | The index. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if a variable was created. |