Numerical Components for .NET
Namespace: Extreme.Mathematics.OptimizationAssembly: Extreme.Numerics.Net40 (in Extreme.Numerics.Net40.dll) Version: 4.2.11333.0 (4.2.12253.0)
public class LinearProgram : OptimizationModel
Public Class LinearProgram _ Inherits OptimizationModel
public ref class LinearProgram : public OptimizationModel
type LinearProgram = class inherit OptimizationModel end
Use the LinearProgram class to represent a linear optimization problem with linear constraints.
A linear program has variables and 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 linear program. You can supply the linear program in matrix form. You can build the linear program from scratch using the AddVariable(String, Double) and AddLinearConstraint(IList<(Of <<'(DecisionVariable>)>>), IList<(Of <<'(Double>)>>), ConstraintType, Double) methods. The ExtremumType property determines whether a maximum or a minimum is requested.
You can also load a linear program from an MPS file using the MpsReader class.
The Solve()()()() method solves the linear program 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.
Once a solution has been computed, the GetDualSolution()()()() returns a Vector containing the dual solution (the solution in terms of the shadow variables.) The OptimalValue property returns the optimal value.
Copyright © 2003-2013, Extreme Optimization. All rights reserved. Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc. Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo are registered trademarks of Microsoft Corporation.