Dip
0.92.4
|
#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 > |
Macros | |
#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 44 of file UtilMacros.h.
Referenced by AlpsKnowledgePool::getMaxNumKnowledges().
#define round | ( | x | ) | floor(x+0.5) |
Definition at line 48 of file UtilMacros.h.
#define UTIL_DELPTR | ( | x | ) | if(x) {delete x; x = 0;} |
Definition at line 64 of file UtilMacros.h.
#define UTIL_DELARR | ( | x | ) | if(x) {delete [] x; x = 0;} |
Definition at line 65 of file UtilMacros.h.
#define UTIL_DEBUG | ( | param, | |
level, | |||
x | |||
) | if(param >= level) {x fflush(stdout);} |
Definition at line 75 of file UtilMacros.h.
#define UTIL_MSG | ( | param, | |
level, | |||
x | |||
) | if(param >= level) {x fflush(stdout);} |
Definition at line 79 of file UtilMacros.h.
Referenced by DecompAlgoD::setObjBoundIP(), and DecompAlgo::setObjBoundIP().
#define UtilAssert | ( | expression, | |
errorMsg, | |||
os | |||
) | assert(expresssion) |
Definition at line 84 of file UtilMacros.h.
enum UtilStatus |
Enumerator | |
---|---|
UtilStatusOk | |
UtilStatusFileIO |
Definition at line 56 of file UtilMacros.h.
|
inline |
Definition at line 101 of file UtilMacros.h.
Referenced by DecompParam::dumpSettings().
|
inline |
Definition at line 112 of file UtilMacros.h.
|
inline |
Definition at line 123 of file UtilMacros.h.
|
inline |
Definition at line 136 of file UtilMacros.h.
|
inline |
Definition at line 150 of file UtilMacros.h.
|
inline |
Definition at line 164 of file UtilMacros.h.
|
inline |
Definition at line 222 of file UtilMacros.h.
|
inline |
Definition at line 228 of file UtilMacros.h.
std::pair<int, int> UtilBothEndsU | ( | const int | index | ) |
|
inline |
Definition at line 237 of file UtilMacros.h.
References UtilBothEndsU().
|
inline |
Definition at line 246 of file UtilMacros.h.
References UtilBothEndsU().
Referenced by VRP_Concorde::setExpandedCost().
|
inline |
Definition at line 261 of file UtilMacros.h.
|
inline |
Definition at line 272 of file UtilMacros.h.
|
inline |
Definition at line 278 of file UtilMacros.h.
|
inline |
Definition at line 291 of file UtilMacros.h.
|
inline |
Definition at line 308 of file UtilMacros.h.
|
inline |
Definition at line 315 of file UtilMacros.h.
|
inline |
Definition at line 322 of file UtilMacros.h.
|
inline |
Definition at line 338 of file UtilMacros.h.
|
inline |
Definition at line 345 of file UtilMacros.h.
|
inline |
Definition at line 352 of file UtilMacros.h.
|
inline |
Definition at line 363 of file UtilMacros.h.
|
inline |
Definition at line 384 of file UtilMacros.h.
References srand.
Referenced by VRP_Concorde::solveTSP().
|
inline |
Definition at line 414 of file UtilMacros.h.
|
inline |
Definition at line 439 of file UtilMacros.h.
|
inline |
Definition at line 458 of file UtilMacros.h.
|
inline |
Definition at line 480 of file UtilMacros.h.
|
inline |
Definition at line 486 of file UtilMacros.h.
|
inline |
Definition at line 504 of file UtilMacros.h.
|
inline |
Definition at line 521 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 |
||
) |
|
inline |
Definition at line 548 of file UtilMacros.h.
|
inline |
Definition at line 555 of file UtilMacros.h.
|
inline |
Definition at line 563 of file UtilMacros.h.
Referenced by DecompAlgo::isGapTight(), DecompAlgoD::setObjBoundIP(), DecompAlgo::setObjBoundIP(), and UtilPrintMemUsage().
|
inline |
Definition at line 588 of file UtilMacros.h.
References UtilDblToStr().
void UtilDeleteVectorPtr | ( | std::vector< T * > & | vectorPtr, |
typename std::vector< T * >::iterator | first, | ||
typename std::vector< T * >::iterator | last | ||
) |
Definition at line 610 of file UtilMacros.h.
void UtilDeleteVectorPtr | ( | std::vector< T * > & | vectorPtr | ) |
Definition at line 624 of file UtilMacros.h.
References UtilDeleteVectorPtr().
void UtilDeleteListPtr | ( | std::list< T * > & | listPtr, |
typename std::list< T * >::iterator | first, | ||
typename std::list< T * >::iterator | last | ||
) |
Definition at line 630 of file UtilMacros.h.
void UtilDeleteListPtr | ( | std::list< T * > & | listPtr | ) |
Definition at line 644 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 | ||
) |
Definition at line 651 of file UtilMacros.h.
Referenced by UtilDeleteMapPtr(), DecompApp::~DecompApp(), GAP_DecompApp::~GAP_DecompApp(), MILPBlock_DecompApp::~MILPBlock_DecompApp(), and MMKP_Model::~MMKP_Model().
void UtilDeleteMapPtr | ( | std::map< S, T * > & | mapPtr | ) |
Definition at line 665 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 | ||
) |
Definition at line 672 of file UtilMacros.h.
References UtilDeleteVectorPtr().
Referenced by UtilDeleteMapVecPtr().
void UtilDeleteMapVecPtr | ( | std::map< S, std::vector< T * > > & | mapPtr | ) |
Definition at line 687 of file UtilMacros.h.
References UtilDeleteMapVecPtr().
|
inline |
Definition at line 693 of file UtilMacros.h.
References UtilIsZero().
|
inline |
Definition at line 700 of file UtilMacros.h.
References UtilIsIntegral().
|
inline |
Definition at line 716 of file UtilMacros.h.
|
inline |
Definition at line 733 of file UtilMacros.h.
|
inline |
Definition at line 752 of file UtilMacros.h.
References srand.
|
inline |
Definition at line 763 of file UtilMacros.h.
|
inline |
Definition at line 785 of file UtilMacros.h.
References UtilIsZero().
|
inline |
Definition at line 820 of file UtilMacros.h.
|
inline |
Definition at line 870 of file UtilMacros.h.
|
inline |
Definition at line 882 of file UtilMacros.h.
References UtilStatusFileIO, and UtilStatusOk.
|
inline |
Definition at line 902 of file UtilMacros.h.
References UtilStatusFileIO, and UtilStatusOk.
|
inline |
Definition at line 922 of file UtilMacros.h.
References UtilOpenFile().
|
inline |
Definition at line 929 of file UtilMacros.h.
References UtilOpenFile().
const std::string UtilSpaces = " \t\r\n" |
Definition at line 39 of file UtilMacros.h.
const double UtilEpsilon = 1.0e-6 |
Definition at line 40 of file UtilMacros.h.
const double UtilTooBig = 1.0e20 |
Definition at line 41 of file UtilMacros.h.
const double UtilSmallerThanTooBig = 1.0e19 |
Definition at line 42 of file UtilMacros.h.