Class GenericVariableCollectionBase<TGenericCollection>
The base class for all generic VariableCollection classes
Inheritance
Inherited Members
Namespace: OPTANO.Modeling.Optimization
Assembly: Optimization.dll
Syntax
[Serializable]
public abstract class GenericVariableCollectionBase<TGenericCollection> : IInternalVariableCollection, IVariableCollection where TGenericCollection : GenericVariableCollectionBase<TGenericCollection>
Type Parameters
Name | Description |
---|---|
TGenericCollection |
Constructors
GenericVariableCollectionBase()
Empty default constructor. Does nothing.
Declaration
protected GenericVariableCollectionBase()
Fields
_internalVariableCollection
Variable Collection that is used internally.
Declaration
protected VariableCollection _internalVariableCollection
Field Value
Type | Description |
---|---|
VariableCollection |
Properties
ExistingIndices
Gets the existing indices.
Declaration
public IEnumerable<object[]> ExistingIndices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object[]> | The System.Collections.IEnumerable with all already known indices.
I.e. all indices that have already been used to access this |
Implements
IndexValidationStyle
Changes the behavior of a true
the index
belongs to the sets the
Declaration
public IndexValidationStyle IndexValidationStyle { get; set; }
Property Value
Type | Description |
---|---|
IndexValidationStyle |
Implements
Name
Gets the name of the
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Implements
ValidIndices
Gets an System.Collections.IEnumerable that iterates over all valid index combinations for this
Declaration
public IEnumerable<object[]> ValidIndices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object[]> | The valid indices. |
Implements
Variables
Gets an System.Collections.IEnumerable that contains all existing
Variables in this index
.
Declaration
public IEnumerable<Variable> Variables { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Variable> | The variables. |
Implements
VariableTypeGenerator
Gets a generator delegate that takes an index as input and returns the VariableType for the respective Variable.
Declaration
public VariableCollection.VariableTypeGeneratorDelegate VariableTypeGenerator { get; }
Property Value
Type | Description |
---|---|
VariableCollection.VariableTypeGeneratorDelegate |
Implements
Methods
CheckIfVariableForIndexExists(GenericVariableCollectionIndexBase)
Declaration
protected bool CheckIfVariableForIndexExists(GenericVariableCollectionIndexBase genericIndex)
Parameters
Type | Name | Description |
---|---|---|
GenericVariableCollectionIndexBase | genericIndex |
Returns
Type | Description |
---|---|
System.Boolean |
CreateCopyFromClonedModel(Model)
After calling DeepClone() on the originalModel, you can use this method to
get a correctly typed clone of this GenericVariableCollectionBase<TGenericCollection>,
that can be used to access/modify the cloned variables in the clonedModel
.
Declaration
public TGenericCollection CreateCopyFromClonedModel(Model clonedModel)
Parameters
Type | Name | Description |
---|---|---|
Model | clonedModel | The cloned version of the original model that you created by calling DeepClone(). Important: "This" variable collection needs to be associated to the "original model", otherwise the created copy will not work as intended. |
Returns
Type | Description |
---|---|
TGenericCollection | A generically typed variable collection that manages the cloned versions of variables that belong to "this" collection. |
CreateTypedInstance(VariableCollection)
Method instanciates a new TGenericCollection
,
that uses the given internalCollection
as its _internalVariableCollection.
Declaration
protected abstract TGenericCollection CreateTypedInstance(VariableCollection internalCollection)
Parameters
Type | Name | Description |
---|---|---|
VariableCollection | internalCollection | The internal variable collection to use. |
Returns
Type | Description |
---|---|
TGenericCollection | A new instance of |
GetLongNameFromIndex(Object[])
If the model uses short names, the long name is generated from the given index
.
Else, the name of the variable for the given index
is returned.
Declaration
public string GetLongNameFromIndex(object[] index)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | index | The index. If the variable for the index has not been created yet, an exception will be thrown. |
Returns
Type | Description |
---|---|
System.String | The System.String. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown, if the |
GetVariableFromGenericIndex(GenericVariableCollectionIndexBase)
Declaration
protected Variable GetVariableFromGenericIndex(GenericVariableCollectionIndexBase genericIndex)
Parameters
Type | Name | Description |
---|---|---|
GenericVariableCollectionIndexBase | genericIndex |
Returns
Type | Description |
---|---|
Variable |
SetVariableValues(IDictionary<String, Double>)
Sets the value property for each variable in this values
. The matching happens by string comparison of the name of the variable.
Declaration
public void SetVariableValues(IDictionary<string, double> values)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Double> | values | The values for the variables (e.g. coming from a solution) |
Implements
Explicit Interface Implementations
IVariableCollection.IsVariableForIndexInstanciated(Object[])
Checks if a variable was created for the given index.
Declaration
bool IVariableCollection.IsVariableForIndexInstanciated(params object[] index)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean | True, if a variable was created. |