Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

coin.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Logger.h>
35 
37 #include <coin/CoinPackedVector.hpp> // not used here but always necessary when using COIN
38 
39 namespace ogdf {
40 
43 public:
45 
48  static Logger CoinLog;
49 
51  static OsiSolverInterface* createCorrectOsiSolverInterface() {
52 #ifdef COIN_OSI_CPX
53  OsiCpxSolverInterface* ret = new OsiCpxSolverInterface(); // CPLEX
54 #elif defined(COIN_OSI_GRB)
55  OsiGrbSolverInterface* ret = new OsiGrbSolverInterface(); // Gurobi
56 #elif defined(COIN_OSI_SYM)
57  OsiSymSolverInterface* ret = new OsiSymSolverInterface(); // Symphony
58  ret->setSymParam(OsiSymVerbosity, -2);
59 #else // COIN_OSI_CLP
60  OsiClpSolverInterface* ret = new OsiClpSolverInterface(); // Coin-OR LP
61 #endif
62  updateLogging(ret);
63  return ret;
64  }
65 
67  static void updateLogging(OsiSolverInterface* osi) {
68  if (CoinLog.effectiveStatisticMode()) {
69  osi->messageHandler()->setLogLevel(0);
70  } else {
71  switch (CoinLog.effectiveLogLevel()) {
72  //- 0 - none
73  //- 1 - minimal
74  //- 2 - normal low
75  //- 3 - normal high
76  //- 4 - verbose
78  osi->messageHandler()->setLogLevel(4);
79  break;
81  osi->messageHandler()->setLogLevel(3);
82  break;
84  osi->messageHandler()->setLogLevel(2);
85  break;
87  osi->messageHandler()->setLogLevel(1);
88  break;
90  osi->messageHandler()->setLogLevel(0);
91  break;
93  osi->messageHandler()->setLogLevel(0);
94  break;
95  }
96  }
97  }
98 };
99 
100 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
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:288
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:48
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:51
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:42
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:297
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:67
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:100
osiinclude.h
ogdf::Logger::Level::Alarm
@ Alarm