1 /*!\file
2 * \author Matthias Elf
3 *
4 * \par License:
5 * This file is part of ABACUS - A Branch And CUt System
6 * Copyright (C) 1995 - 2003
7 * University of Cologne, Germany
8 *
9 * \par
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * \par
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * Lesser General Public License for more details.
20 *
21 * \par
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25 *
26 * \see http://www.gnu.org/copyleft/gpl.html
27 *
28 * \par
29 *   The file \a lpif.cc contains all code fragments of the basic
30 *   \ABACUS\ library which depend on the preprocessor definition of the
31 *   supported LP solvers. Only this file needs to be recompiled
32 *   if the LP solver definitions change.
33 *
34 * \par
35 *   Currently the following definitions are supported:
36 *
37 * \par
38 *   For OSI:
39 *   ABACUS_LP_OSI.
40 *
41 * $Id: lpif.cc,v 2.9 2009-05-13 14:11:06 baumann Exp $
42 */
43 
44 #include <ogdf/lib/abacus/master.h>
45 #include <ogdf/lib/abacus/sub.h>
46 
47 #define ABACUS_LP_OSI
48 #ifdef ABACUS_LP_OSI
49 #include <ogdf/lib/abacus/lpmasterosi.h>
50 #include <ogdf/lib/abacus/lpsubosi.h>
51 #endif
52 
53 namespace abacus {
54 
55 //! The function Sub::generateLp().
56 
generateLp()57 LpSub *Sub::generateLp()
58 {
59 	switch (master_->defaultLpSolver()) {
60 #ifdef ABACUS_LP_OSI
61 	case Master::Cbc:
62 	case Master::Clp:
63 	case Master::CPLEX:
64 	case Master::DyLP:
65 	case Master::FortMP:
66 	case Master::GLPK:
67 	case Master::MOSEK:
68 	case Master::OSL:
69 	case Master::SoPlex:
70 	case Master::SYMPHONY:
71 	case Master::XPRESS_MP:
72 	case Master::Gurobi:
73 	case Master::Csdp:
74 		return new LpSubOsi(master_, this);
75 #endif
76 	default:
77 		Logger::ifout() << "Error: ABACUS library not compiled for\nselected LP-Solver " << Master::OSISOLVER_[master_->defaultLpSolver()] << "\n";
78 		OGDF_THROW_PARAM(AlgorithmFailureException, ogdf::AlgorithmFailureCode::LpIf);
79 	}
80 }
81 
82 
83 //! The function Master::_createLpMasters().
84 
_createLpMasters()85 void Master::_createLpMasters()
86 {
87 #ifdef ABACUS_LP_OSI
88 	lpMasterOsi_ = new LpMasterOsi(this);
89 #endif
90 }
91 
92 //! The function Master::_deleteLpMasters().
93 
_deleteLpMasters()94 void Master::_deleteLpMasters()
95 {
96 #ifdef ABACUS_LP_OSI
97 	delete lpMasterOsi_;
98 #endif
99 }
100 
101 //! The function Master::_initializeLpParameters().
102 
_initializeLpParameters()103 void Master::_initializeLpParameters()
104 {
105 #ifdef ABACUS_LP_OSI
106 	lpMasterOsi_->initializeLpParameters();
107 #endif
108 }
109 
110 //! The function Master::_setDefaultLpParameters().
111 
_setDefaultLpParameters()112 void Master::_setDefaultLpParameters()
113 {
114 #ifdef ABACUS_LP_OSI
115 	lpMasterOsi_->setDefaultLpParameters();
116 #endif
117 }
118 
119 //! The function Master::_printLpParameters().
120 
_printLpParameters() const121 void Master::_printLpParameters() const
122 {
123 #ifdef ABACUS_LP_OSI
124 	lpMasterOsi_->printLpParameters();
125 #endif
126 }
127 
128 //! The function Master::_outputLpStatistics().
129 
_outputLpStatistics() const130 void Master::_outputLpStatistics() const
131 {
132 #ifdef ABACUS_LP_OSI
133 	lpMasterOsi_->outputLpStatistics();
134 #endif
135 }
136 }
137