Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / internal / lpsolver / LPSolver_coin.h
blob5aef03e6e00b1ebf4afc89d2a1f63e42c4ce30f6
1 /*
2 * $Revision: 2523 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Coin implementation of class LPSolver
12 * \author
14 * \par License:
15 * This file is part of the Open Graph Drawing Framework (OGDF).
17 * \par
18 * Copyright (C)<br>
19 * See README.txt in the root directory of the OGDF installation for details.
21 * \par
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * Version 2 or 3 as published by the Free Software Foundation;
25 * see the file LICENSE.txt included in the packaging of this file
26 * for details.
28 * \par
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * \par
35 * You should have received a copy of the GNU General Public
36 * License along with this program; if not, write to the Free
37 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
38 * Boston, MA 02110-1301, USA.
40 * \see http://www.gnu.org/copyleft/gpl.html
41 ***************************************************************/
44 #ifdef _MSC_VER
45 #pragma once
46 #endif
49 #ifndef OGDF_LPSOLVER_COIN_H
50 #define OGDF_LPSOLVER_COIN_H
52 #include <ogdf/basic/Array.h>
53 #include <ogdf/external/coin.h>
56 namespace ogdf {
58 class OGDF_EXPORT LPSolver
60 public:
61 enum OptimizationGoal { lpMinimize, lpMaximize };
62 enum Status { lpOptimal, lpInfeasible, lpUnbounded };
64 // Constructor
65 LPSolver();
66 ~LPSolver() { delete osi; }
68 double infinity() const;
70 // Call of LP solver
72 // Input is an optimization goal, an objective function, a matrix in sparse format, an
73 // equation-sense, and a right-hand side.
74 // The arrays have to be allocated as follows:
76 // double obj [numCols]
77 // int matrixBegin [numCols]
78 // int matrixCount [numCols]
79 // int matrixIndex [numNonzeroes]
80 // double matrixValue [numNonzeroes]
81 // double rightHandSide [numRows]
82 // char equationSense [numRows]
83 // double lowerBound [numCols]
84 // double upperBound [numCols]
85 // double x [numCols]
87 // The return value indicates the status of the solution. If an optimum solitions has
88 // been found, the result is lpOptimal
90 Status optimize(
91 OptimizationGoal goal, // goal of optimization (minimize or maximize)
92 Array<double> &obj, // objective function vector
93 Array<int> &matrixBegin, // matrixBegin[i] = begin of column i
94 Array<int> &matrixCount, // matrixCount[i] = number of nonzeroes in column i
95 Array<int> &matrixIndex, // matrixIndex[n] = index of matrixValue[n] in its column
96 Array<double> &matrixValue, // matrixValue[n] = non-zero value in matrix
97 Array<double> &rightHandSide, // right-hand side of LP constraints
98 Array<char> &equationSense, // 'E' == 'G' >= 'L' <=
99 Array<double> &lowerBound, // lower bound of x[i]
100 Array<double> &upperBound, // upper bound of x[i]
101 double &optimum, // optimum value of objective function (if result is lpOptimal)
102 Array<double> &x // x-vector of optimal solution (if result is lpOptimal)
105 bool checkFeasibility(
106 const Array<int> &matrixBegin, // matrixBegin[i] = begin of column i
107 const Array<int> &matrixCount, // matrixCount[i] = number of nonzeroes in column i
108 const Array<int> &matrixIndex, // matrixIndex[n] = index of matrixValue[n] in its column
109 const Array<double> &matrixValue, // matrixValue[n] = non-zero value in matrix
110 const Array<double> &rightHandSide, // right-hand side of LP constraints
111 const Array<char> &equationSense, // 'E' == 'G' >= 'L' <=
112 const Array<double> &lowerBound, // lower bound of x[i]
113 const Array<double> &upperBound, // upper bound of x[i]
114 const Array<double> &x // x-vector of optimal solution (if result is lpOptimal)
117 private:
118 OsiSolverInterface* osi;
125 #endif