NOMAD Source  Version 4.0.0 Beta
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
defines.hpp
Go to the documentation of this file.
1 /**
2  \file defines.hpp
3  \brief Definitions
4  \author Sebastien Le Digabel, modified by Viviane Rochon Montplaisir
5  \date March 2017
6  */
7 #ifndef __NOMAD400_DEFINES__
8 #define __NOMAD400_DEFINES__
9 
10 #include <string>
11 #include <iostream>
12 #include <sstream>
13 #include <limits>
14 #include <limits.h>
15 #include <cstdlib>
16 #include <memory> // For shared_ptr, unique_ptr
17 
18 
19 // Define in order to display debug information
20 //#define DEBUG
21 
22 
23 // CASE Linux using gnu compiler
24 #ifdef __gnu_linux__
25 #define GCC_X
26 #endif
27 
28 // CASE OSX using gnu compiler
29 #ifdef __APPLE__
30 #ifdef __GNUC__
31 #define GCC_X
32 #endif
33 #endif
34 
35 // CASE Visual Studio C++ compiler
36 #ifdef _MSC_VER
37 #define WINDOWS
38 #pragma warning(disable:4996)
39 #endif
40 
41 // For NOMAD random number generator
42 #if !defined(UINT32_MAX)
43 typedef unsigned int uint32_t;
44 #define UINT32_MAX 0xffffffff
45 #endif
46 
47 #include "../nomad_nsbegin.hpp"
48 
49 // Directory separator
50 #ifdef WINDOWS
51 const char DIR_SEP = '\\'; ///< Directory separator
52 #else
53 const char DIR_SEP = '/'; ///< Directory separator
54 #endif
55 
56 /// Maximum number of variables.
57 const int MAX_DIMENSION = 1000;
58 
59 /// Default epsilon used by Double
60 /** Use Parameters::set_EPSILON(), or parameter EPSILON,
61  or Double::setEpsilon() to change it
62  */
63 const double DEFAULT_EPSILON = 1e-13;
64 
65 /// Default infinity string used by Double
66 /** Use Parameters::set_INF_STR(), or parameter INF_STR,
67  or Double::setInfStr() to change it
68  */
69 const std::string DEFAULT_INF_STR = "inf";
70 
71 /// Default undefined value string used by Double
72 /** Use Parameters::set_UNDEF_STR(), or parameter UNDEF_STR,
73  or Double::set_undefStr() to change it
74  */
75 const std::string DEFAULT_UNDEF_STR = "NaN";
76 // Other strings recognized as NaN
77 const std::string DEFAULT_UNDEF_STR_HYPHEN = "-";
78 const std::string DEFAULT_UNDEF_STR_1 = "nan";
79 
80 const double INF = std::numeric_limits<double>::max(); ///< Infinity
81 const double NaN = std::numeric_limits<double>::quiet_NaN(); ///< Quiet Not-A-Number
82 const int P_INF_INT = std::numeric_limits<int>::max(); ///< plus infinity for int
83 const int M_INF_INT = std::numeric_limits<int>::min(); ///< minus infinity for int
84 const size_t INF_SIZE_T = std::numeric_limits<size_t>::max();///< The infinity for \c size_t
85 
86 const double D_INT_MAX = UINT32_MAX; ///< The UINT32_MAX constant as a \c double
87 
88 
89 // Display precisions.
90 const int DISPLAY_PRECISION_STD = 6; ///< Precision after decimal point (number of digits)
91 const int DISPLAY_PRECISION_FULL = 20; ///< Display all decimals
92 const int NB_DIGITS_BEFORE_POINT = 3; // "Precision" before decimal point
93 const int INT_DISPLAY_WIDTH = 3; // Width for integers
94 
95 // Singular Value Decomposition (SVD) constants:
96 const double SVD_EPS = 1e-13; ///< Epsilon for SVD
97 const int SVD_MAX_MPN = 1500; ///< Matrix maximal size (\c m+n )
98 const double SVD_MAX_COND = INF; ///< Max. acceptable cond. number
99 
100 
101 // -------------------------
102 // Related to MADS algorithm
103 // -------------------------
104 
105 /// Success type of an iteration.
106 // Order is important.
107 enum class SuccessType
108 {
109  NOT_EVALUATED, ///< Not evaluated yet
110  UNSUCCESSFUL, ///< Failure
111  PARTIAL_SUCCESS, ///< Partial success (improving). Found an infeasible
112  ///< solution with a better h. f is worse.
113  FULL_SUCCESS ///< Full success (dominating)
114 };
115 
116 
117 #include "../nomad_nsend.hpp"
118 
119 #endif
const double NaN
Quiet Not-A-Number.
Definition: defines.hpp:81
Not evaluated yet.
solution with a better h. f is worse.
const double INF
Infinity.
Definition: defines.hpp:80
const int INT_DISPLAY_WIDTH
Definition: defines.hpp:93
Double min(const Double d1, const Double d2)
Smallest of two values &gt;=.
Definition: Double.hpp:592
unsigned int uint32_t
Definition: defines.hpp:43
SuccessType
Success type of an iteration.
Definition: defines.hpp:107
const int M_INF_INT
minus infinity for int
Definition: defines.hpp:83
const std::string DEFAULT_UNDEF_STR
Default undefined value string used by Double.
Definition: defines.hpp:75
Full success (dominating)
const int NB_DIGITS_BEFORE_POINT
Definition: defines.hpp:92
const char DIR_SEP
Directory separator.
Definition: defines.hpp:53
const std::string DEFAULT_UNDEF_STR_HYPHEN
Definition: defines.hpp:77
const int DISPLAY_PRECISION_FULL
Display all decimals.
Definition: defines.hpp:91
#define UINT32_MAX
Definition: defines.hpp:44
const double SVD_MAX_COND
Max. acceptable cond. number.
Definition: defines.hpp:98
const std::string DEFAULT_UNDEF_STR_1
Definition: defines.hpp:78
const double D_INT_MAX
The UINT32_MAX constant as a double.
Definition: defines.hpp:86
const int P_INF_INT
plus infinity for int
Definition: defines.hpp:82
const int MAX_DIMENSION
Maximum number of variables.
Definition: defines.hpp:57
Double max(const Double d1, const Double d2)
Largest of two values &gt;=.
Definition: Double.hpp:583
const int DISPLAY_PRECISION_STD
Precision after decimal point (number of digits)
Definition: defines.hpp:90
const double SVD_EPS
Epsilon for SVD.
Definition: defines.hpp:96
const std::string DEFAULT_INF_STR
Default infinity string used by Double.
Definition: defines.hpp:69
const double DEFAULT_EPSILON
Default epsilon used by Double.
Definition: defines.hpp:63
const int SVD_MAX_MPN
Matrix maximal size (m+n )
Definition: defines.hpp:97
const size_t INF_SIZE_T
The infinity for size_t.
Definition: defines.hpp:84