Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Blog
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference
  • Extreme Optimization
    • Features
    • Solutions
    • Documentation
    • QuickStart Samples
    • Sample Applications
    • Downloads
    • Technical Support
    • Download trial
    • How to buy
    • Blog
    • Company
    • Resources
  • Documentation
    • Introduction
    • Deployment Guide
    • Nuget packages
    • Configuration
    • Using Parallelism
    • Mathematics Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Data Access Library User's Guide
    • Reference
  • Reference
    • Extreme
    • Extreme.Collections
    • Extreme.Data
    • Extreme.Data.Json
    • Extreme.Data.Matlab
    • Extreme.Data.R
    • Extreme.Data.Stata
    • Extreme.Data.Text
    • Extreme.DataAnalysis
    • Extreme.DataAnalysis.Linq
    • Extreme.DataAnalysis.Models
    • Extreme.Mathematics
    • Extreme.Mathematics.Algorithms
    • Extreme.Mathematics.Calculus
    • Extreme.Mathematics.Calculus.OrdinaryDifferentialEquations
    • Extreme.Mathematics.Curves
    • Extreme.Mathematics.Curves.Nonlinear
    • Extreme.Mathematics.Distributed
    • Extreme.Mathematics.EquationSolvers
    • Extreme.Mathematics.Generic
    • Extreme.Mathematics.LinearAlgebra
    • Extreme.Mathematics.LinearAlgebra.Implementation
    • Extreme.Mathematics.LinearAlgebra.IterativeSolvers
    • Extreme.Mathematics.LinearAlgebra.IterativeSolvers.Preconditioners
    • Extreme.Mathematics.Optimization
    • Extreme.Mathematics.Optimization.LineSearches
    • Extreme.Mathematics.Random
    • Extreme.Mathematics.SignalProcessing
    • Extreme.Providers
    • Extreme.Providers.InteropServices
    • Extreme.Statistics
    • Extreme.Statistics.Distributions
    • Extreme.Statistics.Multivariate
    • Extreme.Statistics.Tests
    • Extreme.Statistics.TimeSeriesAnalysis
  • Extreme.Mathematics.Optimization
    • BoundedQuasiNewtonOptimizer Class
    • BrentDerivativeOptimizer Class
    • BrentOptimizer Class
    • ConjugateGradientMethod Enumeration
    • ConjugateGradientOptimizer Class
    • Constraint Class
    • ConstraintCollection Class
    • ConstraintType Enumeration
    • DecisionVariable Class
    • DecisionVariableCollection Class
    • DirectionalOptimizer Class
    • ExtremumType Enumeration
    • GoldenSectionOptimizer Class
    • LeastSquaresOptimizer Class
    • LevenbergMarquardtOptimizer Class
    • LimitedMemoryBfgsOptimizer Class
    • LinearConstraint Class
    • LinearProgram Class
    • LinearProgramConstraint Class
    • LinearProgramSolver Class
    • LinearProgramVariable Class
    • MpsReader Class
    • MultidimensionalOptimizer Class
    • NelderMeadOptimizer Class
    • NonlinearConstraint Class
    • NonlinearProgram Class
    • OneDimensionalOptimizer Class
    • OptimizationModel Class
    • OptimizationModelEntity Class
    • OptimizationModelSolver(T) Class
    • OptimizationModelStatus Enumeration
    • OptimizationSolutionReport Class
    • PowellOptimizer Class
    • QuadraticProgram Class
    • QuasiNewtonMethod Enumeration
    • QuasiNewtonOptimizer Class
    • TrustRegionReflectiveOptimizer Class
  • LinearProgram Class
    • LinearProgram Constructors
    • Properties
    • Methods

LinearProgram Class

Extreme Optimization Numerical Libraries for .NET Professional
Represents a linear programming problem.
Inheritance Hierarchy

SystemObject
  Extreme.Mathematics.OptimizationOptimizationModel
    Extreme.Mathematics.OptimizationLinearProgram
      Extreme.Mathematics.OptimizationQuadraticProgram

Namespace:  Extreme.Mathematics.Optimization
Assembly:  Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
Syntax

C#
VB
C++
F#
Copy
public class LinearProgram : OptimizationModel
Public Class LinearProgram
	Inherits OptimizationModel
public ref class LinearProgram : public OptimizationModel
type LinearProgram =  
    class
        inherit OptimizationModel
    end

The LinearProgram type exposes the following members.

Constructors

  NameDescription
Public methodLinearProgram
Constructs a new LinearProgram object.
Public methodLinearProgram(VectorDouble, MatrixDouble, VectorDouble)
Constructs a new linear program in standard form.
Public methodLinearProgram(VectorDouble, MatrixDouble, VectorDouble, Int32)
Constructs a new linear program in standard form.
Public methodLinearProgram(VectorDouble, MatrixDouble, VectorDouble, VectorDouble, VectorDouble, VectorDouble)
Constructs a new linear program.
Top
Properties

  NameDescription
