#include <cstdio>
#include <cassert>
#include <vector>
#include <list>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <algorithm>
#include <functional>
#include <string>
#include <map>
#include <climits>
#include <cmath>
#include <cstring>
#include <ctime>
#include <memory>
Go to the source code of this file.
Classes | |
struct | AddOffset< T > |
struct | Perturb |
class | UtilIsGreaterThan< S, T > |
class | UtilIsLessThan< S, T > |
Defines | |
#define | INT_MAX (static_cast<int>((~(static_cast<unsigned int>(0))) >> 1)) |
#define | round(x) floor(x+0.5) |
#define | UTIL_DELPTR(x) if(x) {delete x; x = 0;} |
#define | UTIL_DELARR(x) if(x) {delete [] x; x = 0;} |
#define | UTIL_DEBUG(param, level, x) if(param >= level) {x fflush(stdout);} |
#define | UTIL_MSG(param, level, x) if(param >= level) {x fflush(stdout);} |
#define | UtilAssert(expression, errorMsg, os) assert(expresssion) |
Enumerations | |
enum | UtilStatus { UtilStatusOk = 0, UtilStatusFileIO } |
Functions | |
void | UtilPrintParameter (std::ostream *os, const std::string §ion, const std::string &name, const int value) |
void | UtilPrintParameter (std::ostream *os, const std::string §ion, const std::string &name, const double value) |
void | UtilPrintParameter (std::ostream *os, const std::string §ion, const std::string &name, const std::string &value) |
template<class T > | |
void | UtilPrintVector (const std::vector< T > &v, std::ostream *os=&std::cout) |
template<class T > | |
void | UtilPrintVector (const std::vector< T > &v, const std::vector< std::string > &label, std::ostream *os=&std::cout) |
template<class T > | |
void | UtilPrintList (const std::list< T > &v, std::ostream *os=&std::cout) |
int | UtilNumEdgesU (const int n) |
int | UtilIndexU (const int i, const int j) |
std::pair< int, int > | UtilBothEndsU (const int index) |
void | UtilPrintEdge (const int index, std::ostream *os=&std::cout) |
std::string | UtilEdgeToStr (const int index) |
template<class T > | |
void | UtilFillN (T *to, const int size, const T value) |
template<class T > | |
void | UtilFillN (std::vector< T > &v, const int size, const T value) |
void | UtilIotaN (int *first, const int size, const int init) |
void | UtilIotaN (std::vector< int > &first, const int size, const int init) |
double | UtilURand (const double a, const double b) |
int | UtilURand (const int a, const int b) |
double | UtilNormRand (const double mean, const double sigma) |
double | UtilAve (const std::vector< double > &x) |
double | UtilAve (const std::vector< int > &x) |
double | UtilAve (const double *x, const int len) |
void | UtilStringTokenize (std::string const &input, std::string const &delimiters, std::vector< std::string > &tokens) |
std::string | UtilStringRandom (int iLength) |
std::string & | UtilStrTrim (std::string &s, const std::string &t=UtilSpaces) |
std::string & | UtilStrToLower (std::string &s) |
std::string & | UtilStrToUpper (std::string &s) |
template<class T > | |
int | UtilGetSize (const std::vector< T > &vec) |
bool | UtilIsInSet (const int value, const int *set, const int setSize) |
int | UtilNumNonzeros (const double *x, const int len, const double etol=1.0e-8) |
double | UtilFracPart (const double x) |
int | UtilScaleDblToIntArr (const int arrLen, const double *arrDbl, int *arrInt, const double oneDbl, int *oneInt, const double epstol=UtilEpsilon) |
int | UtilScaleDblToIntArr (const int arrLen, const double *arrDbl, int *arrInt, const double epstol=UtilEpsilon) |
bool | UtilIsZero (const double x, const double etol=1.0e-8) |
std::string | UtilIntToStr (const int i) |
std::string | UtilDblToStr (const double x, const int precision=-1, const double tooBig=UtilSmallerThanTooBig) |
void | UtilPrintMemUsage (std::ostream *os=&std::cout, int logLevel=0, int logLimit=2) |
template<class T > | |
void | UtilDeleteVectorPtr (std::vector< T * > &vectorPtr, typename std::vector< T * >::iterator first, typename std::vector< T * >::iterator last) |
template<class T > | |
void | UtilDeleteVectorPtr (std::vector< T * > &vectorPtr) |
template<class T > | |
void | UtilDeleteListPtr (std::list< T * > &listPtr, typename std::list< T * >::iterator first, typename std::list< T * >::iterator last) |
template<class T > | |
void | UtilDeleteListPtr (std::list< T * > &listPtr) |
template<class S , class T > | |
void | UtilDeleteMapPtr (std::map< S, T * > &mapPtr, typename std::map< S, T * >::iterator first, typename std::map< S, T * >::iterator last) |
template<class S , class T > | |
void | UtilDeleteMapPtr (std::map< S, T * > &mapPtr) |
template<class S , class T > | |
void | UtilDeleteMapVecPtr (std::map< S, std::vector< T * > > &mapPtr, typename std::map< S, std::vector< T * > >::iterator first, typename std::map< S, std::vector< T * > >::iterator last) |
template<class S , class T > | |
void | UtilDeleteMapVecPtr (std::map< S, std::vector< T * > > &mapPtr) |
bool | UtilIsIntegral (const double x, const double etol=1.0e-10) |
bool | UtilIsIntegral (const double *x, const int len, const double etol=1.0e-10) |
template<class T > | |
void | UtilNegateArr (const int arrLen, T *arr) |
template<class T > | |
void | UtilAddOffsetArr (const int arrLen, T offset, T *arr) |
void | UtilPerturbCost (const int seed, const int arrLen, const double randLB, const double randUB, double *arr) |
void | UtilFlipRowLtoG (const int len, double *els, char &sense, double &rhs) |
void | UtilBoundToSense (const double lb, const double ub, const double inf, char &sense, double &rhs, double &range) |
void | UtilSenseToBound (const char sense, const double rhs, const double range, const double inf, double &lb, double &ub) |
std::string | UtilDirSlash () |
int | UtilOpenFile (std::ofstream &os, const char *fileName) |
int | UtilOpenFile (std::ifstream &is, const char *fileName) |
int | UtilOpenFile (std::ofstream &os, const std::string &fileName) |
int | UtilOpenFile (std::ifstream &is, const std::string &fileName) |
Variables | |
const std::string | UtilSpaces = " \t\r\n" |
const double | UtilEpsilon = 1.0e-6 |
const double | UtilTooBig = 1.0e20 |
const double | UtilSmallerThanTooBig = 1.0e19 |
#define INT_MAX (static_cast<int>((~(static_cast<unsigned int>(0))) >> 1)) |
Definition at line 45 of file UtilMacros.h.
Referenced by AlpsKnowledgePool::getMaxNumKnowledges().
#define round | ( | x | ) | floor(x+0.5) |
Definition at line 49 of file UtilMacros.h.
#define UTIL_DELPTR | ( | x | ) | if(x) {delete x; x = 0;} |
Definition at line 65 of file UtilMacros.h.
#define UTIL_DELARR | ( | x | ) | if(x) {delete [] x; x = 0;} |
Definition at line 66 of file UtilMacros.h.
#define UTIL_DEBUG | ( | param, | |||
level, | |||||
x | ) | if(param >= level) {x fflush(stdout);} |
Definition at line 76 of file UtilMacros.h.
#define UTIL_MSG | ( | param, | |||
level, | |||||
x | ) | if(param >= level) {x fflush(stdout);} |
Definition at line 80 of file UtilMacros.h.
Referenced by DecompAlgoD::setObjBoundIP(), and DecompAlgo::setObjBoundIP().
#define UtilAssert | ( | expression, | |||
errorMsg, | |||||
os | ) | assert(expresssion) |
Definition at line 85 of file UtilMacros.h.
enum UtilStatus |
Definition at line 57 of file UtilMacros.h.
void UtilPrintParameter | ( | std::ostream * | os, | |
const std::string & | section, | |||
const std::string & | name, | |||
const int | value | |||
) | [inline] |
Definition at line 102 of file UtilMacros.h.
Referenced by DecompParam::dumpSettings().
void UtilPrintParameter | ( | std::ostream * | os, | |
const std::string & | section, | |||
const std::string & | name, | |||
const double | value | |||
) | [inline] |
Definition at line 113 of file UtilMacros.h.
void UtilPrintParameter | ( | std::ostream * | os, | |
const std::string & | section, | |||
const std::string & | name, | |||
const std::string & | value | |||
) | [inline] |
Definition at line 124 of file UtilMacros.h.
void UtilPrintVector | ( | const std::vector< T > & | v, | |
std::ostream * | os = &std::cout | |||
) | [inline] |
Definition at line 137 of file UtilMacros.h.
void UtilPrintVector | ( | const std::vector< T > & | v, | |
const std::vector< std::string > & | label, | |||
std::ostream * | os = &std::cout | |||
) | [inline] |
Definition at line 151 of file UtilMacros.h.
void UtilPrintList | ( | const std::list< T > & | v, | |
std::ostream * | os = &std::cout | |||
) | [inline] |
Definition at line 165 of file UtilMacros.h.
int UtilNumEdgesU | ( | const int | n | ) | [inline] |
Definition at line 223 of file UtilMacros.h.
int UtilIndexU | ( | const int | i, | |
const int | j | |||
) | [inline] |
Definition at line 229 of file UtilMacros.h.
std::pair<int, int> UtilBothEndsU | ( | const int | index | ) |
void UtilPrintEdge | ( | const int | index, | |
std::ostream * | os = &std::cout | |||
) | [inline] |
Definition at line 238 of file UtilMacros.h.
References UtilBothEndsU().
std::string UtilEdgeToStr | ( | const int | index | ) | [inline] |
Definition at line 247 of file UtilMacros.h.
References UtilBothEndsU().
Referenced by VRP_Concorde::setExpandedCost().
void UtilFillN | ( | T * | to, | |
const int | size, | |||
const T | value | |||
) | [inline] |
Definition at line 262 of file UtilMacros.h.
void UtilFillN | ( | std::vector< T > & | v, | |
const int | size, | |||
const T | value | |||
) | [inline] |
Definition at line 273 of file UtilMacros.h.
void UtilIotaN | ( | int * | first, | |
const int | size, | |||
const int | init | |||
) | [inline] |
Definition at line 279 of file UtilMacros.h.
void UtilIotaN | ( | std::vector< int > & | first, | |
const int | size, | |||
const int | init | |||
) | [inline] |
Definition at line 292 of file UtilMacros.h.
double UtilURand | ( | const double | a, | |
const double | b | |||
) | [inline] |
Definition at line 309 of file UtilMacros.h.
int UtilURand | ( | const int | a, | |
const int | b | |||
) | [inline] |
Definition at line 316 of file UtilMacros.h.
double UtilNormRand | ( | const double | mean, | |
const double | sigma | |||
) | [inline] |
Definition at line 323 of file UtilMacros.h.
double UtilAve | ( | const std::vector< double > & | x | ) | [inline] |
Definition at line 339 of file UtilMacros.h.
double UtilAve | ( | const std::vector< int > & | x | ) | [inline] |
Definition at line 346 of file UtilMacros.h.
double UtilAve | ( | const double * | x, | |
const int | len | |||
) | [inline] |
Definition at line 353 of file UtilMacros.h.
void UtilStringTokenize | ( | std::string const & | input, | |
std::string const & | delimiters, | |||
std::vector< std::string > & | tokens | |||
) | [inline] |
Definition at line 364 of file UtilMacros.h.
std::string UtilStringRandom | ( | int | iLength | ) | [inline] |
Definition at line 385 of file UtilMacros.h.
References srand.
Referenced by VRP_Concorde::solveTSP().
std::string& UtilStrTrim | ( | std::string & | s, | |
const std::string & | t = UtilSpaces | |||
) | [inline] |
Definition at line 415 of file UtilMacros.h.
std::string& UtilStrToLower | ( | std::string & | s | ) | [inline] |
Definition at line 440 of file UtilMacros.h.
std::string& UtilStrToUpper | ( | std::string & | s | ) | [inline] |
Definition at line 459 of file UtilMacros.h.
int UtilGetSize | ( | const std::vector< T > & | vec | ) | [inline] |
Definition at line 481 of file UtilMacros.h.
bool UtilIsInSet | ( | const int | value, | |
const int * | set, | |||
const int | setSize | |||
) | [inline] |
Definition at line 487 of file UtilMacros.h.
int UtilNumNonzeros | ( | const double * | x, | |
const int | len, | |||
const double | etol = 1.0e-8 | |||
) | [inline] |
Definition at line 505 of file UtilMacros.h.
double UtilFracPart | ( | const double | x | ) | [inline] |
Definition at line 522 of file UtilMacros.h.
References UtilEpsilon.
int UtilScaleDblToIntArr | ( | const int | arrLen, | |
const double * | arrDbl, | |||
int * | arrInt, | |||
const double | oneDbl, | |||
int * | oneInt, | |||
const double | epstol = UtilEpsilon | |||
) |
int UtilScaleDblToIntArr | ( | const int | arrLen, | |
const double * | arrDbl, | |||
int * | arrInt, | |||
const double | epstol = UtilEpsilon | |||
) |
bool UtilIsZero | ( | const double | x, | |
const double | etol = 1.0e-8 | |||
) | [inline] |
Definition at line 549 of file UtilMacros.h.
std::string UtilIntToStr | ( | const int | i | ) | [inline] |
Definition at line 556 of file UtilMacros.h.
std::string UtilDblToStr | ( | const double | x, | |
const int | precision = -1 , |
|||
const double | tooBig = UtilSmallerThanTooBig | |||
) | [inline] |
Definition at line 564 of file UtilMacros.h.
Referenced by DecompAlgo::isGapTight(), DecompAlgoD::setObjBoundIP(), DecompAlgo::setObjBoundIP(), and UtilPrintMemUsage().
void UtilPrintMemUsage | ( | std::ostream * | os = &std::cout , |
|
int | logLevel = 0 , |
|||
int | logLimit = 2 | |||
) | [inline] |
Definition at line 589 of file UtilMacros.h.
References UtilDblToStr().
void UtilDeleteVectorPtr | ( | std::vector< T * > & | vectorPtr, | |
typename std::vector< T * >::iterator | first, | |||
typename std::vector< T * >::iterator | last | |||
) | [inline] |
Definition at line 611 of file UtilMacros.h.
void UtilDeleteVectorPtr | ( | std::vector< T * > & | vectorPtr | ) | [inline] |
Definition at line 625 of file UtilMacros.h.
References UtilDeleteVectorPtr().
void UtilDeleteListPtr | ( | std::list< T * > & | listPtr, | |
typename std::list< T * >::iterator | first, | |||
typename std::list< T * >::iterator | last | |||
) | [inline] |
Definition at line 631 of file UtilMacros.h.
void UtilDeleteListPtr | ( | std::list< T * > & | listPtr | ) | [inline] |
Definition at line 645 of file UtilMacros.h.
References UtilDeleteListPtr().
void UtilDeleteMapPtr | ( | std::map< S, T * > & | mapPtr, | |
typename std::map< S, T * >::iterator | first, | |||
typename std::map< S, T * >::iterator | last | |||
) | [inline] |
Definition at line 652 of file UtilMacros.h.
Referenced by UtilDeleteMapPtr(), DecompApp::~DecompApp(), GAP_DecompApp::~GAP_DecompApp(), and MMKP_Model::~MMKP_Model().
void UtilDeleteMapPtr | ( | std::map< S, T * > & | mapPtr | ) | [inline] |
Definition at line 666 of file UtilMacros.h.
References UtilDeleteMapPtr().
void UtilDeleteMapVecPtr | ( | std::map< S, std::vector< T * > > & | mapPtr, | |
typename std::map< S, std::vector< T * > >::iterator | first, | |||
typename std::map< S, std::vector< T * > >::iterator | last | |||
) | [inline] |
Definition at line 673 of file UtilMacros.h.
References UtilDeleteVectorPtr().
Referenced by UtilDeleteMapVecPtr().
void UtilDeleteMapVecPtr | ( | std::map< S, std::vector< T * > > & | mapPtr | ) | [inline] |
Definition at line 688 of file UtilMacros.h.
References UtilDeleteMapVecPtr().
bool UtilIsIntegral | ( | const double | x, | |
const double | etol = 1.0e-10 | |||
) | [inline] |
Definition at line 694 of file UtilMacros.h.
References UtilIsZero().
bool UtilIsIntegral | ( | const double * | x, | |
const int | len, | |||
const double | etol = 1.0e-10 | |||
) | [inline] |
Definition at line 701 of file UtilMacros.h.
References UtilIsIntegral().
void UtilNegateArr | ( | const int | arrLen, | |
T * | arr | |||
) | [inline] |
Definition at line 717 of file UtilMacros.h.
void UtilAddOffsetArr | ( | const int | arrLen, | |
T | offset, | |||
T * | arr | |||
) | [inline] |
Definition at line 734 of file UtilMacros.h.
void UtilPerturbCost | ( | const int | seed, | |
const int | arrLen, | |||
const double | randLB, | |||
const double | randUB, | |||
double * | arr | |||
) | [inline] |
Definition at line 753 of file UtilMacros.h.
References srand.
void UtilFlipRowLtoG | ( | const int | len, | |
double * | els, | |||
char & | sense, | |||
double & | rhs | |||
) | [inline] |
Definition at line 764 of file UtilMacros.h.
void UtilBoundToSense | ( | const double | lb, | |
const double | ub, | |||
const double | inf, | |||
char & | sense, | |||
double & | rhs, | |||
double & | range | |||
) | [inline] |
Definition at line 786 of file UtilMacros.h.
References UtilIsZero().
void UtilSenseToBound | ( | const char | sense, | |
const double | rhs, | |||
const double | range, | |||
const double | inf, | |||
double & | lb, | |||
double & | ub | |||
) | [inline] |
Definition at line 821 of file UtilMacros.h.
std::string UtilDirSlash | ( | ) | [inline] |
Definition at line 871 of file UtilMacros.h.
int UtilOpenFile | ( | std::ofstream & | os, | |
const char * | fileName | |||
) | [inline] |
Definition at line 883 of file UtilMacros.h.
References UtilStatusFileIO, and UtilStatusOk.
int UtilOpenFile | ( | std::ifstream & | is, | |
const char * | fileName | |||
) | [inline] |
Definition at line 903 of file UtilMacros.h.
References UtilStatusFileIO, and UtilStatusOk.
int UtilOpenFile | ( | std::ofstream & | os, | |
const std::string & | fileName | |||
) | [inline] |
Definition at line 923 of file UtilMacros.h.
References UtilOpenFile().
int UtilOpenFile | ( | std::ifstream & | is, | |
const std::string & | fileName | |||
) | [inline] |
Definition at line 930 of file UtilMacros.h.
References UtilOpenFile().
const std::string UtilSpaces = " \t\r\n" |
Definition at line 40 of file UtilMacros.h.
const double UtilEpsilon = 1.0e-6 |
Definition at line 41 of file UtilMacros.h.
const double UtilTooBig = 1.0e20 |
Definition at line 42 of file UtilMacros.h.
const double UtilSmallerThanTooBig = 1.0e19 |
Definition at line 43 of file UtilMacros.h.