Show / Hide Table of Contents

    Class GurobiSolverNative

    The gurobi solver native.

    Inheritance
    System.Object
    SolverBase
    GenericSolverBase<GurobiSolverConfiguration>
    GurobiSolverNative
    Inherited Members
    GenericSolverBase<GurobiSolverConfiguration>.Configuration
    SolverBase._busyLock
    SolverBase.CurrentModel
    SolverBase.TriviallyFeasibleConstraintHandling
    SolverBase.Transformation
    SolverBase._model
    SolverBase.IsMultiHierachicalModel
    SolverBase.SetMultiHierarchicalInterruptionCallback(SolverBase.InterruptMultiHierarchicalOptimization)
    SolverBase.Solve(Model, Dictionary<Variable, Double>)
    SolverBase.CachedMergedObjectives
    SolverBase.GetMergedObjectiveForPriorityLevel(Int32, Boolean)
    SolverBase.GetRelevantObjectivesForPrioLevel(Int32)
    SolverBase.RestoreModel(Solution)
    SolverBase.TransformModel()
    SolverBase.RebuildSolverModelAdapterSpecific(Int32)
    SolverBase.SetBranchingDirectionAdapterSpecific()
    SolverBase.SetTimelimitAndGapForCurrentStage(Int32, TimeSpan, Double)
    SolverBase.Dispose()
    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.Solver.Gurobi652
    Assembly: Optimization.Solver.Gurobi652.dll
    Syntax
    [Obsolete("This is an EXPERIMENTAL class. Do not use it in production, yet!", false)]
    public class GurobiSolverNative : GenericSolverBase<GurobiSolverConfiguration>, ISolver, ICanSolve<Model, Solution>, IAbortable, IDisposable, IStatus<StatusInfo>

    Constructors

    GurobiSolverNative()

    Initializes a new instance of the GurobiSolverNative class.

    Declaration
    protected GurobiSolverNative()

    GurobiSolverNative(GurobiSolverConfiguration)

    Initializes a new instance of the GurobiSolverNative class. Tries to acquire a Gurobi License. If this fails, a Gurobi.GRBException is thrown. In order to use the GurobiSolver in your project, make sure to reference the GurobiXX.NET.dll from your gurobi installation folder ('..\gurobiXX\win64\bin\GurobiXX.NET.dll')

    Declaration
    public GurobiSolverNative(GurobiSolverConfiguration configuration = null)
    Parameters
    Type Name Description
    GurobiSolverConfiguration configuration

    The configuration.

    Properties

    AddedAsPureLowerBoundConstraint

    Gets or sets the added as pure lower bound constraint.

    Declaration
    protected HashSet<string> AddedAsPureLowerBoundConstraint { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.HashSet<System.String>

    ColumnToVariable

    Gets or sets the column to variable.

    Declaration
    protected Dictionary<int, string> ColumnToVariable { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.Int32, System.String>

    ConstraintLowerBoundRow

    Gets or sets the constraint lower bound row.

    Declaration
    protected Dictionary<string, int> ConstraintLowerBoundRow { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Int32>

    ConstraintUpperBoundRow

    Contains the row number in Gurobi for every constraint

    Declaration
    protected Dictionary<string, int> ConstraintUpperBoundRow { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Int32>

    VariableColumn

    Contains the column number in Gurobi for every variable

    Declaration
    protected Dictionary<string, int> VariableColumn { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Int32>

    Methods

    Abort()

    If this solver instance is busy abort the run as soon as possible, or do nothing if this solver instance is not busy.

    Declaration
    public override void Abort()
    Overrides
    SolverBase.Abort()
    Implements
    IAbortable.Abort()
    Exceptions
    Type Condition
    System.NotSupportedException

    If this solver instance not supports aborting.

    AddConstraint(Constraint)

    Adds the constraint to the solver model.

    Declaration
    protected void AddConstraint(Constraint constraint)
    Parameters
    Type Name Description
    Constraint constraint

    The Constraint to add.

    AddObjective(Objective)

    The add objective.

    Declaration
    protected override void AddObjective(Objective objective)
    Parameters
    Type Name Description
    Objective objective

    The objective.

    Overrides
    SolverBase.AddObjective(Objective)
    Exceptions
    Type Condition
    System.NotImplementedException

    BuildSolverModelAdapterSpecific(Int32)

    Declaration
    protected override void BuildSolverModelAdapterSpecific(int prioLevel = 0)
    Parameters
    Type Name Description
    System.Int32 prioLevel
    Overrides
    SolverBase.BuildSolverModelAdapterSpecific(Int32)

    CanExportFile(FileInfo, ExportTime, Boolean)

    True, if ModelOutputFile is not null and has any extension.

    Declaration
    protected override bool CanExportFile(FileInfo outputFile, ExportTime exportTime, bool printHints = false)
    Parameters
    Type Name Description
    System.IO.FileInfo outputFile

    The file to check.

    ExportTime exportTime

    Export before or after solve.

    System.Boolean printHints

    Indicates whether to print hints.

    Returns
    Type Description
    System.Boolean

    The System.Boolean.

    Overrides
    SolverBase.CanExportFile(FileInfo, ExportTime, Boolean)

    ChangeConstraintLowerBound(String, Double)

    Changes the constraint lower bound.

    Declaration
    public void ChangeConstraintLowerBound(string name, double lowerbound)
    Parameters
    Type Name Description
    System.String name

    The name.

    System.Double lowerbound

    The lowerbound.

    ChangeConstraintUpperBound(String, Double)

    Changes the constraint upper bound.

    Declaration
    public void ChangeConstraintUpperBound(string name, double upperbound)
    Parameters
    Type Name Description
    System.String name

    The name.

    System.Double upperbound

    The upperbound.

    ClearLastModel()

    Deletes the internal datastructures of this solver instance.

    Declaration
    public override void ClearLastModel()
    Overrides
    SolverBase.ClearLastModel()
    Implements
    ISolver.ClearLastModel()
    Exceptions
    Type Condition
    System.InvalidOperationException

    If this solver instance is busy.

    Dispose(Boolean)

    Disposes this instance of the GurobiSolverNative. Frees the Gurobi License.

    Declaration
    protected void Dispose(bool freeManagedObjectsAlso)
    Parameters
    Type Name Description
    System.Boolean freeManagedObjectsAlso

    True, if managed objects such as the Gurobi.GRBEnv should be disposed as well.

    DisposeCustom()

    Disposes this instance of GurobiSolverNative. Frees the Gurobi License

    Declaration
    protected override void DisposeCustom()
    Overrides
    SolverBase.DisposeCustom()

    ExportFileSolverSpecific(FileInfo)

    Export the model solver specific.

    Declaration
    protected override void ExportFileSolverSpecific(FileInfo outputFile)
    Parameters
    Type Name Description
    System.IO.FileInfo outputFile
    Overrides
    SolverBase.ExportFileSolverSpecific(FileInfo)

    Finalize()

    Finalizes an instance of the GurobiSolverNative class. Frees the Gurobi License

    Declaration
    protected void Finalize()

    GetSubOptimalSolution(Int32)

    The get sub optimal solution.

    Declaration
    public Dictionary<string, double> GetSubOptimalSolution(int n)
    Parameters
    Type Name Description
    System.Int32 n

    The n.

    Returns
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Double>

    The .

    Exceptions
    Type Condition
    System.ArgumentException
    System.InvalidOperationException

    RemoveConstraint(String)

    Removes the Constraint with Name == name.

    Declaration
    protected override void RemoveConstraint(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the Constraint to remove.

    Overrides
    SolverBase.RemoveConstraint(String)

    ResolveAdapterSpecific(Int32, IDictionary<Variable, Double>)

    Performs a Gurobi specific resolve for the CurrentModel. Make sure that this method is only called, in case of an actual resolve. Otherwise, the internal Gurobi.GRBModel will throw an Gurobi.GRBException.

    Declaration
    protected override Solution ResolveAdapterSpecific(int prioLevel = 0, IDictionary<Variable, double> variableValues = null)
    Parameters
    Type Name Description
    System.Int32 prioLevel

    The priority level to solve for.

    System.Collections.Generic.IDictionary<Variable, System.Double> variableValues

    The start values.

    Returns
    Type Description
    Solution

    The Solution.

    Overrides
    SolverBase.ResolveAdapterSpecific(Int32, IDictionary<Variable, Double>)

    SetBranchingPriorityAdapterSpecific()

    The set branching priorities.

    Declaration
    protected override void SetBranchingPriorityAdapterSpecific()
    Overrides
    SolverBase.SetBranchingPriorityAdapterSpecific()

    SetConfigurationAdapterSpecific()

    Sets the solver configuration. This includes all values specified in GurobiSolverConfiguration and the following values: The values for MIPGap, MIPGapAbs, and TimeLimit are taken from the base SolverConfiguration and set every time when this method is executed. Before, the values only were set when the user specifically specified any value other than 0.

    Declaration
    protected override void SetConfigurationAdapterSpecific()
    Overrides
    SolverBase.SetConfigurationAdapterSpecific()

    SolveAdapterSpecific(Int32, IDictionary<Variable, Double>)

    Solves the CurrentModel.

    Declaration
    protected override Solution SolveAdapterSpecific(int prioLevel = 0, IDictionary<Variable, double> variableValues = null)
    Parameters
    Type Name Description
    System.Int32 prioLevel

    The priority level to solve for.

    System.Collections.Generic.IDictionary<Variable, System.Double> variableValues

    The variable values.

    Returns
    Type Description
    Solution

    The Solution.

    Overrides
    SolverBase.SolveAdapterSpecific(Int32, IDictionary<Variable, Double>)

    Events

    Status

    The status information callback.

    Declaration
    public event Action<StatusInfo> Status
    Event Type
    Type Description
    System.Action<StatusInfo>
    Implements
    IStatus<T>.Status

    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