MAiNGO
utilities.h
Go to the documentation of this file.
1 /**********************************************************************************
2  * Copyright (c) 2019 Process Systems Engineering (AVT.SVT), RWTH Aachen University
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License 2.0 which is available at
6  * http://www.eclipse.org/legal/epl-2.0.
7  *
8  * SPDX-License-Identifier: EPL-2.0
9  *
10  **********************************************************************************/
11 
12 #pragma once
13 
14 #include "settings.h"
15 
16 #include <cmath>
17 #include <string>
18 
19 
20 namespace maingo {
21 
22 
32 inline bool
33 larger_or_equal_within_tolerance(const double LBD, const double UBD, Settings* mySettings)
34 {
35 
36  bool absDone = (LBD >= (UBD - mySettings->epsilonA)); // Done means that absolute criterion is met
37  bool relDone = (LBD >= (UBD - std::fabs(UBD) * mySettings->epsilonR)); // Done means that relative criterion is met
38  return (absDone || relDone); // If either criterion is met we are done
39 }
40 
48 inline std::string
50 {
51  return "v0.4.0 ";
52 }
53 
54 
55 } // end namespace maingo
Struct for storing settings for MAiNGO.
Definition: settings.h:125
bool larger_or_equal_within_tolerance(const double LBD, const double UBD, Settings *mySettings)
Function for checking if LBD is larger than UBD, or smaller by not more than the specified tolerance ...
Definition: utilities.h:33
namespace holding all essentials of MAiNGO
Definition: aleModel.h:25
double epsilonA
Absolute optimality tolerance, i.e., termination when (UBD-LBD) < BAB_epsilon_a.
Definition: settings.h:131
std::string print_version()
Function printing the current version number.
Definition: utilities.h:49
double epsilonR
Relative optimality tolerance, i.e., termination when (UBD-LBD) < BAB_epsilon_r * UBD...
Definition: settings.h:132