Class ModelScope
Wraps configuration settings that are required during the execution of the OPTANO.Modeling library so that internal classes have access to the same model scope.
Inheritance
Inherited Members
Namespace: OPTANO.Modeling.Optimization
Assembly: Optimization.dll
Syntax
public sealed class ModelScope : IDisposable
Constructors
ModelScope(Configuration)
Initializes a new instance of the ModelScope class.
Declaration
public ModelScope(Configuration settings = null)
Parameters
Type | Name | Description |
---|---|---|
Configuration | settings | The setting to create the scope from.
E.g. |
Exceptions
Type | Condition |
---|---|
System.AccessViolationException | Exception is thrown if another ModelScope exists at the same time. |
Properties
AbsOperatorReplacement
Gets the Abs operator replacement.
The User
can define an override
for the AbsOperatorReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public AbsOperatorReplacement? AbsOperatorReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<AbsOperatorReplacement> |
BlockedShortNames
Gets all currently blocked short names. See also AddInvalidShortName(String, Boolean) and RemoveInvalidShortName(String, Boolean).
Declaration
public IEnumerable<string> BlockedShortNames { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
CeilOperatorReplacement
Gets the Ceil operator replacement.
The User
can define an override
for the CeilOperatorReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public CeilOperatorReplacement? CeilOperatorReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<CeilOperatorReplacement> |
ComputeRemovedVariables
Gets or sets a value indicating whether the set of removed variables should be computed by solvers that support this operation. Prior to the optimization of the model, an explicit presolve is executed in order to determine the set of variables that are removed by the solver during the preprocessing. Refer to the Model Feature section that is described in the OPTANO.Modeling User Documentation for further information.
Declaration
public bool ComputeRemovedVariables { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CopySolutionToModel
Gets or sets a value indicating whether the variable values of a feasible Solution should be set automatically in the respective Variables of a Model
Declaration
public bool CopySolutionToModel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Current
Gets the current ModelScope.
Declaration
public static ModelScope Current { get; }
Property Value
Type | Description |
---|---|
ModelScope |
DefaultIndexValidationStyle
Gets the index validation style that is used as default for new VariableCollections.
Declaration
public IndexValidationStyle DefaultIndexValidationStyle { get; }
Property Value
Type | Description |
---|---|
IndexValidationStyle |
DeterministicModelGeneration
Gets or sets a value indicating whether to generate the optimization model in a deterministic fashion.
Declaration
public bool DeterministicModelGeneration { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EPSILON
Gets the tolerance for float/double comparisons.
Example: Instead of a == b
, use System.Math.Abs(System.Double)(a - b) < EPSILON
.
Default value: 1e-6
.
Declaration
public double EPSILON { get; }
Property Value
Type | Description |
---|---|
System.Double |
FloorOperatorReplacement
Gets the Floor operator replacement.
The User
can define an override
for the FloorOperatorReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public FloorOperatorReplacement? FloorOperatorReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<FloorOperatorReplacement> |
ImplicationConstraintReplacement
Gets the User
can define an override
for the ImplicationConstraintReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public ImplicationConstraintReplacement? ImplicationConstraintReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<ImplicationConstraintReplacement> |
MaximumNameLength
Gets the maximum length for generated variable and constraint names.
null
: Unlimited.
Declaration
public int? MaximumNameLength { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
MaxOperatorReplacement
Gets the Max operator replacement.
The User
can define an override
for the MaxOperatorReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public MaxOperatorReplacement? MaxOperatorReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<MaxOperatorReplacement> |
MinOperatorReplacement
Gets the Min operator replacement.
The User
can define an override
for the MinOperatorReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public MinOperatorReplacement? MinOperatorReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<MinOperatorReplacement> |
ModelBehavior
Gets or sets the behavior of the model. Available options are Auto and Manual In automatic mode, the model takes care of adding variables when constraints and objectives get added. In manual mode you need to take care of this yourself.
Declaration
public ModelBehavior ModelBehavior { get; set; }
Property Value
Type | Description |
---|---|
ModelBehavior |
ModelBuildTime
Gets the model build time.
The model is fully transformed and passed to the solver. Value
is set by SolverBase.
I.e. the duration of the call to BuildSolverModelAdapterSpecific(Int32).
Note that this parameter will also be set/updated during Rebuilds
, where no actual work might be performed.
Declaration
public TimeSpan ModelBuildTime { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
ModelMemoryDelta
Gets the memory delta
in bytes that is allocated during the building of the model in the solver specific API.
The model is fully transformed and passed to the solver. Value
is set by SolverBase.
I.e. The increase of System.GC.GetTotalMemory(System.Boolean)(true)
during the call of BuildSolverModelAdapterSpecific(Int32).
Note that this parameter will also be set/updated during Rebuilds
, where no actual work might be performed.
Declaration
public long ModelMemoryDelta { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
NameHandling
Gets a value indicating whether the full names should be used for Variables and Constraints.
A full name consists of the evalueation of the VariableCollection.DebugNameGenerator for a given index, followed by a unique base64
index for each Variable.
Declaration
public NameHandlingStyle NameHandling { get; }
Property Value
Type | Description |
---|---|
NameHandlingStyle |
NativeMultiObjectiveSupport
Gets the method to override the multi objective support with.
The User
can define an override
for the OrConstraintReplacement. If the value
is less demanding (e.g. Unsupported for a SolverBase that offers a native support), the specified method is used in the Solve(Model, Dictionary<Variable, Double>) call.
Declaration
public NativeMultiObjectiveSupport? NativeMultiObjectiveSupport { get; }
Property Value
Type | Description |
---|---|
System.Nullable<NativeMultiObjectiveSupport> |
NormalizingBehavior
Gets or sets the behavior of the normalizing submodule. Available options are Auto and Manual In automatic mode, the model takes care of normalizing all constraints and objects. In manual mode you need to take care of this yourself.
Declaration
public NormalizingBehavior NormalizingBehavior { get; set; }
Property Value
Type | Description |
---|---|
NormalizingBehavior |
NotConstraintReplacement
Gets the Not constraint replacement.
The User
can define an override
for the NotConstraintReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public NotConstraintReplacement? NotConstraintReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<NotConstraintReplacement> |
OrConstraintReplacement
Gets the Or constraint replacement.
The User
can define an override
for the OrConstraintReplacement. If the value
differs from DoNotReplace, the specified method is used in the ModelTransformation.
Declaration
public OrConstraintReplacement? OrConstraintReplacement { get; }
Property Value
Type | Description |
---|---|
System.Nullable<OrConstraintReplacement> |
RestoreUserModelAfterSolve
Gets a value indicating whether the user model after solve. This means that all steps that were performed in the ModelTransformation process are reversed. E.g., all helper variables and constraints will be remvoed from the model.
Declaration
public bool RestoreUserModelAfterSolve { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Sos1HandlingOverride
Gets the S1 handling method.
If the User
specifies a SOSHandling other than Native, that method
will be used during the transformation that is performed by ModelTransformation.
Declaration
public SOSHandling? Sos1HandlingOverride { get; }
Property Value
Type | Description |
---|---|
System.Nullable<SOSHandling> |
Sos2HandlingOverride
Gets the S2 handling method.
If the User
specifies a SOSHandling other than Native, that method
will be used during the transformation that is performed by ModelTransformation.
Declaration
public SOSHandling? Sos2HandlingOverride { get; }
Property Value
Type | Description |
---|---|
System.Nullable<SOSHandling> |
Sos3HandlingOverride
Gets the S3 handling method.
If the User
specifies a SOSHandling other than Native, that method
will be used during the transformation that is performed by ModelTransformation.
Declaration
public SOSHandling? Sos3HandlingOverride { get; }
Property Value
Type | Description |
---|---|
System.Nullable<SOSHandling> |
Methods
AddInvalidShortName(String, Boolean)
Optionally: Specify additional short names that should not be generated as base64 indices. See also BlockedShortNames.
Declaration
public void AddInvalidShortName(string name, bool exactCasing = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to block. |
System.Boolean | exactCasing |
|
Dispose()
Releases the object from the Current property.
Declaration
public void Dispose()
Implements
RemoveInvalidShortName(String, Boolean)
Optionally: (Re-)allow short names that were in the list of blocked base 64 indices. See also BlockedShortNames.
Declaration
public void RemoveInvalidShortName(string name, bool exactCasing = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to unblock. |
System.Boolean | exactCasing |
|