Show / Hide Table of Contents

    Class GLPKSolver

    GNU Linear Programming Kit (GLPK) Solver Interface for the Optimization.Framework

    Inheritance
    System.Object
    SolverBase
    GenericSolverBase<GLPKSolverConfiguration>
    GLPKSolver
    Inherited Members
    GenericSolverBase<GLPKSolverConfiguration>.Configuration
    SolverBase.IsBusy
    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.ResolveAdapterSpecific(Int32, IDictionary<Variable, Double>)
    SolverBase.RestoreModel(Solution)
    SolverBase.TransformModel()
    SolverBase.CanExportCurrentModel(Boolean)
    SolverBase.RebuildSolverModelAdapterSpecific(Int32)
    SolverBase.SetBranchingPriorityAdapterSpecific()
    SolverBase.SetBranchingDirectionAdapterSpecific()
    SolverBase.SetTimelimitAndGapForCurrentStage(Int32, TimeSpan, Double)
    SolverBase.DisposeCustom()
    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.GLPK
    Assembly: Optimization.Solver.GLPK.dll
    Syntax
    public class GLPKSolver : GenericSolverBase<GLPKSolverConfiguration>, ISolver, ICanSolve<Model, Solution>, IAbortable, IDisposable

    Constructors

    GLPKSolver(GLPKSolverConfiguration)

    Initializes a new instance of the GLPKSolver class. In order to use the GLPKSolver in your project, make sure to reference the glpk.dll from the GLPK installation folder.

    Declaration
    public GLPKSolver(GLPKSolverConfiguration configuration = null)
    Parameters
    Type Name Description
    GLPKSolverConfiguration configuration

    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()
    Exceptions
    Type Condition
    System.NotSupportedException

    If this solver instance not supports aborting.

    AddConstraint(Constraint)

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

    AddObjective(Objective)

    Set the objective as active objective.

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

    The objective.

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

    objective musn't be null.

    System.ArgumentException

    objective musn't contain non-linear terms.

    System.InvalidOperationException

    Method should only be called for resolves. Otherwise, the variables might no be known to the solver. Make sure to only use previously known/registered variables in the Expression.

    BuildSolverModelAdapterSpecific(Int32)

    Initializes the internal structures to solve the problem with GLPK.

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

    The prio level.

    Overrides
    SolverBase.BuildSolverModelAdapterSpecific(Int32)

    ClearLastModel()

    Deletes the internal datastructures of this solver instance.

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

    If this solver instance is busy.

    Dispose()

    Declaration
    public void Dispose()

    ExportModelSolverSpecific()

    The export model solver specific.

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

    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)

    SetConfigurationAdapterSpecific()

    Nothing to do here, since GLPK does not have a typical SolverConfiguration. All the work happens in OPTANO.Modeling.Optimization.Solver.GLPK.GLPKSolver.ConvertIocpParameter and .

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

    SolveAdapterSpecific(Int32, IDictionary<Variable, Double>)

    Solves the specified model.

    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 start values. GLPK does not utilize this, yet.

    Returns
    Type Description
    Solution

    A solution object.

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

    Extension Methods

    ExtensionMethods.Clone<T>(T)
    ExtensionMethods.ThrowIfArgumentIsNull<T>(T, String)
    ReflectionHelper.GetFieldValue(Object, String)
    ReflectionHelper.SetFieldValue(Object, String, Object)