Commit 1c271d5e authored by Antonio Frangioni's avatar Antonio Frangioni 🤖

still some std:: missing

and #include<algorithm>, too; thanks to VS for being much stricter than g++ in wanting the right stuff there
parent 4d17116c
......@@ -64,6 +64,8 @@
#include "MPSolver.h"
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*----------------------------- NAMESPACE ----------------------------------*/
/*--------------------------------------------------------------------------*/
......
......@@ -46,6 +46,8 @@
#include "OPTvect.h"
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*-------------------------------- MACROS ----------------------------------*/
/*--------------------------------------------------------------------------*/
......
......@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <cmath>
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*-------------------------------- USING -----------------------------------*/
......
......@@ -8,15 +8,14 @@
* methods to the respective methods of Master and Slave, assuming that
* Master is a "correct" MPSolver and Slave is an "uncertain" MPSolver. The
* MPTester behavior is equivalent to Master behavior, but checks are done
* to signal if Slave's behaviour deviates from Naster's.
* to signal if Slave's behaviour deviates from Master's.
*
* \version 1.00
*
* \date 25 - 01 - 2019
*
* \author Luigi Poderico \n
* http:\\poderico.supereva.it
* Universidade do Minho \n
* http:\\poderico.supereva.it \n
*
* \author Antonio Frangioni \n
* Operations Research Group \n
......@@ -37,6 +36,8 @@
/*--------------------------------------------------------------------------*/
#include "MPSolver.h"
#include <algorithm>
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*------------------------------- MACROS -----------------------------------*/
......@@ -552,9 +553,9 @@ class MPTester : public MPSolver
testAssert(this->CompareInt(master, slave));
/*
assert((this->CompareDouble(Ai, slaveAi)) ||
(this->CompareDouble(Ai, slaveAi, max(fabs(ScPri), fabs(slaveScPri)))) );
(this->CompareDouble(Ai, slaveAi, std::max(std::abs(ScPri), std::abs(slaveScPri)))) );
*/
testAssert(this->CompareDouble(Ai, slaveAi, max(fabs(Ai), fabs(slaveAi)), "CheckSubG Ai"));
testAssert(this->CompareDouble(Ai, slaveAi, std::max(std::abs(Ai), std::abs(slaveAi)), "CheckSubG Ai"));
testAssert(this->CompareDouble(ScPri, slaveScPri, "CheckSubG ScPri"));
return( master );
}
......@@ -706,26 +707,26 @@ class MPTester : public MPSolver
static void LogFailure(const char* anAxpresion, const char* aFileName, int aLineNumber)
{
cout << endl << "LogFailure. " << anAxpresion << " at " << aFileName << ":" << aLineNumber;
cout << std::endl << "LogFailure. " << anAxpresion << " at " << aFileName << ":" << aLineNumber;
}
bool CompareDouble(double master, double slave, const char* const nomeChiamante)
{
const double kMinPrecision = 1e-6;
if ((fabs(master)<kMinPrecision) &&
(fabs(slave)<kMinPrecision))
if ((std::abs(master)<kMinPrecision) &&
(std::abs(slave)<kMinPrecision))
return true;
if (fabs(master-slave) <kMinPrecision * max(fabs(master), fabs(slave)) )
if (std::abs(master-slave) <kMinPrecision * std::max(std::abs(master), std::abs(slave)) )
return true;
const double kNorm = max(fabs(master), fabs(slave));
if (fabs(master/kNorm - slave /kNorm) <kMinPrecision )
const double kNorm = std::max(std::abs(master), std::abs(slave));
if (std::abs(master/kNorm - slave /kNorm) <kMinPrecision )
return true;
if (*nomeChiamante!=0)
cout << endl << "CompareDouble: " << nomeChiamante << ", " << master << ", " << slave << endl;
cout << std::endl << "CompareDouble: " << nomeChiamante << ", " << master << ", " << slave << std::endl;
return false;
}
......@@ -733,16 +734,17 @@ class MPTester : public MPSolver
{
const double kMinPrecision = 1e-6;
if ((fabs(master)<kMinPrecision) &&
(fabs(slave)<kMinPrecision))
if ((std::abs(master)<kMinPrecision) &&
(std::abs(slave)<kMinPrecision))
return true;
size = size<1? 1: size;
if (fabs(master-slave) <kMinPrecision*size )
if (std::abs(master-slave) <kMinPrecision*size )
return true;
if (*nomeChiamante!=0)
cout << endl << "CompareDouble: " << nomeChiamante << ", " << master << ", " << slave << endl;
cout << std::endl << "CompareDouble: " << nomeChiamante << ", "
<< master << ", " << slave << std::endl;
return false;
}
......
......@@ -115,6 +115,8 @@
#include <strstream>
#endif
#include <algorithm>
#if WHICH_OSISOLVER == 1
#include "OsiCpxSolverInterface.hpp"
#include "cplex.h"
......
......@@ -36,6 +36,8 @@
#include <assert.h>
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*-------------------------------- MACROS ----------------------------------*/
/*-- --*/
......@@ -68,7 +70,7 @@
#define lb( h ) bounds[ h ]
#endif
#define size( x ) eDir * max( ABS( x ) , LMNum( 1 ) )
#define size( x ) eDir * std::max( ABS( x ) , LMNum( 1 ) )
#if( ! SIGNAL_B2CHG )
#define B2HasChgd()
......
......@@ -37,6 +37,7 @@
#endif
#include<cmath>
#include<algorithm>
/*--------------------------------------------------------------------------*/
/*------------------------- UNDOCUMENTED SWITCHES --------------------------*/
......
......@@ -32,6 +32,8 @@
#include "OPTvect.h"
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*-------------------------------- MACROS ----------------------------------*/
/*--------------------------------------------------------------------------*/
......
......@@ -60,7 +60,7 @@
/*--------------------------------------------------------------------------*/
#include "Deflection.h"
#include "OPTvect.h"
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*----------------------------- NAMESPACE ----------------------------------*/
......@@ -212,9 +212,9 @@ inline void Volume::SetVOLLog( ostream *outs , const char lvl )
#if( LOG_VOL )
if( VOLLLvl > 1 )
*VOLLog << endl << "Volume: tau = " << tauInit << " in ["<< tauMin
*VOLLog << std::endl << "Volume: tau = " << tauInit << " in ["<< tauMin
<< " , -] with ( " << tauFactor << " , " << tauIter << " ) ~ m = "
<< m << endl;
<< m << std::endl;
#endif
}
......
......@@ -36,6 +36,8 @@
#include "SubGrad.h"
#include "OPTvect.h"
#include <algorithm>
/*--------------------------------------------------------------------------*/
/*----------------------------- NAMESPACE ----------------------------------*/
/*--------------------------------------------------------------------------*/
......
......@@ -659,7 +659,7 @@ NDOSolver::NDOStatus SubGrad::Solve( void )
comp = ( ( GiEvaltns % ( NItIncr + 1 ) ) - 1 ) %
( ZeroComp? NrFi + 1 : NrFi );
if( ! comp )
random_shuffle( Seq.begin() , Seq.end() , myrandom );
std::random_shuffle( Seq.begin() , Seq.end() , myrandom );
comp = Seq.at( comp );
}
else
......@@ -1652,7 +1652,7 @@ inline void SubGrad::Log1( void )
if( LowerBound > - Inf<HpNum>() )
*NDOLog << " ~ Gap = " << ( FiBest - LowerBound ) /
max( ABS( LowerBound ) , 1.0 ) << " %";
std::max( ABS( LowerBound ) , 1.0 ) << " %";
}
}
#endif
......@@ -2106,7 +2106,8 @@ void SubGrad::ProjTng( SgRow Gpt , cLMRow Lpt , cIndex strt , Index stp )
lhs += Lpt[ j ];
}
HpNum Eps = max( HpNum(1) , ABS( CnstVol[ i ] ) ) * Oracle->GetBndEps();
HpNum Eps = std::max( HpNum( 1 ) ,
ABS( CnstVol[ i ] ) ) * Oracle->GetBndEps();
if( ABS( lhs - CnstVol[ i ] ) <= Eps ) {
// allocate memory for the i-th knapsack problem - - - - - - - - - - - -
......
......@@ -41,7 +41,7 @@ OPTUxH = $(libNDOSDR)OPTUtils/OPTUtils.h $(libNDOSDR)OPTUtils/OPTtypes.h \
OPTUxINC = -I$(libNDOSDR)OPTUtils
# OsiSolverInterface external libreries
include $(libNDOSDR)extlib/makefile-libOSI
#include $(libNDOSDR)extlib/makefile-libOSI
# cplex external libreries: need be included only if either
# OsiCpxSolverInterface has been compiled in OsiSolverInterface, or libCQK
......@@ -49,7 +49,7 @@ include $(libNDOSDR)extlib/makefile-libOSI
#include $(libNDOSDR)extlib/makefile-libCPX
# include the libNDO makefile requiring all external modules in input
#include $(libNDOSDR)lib/makefile
include $(libNDOSDR)lib/makefile
# macroes to be exported- - - - - - - - - - - - - - - - - - - - - - - - - - -
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment