Class CplexSolver
Represents a CPLEX solver instance for mathematical programming problems.
Inherited Members
Namespace: OPTANO.Modeling.Optimization.Solver.Cplex127
Assembly: Optimization.Solver.Cplex127.dll
Syntax
public class CplexSolver : GenericSolverBase<CplexSolverConfiguration>, ICanManipulateANativeSolver, ICanSetCutOff, ISolver, ICanSolve<Model, Solution>, IAbortable, ICplexBranchedCallback, IStatus<StatusInfo>, IDisposable
Constructors
CplexSolver(CplexSolverConfiguration)
Initializes a new instance of the CplexSolver class.
In order to use the CplexSolver in your project, make sure to reference the ILOG.Cplex.dll
and ILOG.Concert.DLL
from the CPLEX installation folder.
Declaration
public CplexSolver(CplexSolverConfiguration configuration = null)
Parameters
Type | Name | Description |
---|---|---|
CplexSolverConfiguration | configuration | The configuration. |
Methods
Abort()
If this SolverBase instance
Declaration
public override void Abort()
Overrides
Implements
AddConstraint(Constraint)
The add constraint.
Declaration
protected void AddConstraint(Constraint constraint)
Parameters
Type | Name | Description |
---|---|---|
Constraint | constraint | The constraint. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
AddObjective(Objective)
The add objective.
Declaration
protected override void AddObjective(Objective objective)
Parameters
Type | Name | Description |
---|---|---|
Objective | objective | The objective. |
Overrides
BuildSolverModelAdapterSpecific(Int32)
Initializes the solver instance and then builds the ILOG.CPLEX.CpxModel.
Declaration
protected override void BuildSolverModelAdapterSpecific(int prioLevel = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | prioLevel | The prio level. |
Overrides
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 | The print hints. |
Returns
Type | Description |
---|---|
System.Boolean | The System.Boolean. |
Overrides
ClearLastModel()
Deletes the internal datastructures of this SolverBase instance.
Declaration
public override void ClearLastModel()
Overrides
Implements
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If this SolverBase instance |
Dispose(Boolean)
The dispose.
Declaration
protected void Dispose(bool freeManagedObjectsAlso)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | freeManagedObjectsAlso |
|
DisposeCustom()
Disposes this solver instance.
Declaration
protected override void DisposeCustom()
Overrides
ExportFileSolverSpecific(FileInfo)
Export the model solver specific.
Declaration
protected override void ExportFileSolverSpecific(FileInfo outputFile)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | outputFile |
Overrides
RebuildSolverModelAdapterSpecific(Int32)
Model is already built up and up to date due to OPTANO.Modeling.Optimization.Solver.Interfaces.ICanManipulateANativeSolver.
Declaration
protected override void RebuildSolverModelAdapterSpecific(int prioLevel = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | prioLevel | The prio level. |
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
ResolveAdapterSpecific(Int32, IDictionary<Variable, Double>)
The resolve adapter specific.
Declaration
protected override Solution ResolveAdapterSpecific(int prioLevel = 0, IDictionary<Variable, double> variableValues = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | prioLevel | The prio level. |
System.Collections.Generic.IDictionary<Variable, System.Double> | variableValues | The variable values. |
Returns
Type | Description |
---|---|
Solution | The Solution. |
Overrides
SetBranchingDirectionAdapterSpecific()
Sets the BranchingDirection adapter specific.
Declaration
protected override void SetBranchingDirectionAdapterSpecific()
Overrides
SetBranchingPriorityAdapterSpecific()
Set the BranchingPriority adapter specific.
Declaration
protected override void SetBranchingPriorityAdapterSpecific()
Overrides
SetConfigurationAdapterSpecific()
Sets the configuration parameters in OPTANO.Modeling.Optimization.Solver.Cplex127.CplexSolver.Cplex environment.
Declaration
protected override void SetConfigurationAdapterSpecific()
Overrides
SolveAdapterSpecific(Int32, IDictionary<Variable, Double>)
Solves the CurrentModel. Optimizes if CurrentModel contains at least one Objective.
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 | Initial values for all or a subset of variables in the Model |
Returns
Type | Description |
---|---|
Solution | The Solution. Note that the solution does not always contain values, since the |
Overrides
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | If this solver instance not supports solving. |
System.InvalidOperationException | If this solver instance is busy. |
Events
Branched
Occurs when Cplex branches on a node.
Declaration
public event EventHandler<CplexBranchingEventArgs> Branched
Event Type
Type | Description |
---|---|
System.EventHandler<CplexBranchingEventArgs> |
Implements
Status
The status callback during the solution process.
Declaration
public event Action<StatusInfo> Status
Event Type
Type | Description |
---|---|
System.Action<StatusInfo> |
Implements
Explicit Interface Implementations
ICanSetCutOff.SetCutOff
Gets or sets the set cut off.
Declaration
Func<double> ICanSetCutOff.SetCutOff { get; set; }
Returns
Type | Description |
---|---|
System.Func<System.Double> |