Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

coin.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 // IWYU pragma: always_keep
35 
36 #include <ogdf/basic/Logger.h>
37 
39 #include <coin/OsiSolverInterface.hpp> // IWYU pragma: export
40 // not used here but always necessary when using COIN
41 #include <coin/CoinPackedVector.hpp> // IWYU pragma: export
42 
43 namespace ogdf {
44 
47 public:
49 
52  static Logger CoinLog;
53 
55  static OsiSolverInterface* createCorrectOsiSolverInterface() {
56 #ifdef COIN_OSI_CPX
57  OsiCpxSolverInterface* ret = new OsiCpxSolverInterface(); // CPLEX
58 #elif defined(COIN_OSI_GRB)
59  OsiGrbSolverInterface* ret = new OsiGrbSolverInterface(); // Gurobi
60 #elif defined(COIN_OSI_SYM)
61  OsiSymSolverInterface* ret = new OsiSymSolverInterface(); // Symphony
62  ret->setSymParam(OsiSymVerbosity, -2);
63 #else // COIN_OSI_CLP
64  OsiClpSolverInterface* ret = new OsiClpSolverInterface(); // Coin-OR LP
65 #endif
66  updateLogging(ret);
67  return ret;
68  }
69 
71  static void updateLogging(OsiSolverInterface* osi) {
72  if (CoinLog.effectiveStatisticMode()) {
73  osi->messageHandler()->setLogLevel(0);
74  } else {
75  switch (CoinLog.effectiveLogLevel()) {
76  //- 0 - none
77  //- 1 - minimal
78  //- 2 - normal low
79  //- 3 - normal high
80  //- 4 - verbose
82  osi->messageHandler()->setLogLevel(4);
83  break;
85  osi->messageHandler()->setLogLevel(3);
86  break;
88  osi->messageHandler()->setLogLevel(2);
89  break;
91  osi->messageHandler()->setLogLevel(1);
92  break;
94  osi->messageHandler()->setLogLevel(0);
95  break;
97  osi->messageHandler()->setLogLevel(0);
98  break;
99  }
100  }
101  }
102 };
103 
104 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::Logger::effectiveLogLevel
Level effectiveLogLevel() const
obtain the effective log-level for the Logger-object (i.e., resolve the dependencies on the global se...
Definition: Logger.h:290
ogdf::CoinManager::CoinLog
static Logger CoinLog
The OGDF Logger which will determine the log level for a new instance returned by createCorrectOsiSol...
Definition: coin.h:52
ogdf::CoinManager::createCorrectOsiSolverInterface
static OsiSolverInterface * createCorrectOsiSolverInterface()
Get a new solver and set its initial log level according to the level of CoinLog.
Definition: coin.h:55
ogdf::Logger::Level::Force
@ Force
ogdf::Logger::Level::Minor
@ Minor
ogdf::Logger::Level::Default
@ Default
ogdf::CoinManager
If you use COIN-OR, you should use this class.
Definition: coin.h:46
ogdf::Logger::Level::Medium
@ Medium
ogdf::Logger::effectiveStatisticMode
bool effectiveStatisticMode() const
returns true if the Logger-object is effectively in statistic-mode (as this might be depending on the...
Definition: Logger.h:299
Logger.h
Contains logging functionality.
ogdf::CoinManager::updateLogging
static void updateLogging(OsiSolverInterface *osi)
Update the log level of the CoinMessageHandler associated with osi to match the log level of the ogdf...
Definition: coin.h:71
ogdf::Logger::Level::High
@ High
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::Logger
Centralized global and local logging facility working on streams like std::cout.
Definition: Logger.h:102
osiinclude.h
ogdf::Logger::Level::Alarm
@ Alarm