Loading [MathJax]/extensions/tex2jax.js

Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
LPSolver.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Array.h>
35#include <ogdf/external/coin.h>
36
37namespace ogdf {
38
40public:
41 enum class OptimizationGoal { Minimize, Maximize };
42 enum class Status { Optimal, Infeasible, Unbounded };
43
44 // Constructor
46
47 ~LPSolver() { delete osi; }
48
49 double infinity() const;
50
51 // Call of LP solver
52 //
53 // Input is an optimization goal, an objective function, a matrix in sparse format, an
54 // equation-sense, and a right-hand side.
55 // The arrays have to be allocated as follows:
56 //
57 // double obj [numCols]
58 // int matrixBegin [numCols]
59 // int matrixCount [numCols]
60 // int matrixIndex [numNonzeroes]
61 // double matrixValue [numNonzeroes]
62 // double rightHandSide [numRows]
63 // char equationSense [numRows]
64 // double lowerBound [numCols]
65 // double upperBound [numCols]
66 // double x [numCols]
67 //
68 // The return value indicates the status of the solution. If an optimum solitions has
69 // been found, the result is Optimal
70
71 Status optimize(OptimizationGoal goal, // goal of optimization (minimize or maximize)
72 Array<double>& obj, // objective function vector
73 Array<int>& matrixBegin, // matrixBegin[i] = begin of column i
74 Array<int>& matrixCount, // matrixCount[i] = number of nonzeroes in column i
75 Array<int>& matrixIndex, // matrixIndex[n] = index of matrixValue[n] in its column
76 Array<double>& matrixValue, // matrixValue[n] = non-zero value in matrix
77 Array<double>& rightHandSide, // right-hand side of LP constraints
78 Array<char>& equationSense, // 'E' == 'G' >= 'L' <=
79 Array<double>& lowerBound, // lower bound of x[i]
80 Array<double>& upperBound, // upper bound of x[i]
81 double& optimum, // optimum value of objective function (if result is Optimal)
82 Array<double>& x // x-vector of optimal solution (if result is Optimal)
83 );
84
85 bool checkFeasibility(const Array<int>& matrixBegin, // matrixBegin[i] = begin of column i
86 const Array<int>& matrixCount, // matrixCount[i] = number of nonzeroes in column i
87 const Array<int>& matrixIndex, // matrixIndex[n] = index of matrixValue[n] in its column
88 const Array<double>& matrixValue, // matrixValue[n] = non-zero value in matrix
89 const Array<double>& rightHandSide, // right-hand side of LP constraints
90 const Array<char>& equationSense, // 'E' == 'G' >= 'L' <=
91 const Array<double>& lowerBound, // lower bound of x[i]
92 const Array<double>& upperBound, // upper bound of x[i]
93 const Array<double>& x // x-vector of optimal solution (if result is Optimal)
94 ) const;
95
96private:
98};
99
100
101}
Declaration and implementation of Array class and Array algorithms.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Status optimize(OptimizationGoal goal, Array< double > &obj, Array< int > &matrixBegin, Array< int > &matrixCount, Array< int > &matrixIndex, Array< double > &matrixValue, Array< double > &rightHandSide, Array< char > &equationSense, Array< double > &lowerBound, Array< double > &upperBound, double &optimum, Array< double > &x)
OsiSolverInterface * osi
Definition LPSolver.h:97
bool checkFeasibility(const Array< int > &matrixBegin, const Array< int > &matrixCount, const Array< int > &matrixIndex, const Array< double > &matrixValue, const Array< double > &rightHandSide, const Array< char > &equationSense, const Array< double > &lowerBound, const Array< double > &upperBound, const Array< double > &x) const
double infinity() const
Definition of ogdf::CoinManager.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.