Show / Hide Table of Contents

    Class VariableCollection<T, T2>

    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
    System.Object
    GenericVariableCollectionBase<VariableCollection<T, T2>>
    VariableCollection<T, T2>
    Inherited Members
    GenericVariableCollectionBase<VariableCollection<T, T2>>._internalVariableCollection
    GenericVariableCollectionBase<VariableCollection<T, T2>>.GetVariableFromGenericIndex(GenericVariableCollectionIndexBase)
    GenericVariableCollectionBase<VariableCollection<T, T2>>.CheckIfVariableForIndexExists(GenericVariableCollectionIndexBase)
    GenericVariableCollectionBase<VariableCollection<T, T2>>.ExistingIndices
    GenericVariableCollectionBase<VariableCollection<T, T2>>.IndexValidationStyle
    GenericVariableCollectionBase<VariableCollection<T, T2>>.Name
    GenericVariableCollectionBase<VariableCollection<T, T2>>.VariableTypeGenerator
    GenericVariableCollectionBase<VariableCollection<T, T2>>.ValidIndices
    GenericVariableCollectionBase<VariableCollection<T, T2>>.Variables
    GenericVariableCollectionBase<VariableCollection<T, T2>>.IVariableCollection.IsVariableForIndexInstanciated(Object[])
    GenericVariableCollectionBase<VariableCollection<T, T2>>.GetLongNameFromIndex(Object[])
    GenericVariableCollectionBase<VariableCollection<T, T2>>.SetVariableValues(IDictionary<String, Double>)
    GenericVariableCollectionBase<VariableCollection<T, T2>>.CreateCopyFromClonedModel(Model)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: OPTANO.Modeling.Optimization
    Assembly: Optimization.dll
    Syntax
    public class VariableCollection<T, T2> : GenericVariableCollectionBase<VariableCollection<T, T2>>, IInternalVariableCollection, IVariableCollection
    Type Parameters
    Name Description
    T

    Element type for the 1st index set.

    T2

    Element type for the 2nd index set.

    Constructors

    VariableCollection(Model, IEnumerable<T>, IEnumerable<T2>, String, Func<T, T2, String>, Func<T, T2, Double>, Func<T, T2, Double>, Func<T, T2, VariableType>, Func<T, T2, Nullable<Int32>>, Func<T, T2, BranchingDirection>)

    Initializes a new instance of the VariableCollection<T, T2> class. Initializes a new instance of the VariableCollection<T, T2> class.

    Declaration
    public VariableCollection(Model model, IEnumerable<T> indexSet1, IEnumerable<T2> indexSet2, string name = "", Func<T, T2, string> debugNameGenerator = null, Func<T, T2, double> lowerBoundGenerator = null, Func<T, T2, double> upperBoundGenerator = null, Func<T, T2, VariableType> variableTypeGenerator = null, Func<T, T2, int? > branchingPriorityGenerator = null, Func<T, T2, BranchingDirection> branchingDirectionGenerator = null)
    Parameters
    Type Name Description
    Model model

    The Model this VariableCollection<T, T2> belongs to. A VariableCollection<T, T2> needs to belong to exactly one Model.

    System.Collections.Generic.IEnumerable<T> indexSet1

    The index set with elements of type T

    System.Collections.Generic.IEnumerable<T2> indexSet2

    The index set with elements of type T2

    System.String name

    The name for this variable collection. It must be unique among all VariableCollections that are used in the given model. If name equals System.String.IsNullOrWhiteSpace(System.String), a base64 index will be generated automatically.

    System.Func<T, T2, System.String> debugNameGenerator

    A function that takes an index for the VariableCollection<T, T2> and produces a System.String as output. The generator will be used when NameHandling is set to UniqueLongNames. The System.String that is produced by the delegate will be prepended to the unique variable name. The objective is to make the generated Model more readable, especially when trying to fix bugs. By default, the NameHandling is set to UniqueShortNames in order to reduce the amount of RAM required to store variable names.

    System.Func<T, T2, System.Double> lowerBoundGenerator

    A function that takes an index for the VariableCollection<T, T2> and defines a lower bound for the respective Variable. If the generator is null, 0 will be used as default lower bound for every variable.

    System.Func<T, T2, System.Double> upperBoundGenerator

    A function that takes an index for the VariableCollection<T, T2> and defines an upper bound for the respective Variable. If the generator is null, double.PositiveInfinity will be used as default upper bound for every non-binary variable. For Binary variables, 1 will be used as upper bound.

    System.Func<T, T2, VariableType> variableTypeGenerator

    A function that takes an index for the VariableCollection<T, T2> and defines a VariableType for the respective Variable. For all Binary variables, the bounds need to be in the range of [0, 1].

    System.Func<T, T2, System.Nullable<System.Int32>> branchingPriorityGenerator

    A function that takes an element from each index set and returns the branching priority as integer (or null, if default priority shall be used).

    System.Func<T, T2, BranchingDirection> branchingDirectionGenerator

    A function that takes an element from each index set and returns the branching priority as integer (or null, if default priority shall be used).

    Properties

    ExistingIndicesGeneric

    Returns all existing indices as generically typed index object.

    Declaration
    public IEnumerable<GenericVariableCollectionIndex<T, T2>> ExistingIndicesGeneric { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<GenericVariableCollectionIndex<T, T2>>

    Item[T, T2]

    Gets the Variable with the specified index.

    Declaration
    public Variable this[T element1, T2 element2] { get; }
    Parameters
    Type Name Description
    T element1

    Element of the index 1st index set.

    T2 element2

    Element of the index 2nd index set.

    Property Value
    Type Description
    Variable

    The variable for the given index

    Item[GenericVariableCollectionIndex<T, T2>]

    Gets the Variable with the specified index.

    Declaration
    public Variable this[GenericVariableCollectionIndex<T, T2> index] { get; }
    Parameters
    Type Name Description
    GenericVariableCollectionIndex<T, T2> index

    All index elements combined in a single tuple.

    Property Value
    Type Description
    Variable

    Methods

    CreateTypedInstance(VariableCollection)

    Declaration
    protected override VariableCollection<T, T2> CreateTypedInstance(VariableCollection internalCollection)
    Parameters
    Type Name Description
    VariableCollection internalCollection
    Returns
    Type Description
    VariableCollection<T, T2>
    Overrides
    OPTANO.Modeling.Optimization.GenericVariableCollectionBase<OPTANO.Modeling.Optimization.VariableCollection<T, T2>>.CreateTypedInstance(OPTANO.Modeling.Optimization.VariableCollection)

    IsVariableForIndexInstanciated(GenericVariableCollectionIndex<T, T2>)

    Checks if a variable was created for the given index.

    Declaration
    public bool IsVariableForIndexInstanciated(GenericVariableCollectionIndex<T, T2> genericIndex)
    Parameters
    Type Name Description
    GenericVariableCollectionIndex<T, T2> genericIndex

    The index.

    Returns
    Type Description
    System.Boolean

    True, if a variable was created.

    Extension Methods

    ReflectionHelper.GetFieldValue(Object, String)
    ReflectionHelper.SetFieldValue(Object, String, Object)
    ExtensionMethods.Clone<T>(T)
    ExtensionMethods.ThrowIfArgumentIsNull<T>(T, String)
    Back to top Copyright © OPTANO GmbH generated with DocFX
    Privacy Policy | Impressum – Legal Notice