Class GLPKSolver
GNU Linear Programming Kit (GLPK) Solver Interface for the Optimization.Framework
Inherited Members
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
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
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
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
ClearLastModel()
Deletes the internal datastructures of this solver instance.
Declaration
public override void ClearLastModel()
Overrides
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
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
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
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. |