QuadraticProgram Class

Represents a quadratic programming problem.

Definition

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

Remarks

Use the QuadraticProgram class to represent a quadratic optimization problem with linear constraints.

A quadratic program has variables and linear constraints. They are made available through the Variables and Constraints properties. These collections are indexed by name and by position.

There are three ways to define a quadratic program. You can supply the quadratic program in matrix form. You can build the quadratic program from scratch using the AddVariable(String, Double) and AddLinearConstraint(String, Double, Double) methods. Quadratic terms are set using the SetQuadraticCoefficient(String, String, Double) method. The ExtremumType property determines whether a maximum or a minimum is requested.

You can also load a quadratic program from an MPS file using the MpsReader class.

The Solve() method solves the quadratic program using a dual active set 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.

Once a solution has been computed, the OptimalValue property returns the optimal value.

Constructors

Properties

AssumeConvex Gets or sets whether to assume the quadratic program is convex.
Constraints Gets the collection of constraints for this OptimizationModel.
(Inherited from OptimizationModel)
ExtremumType Gets or sets whether a minimum or a maximum should be computed.
(Inherited from OptimizationModel)
InitialGuess Gets or sets an initial guess for the solution of the quadratic program.
Name Gets or sets the name of the model.
(Inherited from OptimizationModel)
OptimalValue Gets the extreme value of the cost function.
(Inherited from OptimizationModel)
SolutionReport Gets an object that contains information about the solution of the model.
(Inherited from OptimizationModel)
Status Gets the status of the optimization model's solution.
(Inherited from OptimizationModel)
Tolerance Gets or sets the tolerance used to determine if a solution has been found.
(Inherited from LinearProgram)
Variables Gets the collection of variables for this OptimizationModel.
(Inherited from OptimizationModel)

Methods

AddBinaryVariable(String) Adds a binary variable to the collection.
(Inherited from OptimizationModel)
AddBinaryVariable(String, Double) Adds a binary variable to the collection.
(Inherited from LinearProgram)
AddIntegerVariable(String) Adds an integer variable to the collection.
(Inherited from OptimizationModel)
AddIntegerVariable(String, Double) Adds a binary variable to the collection.
(Inherited from LinearProgram)
AddIntegerVariable(String, Int32, Int32) Adds a binary variable to the collection.
(Inherited from OptimizationModel)
AddIntegerVariable(String, Double, Int32, Int32) Adds a binary variable to the collection.
(Inherited from LinearProgram)
AddLinearConstraint(String, ConstraintType, Double) Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel)
AddLinearConstraint(String, Double, Double) Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel)
AddLinearConstraint(IList<DecisionVariable>, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel)
AddLinearConstraint(String, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel)
AddLinearConstraint(String, IList<Double>, Double, Double) Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel)
AddLinearConstraint(String, IList<DecisionVariable>, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel)
AddVariable(String) Adds a variable to the collection.
(Inherited from OptimizationModel)
AddVariable(String, Double) Adds a variable to the collection.
(Inherited from LinearProgram)
AddVariable(String, Double, Double) Adds a variable to the collection.
(Inherited from OptimizationModel)
AddVariable(String, Double, Double, Double) Adds a variable to the collection.
(Inherited from LinearProgram)
CreateLinearConstraints(Matrix<Double>, Vector<Double>, Int32) Creates linear constraints based on the specified coefficients.
(Inherited from OptimizationModel)
CreateLinearConstraints(Vector<Double>, Matrix<Double>, Vector<Double>) Creates linear constraints based on the specified coefficients and bounds.
(Inherited from OptimizationModel)
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)
GetCoefficientMatrix Returns a matrix containing the coefficients of the constraints.
(Inherited from LinearProgram)
GetDualSolution Gets the solution to the dual problem of the linear program.
(Inherited from LinearProgram)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetObjective Gets a vector that contains the coefficients of the linear objective function.
(Inherited from LinearProgram)
GetSolution Gets the solution to the optimization model.
(Inherited from OptimizationModel)
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.
(Inherited from OptimizationModel)
OnAddVariable Notifies the optimization model that a variable has been added.
(Overrides OptimizationModel.OnAddVariable(DecisionVariable))
OnRemoveAllConstraints Notifies the optimization model that all constraints has been removed.
(Inherited from OptimizationModel)
OnRemoveAllVariables Notifies the optimization model that all variables has been removed.
(Overrides OptimizationModel.OnRemoveAllVariables())
OnRemoveConstraint Notifies the optimization model that a constraint has been removed.
(Inherited from OptimizationModel)
OnRemoveVariable Notifies the optimization model that a variable has been removed.
(Overrides OptimizationModel.OnRemoveVariable(DecisionVariable))
SetQuadraticCoefficient(DecisionVariable, DecisionVariable, Double) Sets the coefficient of the quadratic term for the specified variables.
SetQuadraticCoefficient(String, String, Double) Sets the coefficient of the quadratic term for the specified variables.
Solve() Solves the model and returns the solution.
(Inherited from OptimizationModel)
Solve(SimplexOptions, ParallelOptions) Solves a linear program with the specified options.
(Inherited from LinearProgram)
Solve(OptimizationGoal, ParallelOptions, Double) Solves a linear program with the specified options.
(Inherited from LinearProgram)
SolveModel Solves the quadratic program and returns the primal solution.
(Overrides LinearProgram.SolveModel())
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also