OptimizationModel Class

Represents an optimization problem.

Definition

Namespace: Extreme.Mathematics.Optimization
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public abstract class OptimizationModel
Inheritance
Object  →  OptimizationModel
Derived

Remarks

The OptimizationModel class serves as the abstract base class for classes that represent optimization models.

A model has variables and constraints. They are made available through the Variables and Constraints properties. These collections are indexed by name and by position. The types of constraints that are allowed depend on the concrete class.

OptimizationModel instances cannot be created directly. Instead, create an instance of one of the derivived classes:

ClassPurpose
LinearProgramOptimize a linear objective function subject to linear constraints.
QuadraticProgramOptimize a quadratic objective function subject to linear constraints.
NonlinearProgramOptimize a possibly nonlinear objective function subject to both linear and nonlinear constraints.

The Solve() method solves the optimization model using a dual Revised Simplex Method. Note that this operation can take a long time for large problems or difficult problems. Most problems up to several hundred variables are solved within a fraction of a second. The Status property returns a OptimizationModelStatus value that indicates the result of the calculation. A value of Optimal indicates an optimal solution was found.

The Solve() method returns a Vector containing the optimal values for the variables. The values of the variables are also avaialble through the Value property of the variables. The OptimalValue property returns the optimal value.

Constructors

OptimizationModel(Func<String, DecisionVariable>) Constructs a new OptimizationModel object.
OptimizationModel(Func<String, DecisionVariable>, Matrix<Double>, Vector<Double>) Constructs an optimization model with linear constraints in standard form.
OptimizationModel(Func<String, DecisionVariable>, Matrix<Double>, Vector<Double>, Int32) Constructs an optimization model with linear constraints in standard form.
OptimizationModel(Func<String, DecisionVariable>, Matrix<Double>, Vector<Double>, Vector<Double>, Vector<Double>, Vector<Double>) Constructs an optimization model with linear constraints in standard form.

Properties

Constraints Gets the collection of constraints for this OptimizationModel.
ExtremumType Gets or sets whether a minimum or a maximum should be computed.
Name Gets or sets the name of the model.
OptimalValue Gets the extreme value of the cost function.
SolutionReport Gets an object that contains information about the solution of the model.
Status Gets the status of the optimization model's solution.
Variables Gets the collection of variables for this OptimizationModel.

Methods

AddBinaryVariable Adds a binary variable to the collection.
AddIntegerVariable(String) Adds an integer variable to the collection.
AddIntegerVariable(String, Int32, Int32) Adds a binary variable to the collection.
AddLinearConstraint(String, ConstraintType, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, Double, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(IList<DecisionVariable>, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, IList<Double>, Double, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, IList<DecisionVariable>, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
AddVariable(String) Adds a variable to the collection.
AddVariable(String, Double, Double) Adds a variable to the collection.
CreateLinearConstraints(Matrix<Double>, Vector<Double>, Int32) Creates linear constraints based on the specified coefficients.
CreateLinearConstraints(Vector<Double>, Matrix<Double>, Vector<Double>) Creates linear constraints based on the specified coefficients and bounds.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetSolution Gets the solution to the optimization model.
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OnAddConstraint Notifies the optimization model that a constraint has been added.
OnAddVariable Notifies the optimization model that a variable has been added.
OnRemoveAllConstraints Notifies the optimization model that all constraints has been removed.
OnRemoveAllVariables Notifies the optimization model that all variables has been removed.
OnRemoveConstraint Notifies the optimization model that a constraint has been removed.
OnRemoveVariable Notifies the optimization model that a variable has been removed.
Solve Solves the model and returns the solution.
SolveModel Solves the model and returns a report detailing the solution.
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also