Public propertyConstraints
Gets the collection of constraints for this OptimizationModel.
(Inherited from OptimizationModel.)
Public propertyExtremumType
Gets or sets whether a minimum or a maximum should be computed.
(Inherited from OptimizationModel.)
Public propertyName
Gets or sets the name of the model.
(Inherited from OptimizationModel.)
Public propertyOptimalValue
Gets the extreme value of the cost function.
(Inherited from OptimizationModel.)
Public propertySolutionReport
Gets an object that contains information about the solution of the model.
(Inherited from OptimizationModel.)
Public propertyStatus
Gets the status of the optimization model's solution.
(Inherited from OptimizationModel.)
Public propertyTolerance
Gets or sets the tolerance used to determine if a solution has been found.
Public propertyVariables
Gets the collection of variables for this OptimizationModel.
(Inherited from OptimizationModel.)
Top
Methods

  NameDescription
Public methodAddBinaryVariable(String)
Adds a binary variable to the collection.
(Inherited from OptimizationModel.)
Public methodAddBinaryVariable(String, Double)
Adds a binary variable to the collection.
Public methodAddIntegerVariable(String)
Adds an integer variable to the collection.
(Inherited from OptimizationModel.)
Public methodAddIntegerVariable(String, Double)
Adds a binary variable to the collection.
Public methodAddIntegerVariable(String, Int32, Int32)
Adds a binary variable to the collection.
(Inherited from OptimizationModel.)
Public methodAddIntegerVariable(String, Double, Int32, Int32)
Adds a binary variable to the collection.
Public methodAddLinearConstraint(String, ConstraintType, Double)
Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel.)
Public methodAddLinearConstraint(String, Double, Double)
Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel.)
Public methodAddLinearConstraint(IListDecisionVariable, IListDouble, ConstraintType, Double)
Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel.)
Public methodAddLinearConstraint(String, IListDouble, ConstraintType, Double)
Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel.)
Public methodAddLinearConstraint(String, IListDouble, Double, Double)
Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel.)
Public methodAddLinearConstraint(String, IListDecisionVariable, IListDouble, ConstraintType, Double)
Adds a linear constraint to the optimization model.
(Inherited from OptimizationModel.)
Public methodAddVariable(String)
Adds a variable to the collection.
(Inherited from OptimizationModel.)
Public methodAddVariable(String, Double)
Adds a variable to the collection.
Public methodAddVariable(String, Double, Double)
Adds a variable to the collection.
(Inherited from OptimizationModel.)
Public methodAddVariable(String, Double, Double, Double)
Adds a variable to the collection.
Protected methodCreateLinearConstraints(MatrixDouble, VectorDouble, Int32)
Creates linear constraints based on the specified coefficients.
(Inherited from OptimizationModel.)
Protected methodCreateLinearConstraints(VectorDouble, MatrixDouble, VectorDouble)
Creates linear constraints based on the specified coefficients and bounds.
(Inherited from OptimizationModel.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetCoefficientMatrix
Returns a matrix containing the coefficients of the constraints.
Public methodGetDualSolution
Gets the solution to the dual problem of the linear program.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetObjective
Gets a vector that contains the coefficients of the linear objective function.
Public methodGetSolution
Gets the solution to the optimization model.
(Inherited from OptimizationModel.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnAddConstraint
Notifies the optimization model that a constraint has been added.
(Inherited from OptimizationModel.)
Protected methodOnAddVariable
Notifies the optimization model that a variable has been added.
(Inherited from OptimizationModel.)
Protected methodOnRemoveAllConstraints
Notifies the optimization model that all constraints has been removed.
(Inherited from OptimizationModel.)
Protected methodOnRemoveAllVariables
Notifies the optimization model that all variables has been removed.
(Inherited from OptimizationModel.)
Protected methodOnRemoveConstraint
Notifies the optimization model that a constraint has been removed.
(Inherited from OptimizationModel.)
Protected methodOnRemoveVariable
Notifies the optimization model that a variable has been removed.
(Inherited from OptimizationModel.)
Public methodSolve
Solves the model and returns the solution.
(Inherited from OptimizationModel.)
Public methodSolve(SimplexOptions, ParallelOptions)
Solves a linear program with the specified options.
Public methodSolve(OptimizationGoal, ParallelOptions, Double)
Solves a linear program with the specified options.
Protected methodSolveModel
Solves the model and returns a report detailing the solution.
(Overrides OptimizationModelSolveModel.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

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(String, Double, 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.

See Also

Reference

Extreme.Mathematics.Optimization Namespace

Copyright (c) 2004-2021 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2021, 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.