Commit 4d17116c authored by Antonio Frangioni's avatar Antonio Frangioni 🤖

added std:: whenever appropriate

parent 47e98808
This diff is collapsed.
......@@ -465,7 +465,7 @@ class Bundle : public NDOSolver
/*--------------------------------------------------------------------------*/
void SetNDOLog( ostream *outs = 0 , const char lvl = 0 );
void SetNDOLog( std::ostream *outs = 0 , const char lvl = 0 );
/**< lvl controls the "level of verbosity" of the code. The first four bits
of lvl have the following meaning:
......@@ -1062,7 +1062,7 @@ inline void Bundle::SetPar( const int wp , const int value )
OOBase = new SIndex[ value ];
FreList = new Index[ value ];
const int copydim = min( value , int( BPar2 ) );
const int copydim = std::min( value , int( BPar2 ) );
if( oldOOBase ) {
for( int i = 0 ; i < copydim ; i ++ )
......
......@@ -417,7 +417,7 @@ class MPSolver
/*--------------------------------------------------------------------------*/
virtual void SetMPLog( ostream *outs = 0 , const char lvl = 0 )
virtual void SetMPLog( std::ostream *outs = 0 , const char lvl = 0 )
/**< The class outputs "log" information onto the ostream pointed by outs.
lvl controls the "level of verbosity" of the code: lvl == 0 means that
......@@ -1538,7 +1538,7 @@ class MPSolver
Index CrrSGLen; // current items length
Index NrFi; // number of components of Fi
ostream *MPLog; // the output stream object
std::ostream *MPLog; // the output stream object
char MPLLvl; // the "level of verbosity"
OPTtimers *MPt; // total time
......
......@@ -148,9 +148,9 @@ void CutPlane::SetRadius( LMNum rad )
}
double ubi = Oracle->GetUB( i ) == Inf<LMNum>() ? OsiINF :
Oracle->GetUB( i );
ubi = min( ubi , double( Li + rad ) );
ubi = std::min( ubi , double( Li + rad ) );
double lbi = Oracle->GetUC( i ) ? - OsiINF : 0;
lbi = max( lbi , double( Li - rad ) );
lbi = std::max( lbi , double( Li - rad ) );
OsiS->setColBounds( NrFi + i , lbi , ubi );
}
}
......@@ -158,9 +158,9 @@ void CutPlane::SetRadius( LMNum rad )
for( Index i = 0 ; i < NumVar ; i++ ) {
double ubi = Oracle->GetUB( i ) == Inf<LMNum>() ? OsiINF :
Oracle->GetUB( i );
ubi = min( ubi , double( Lambda[ i ] + rad ) );
ubi = std::min( ubi , double( Lambda[ i ] + rad ) );
double lbi = Oracle->GetUC( i ) ? - OsiINF : 0;
lbi = max( lbi , double( Lambda[ i ] - rad ) );
lbi = std::max( lbi , double( Lambda[ i ] - rad ) );
OsiS->setColBounds( NrFi + i , lbi , ubi );
}
}
......@@ -316,13 +316,13 @@ void CutPlane::SetFiOracle( FiOracle *Fi )
/*--------------------------------------------------------------------------*/
void CutPlane::SetLambda( register cLMRow tLambda )
void CutPlane::SetLambda( cLMRow tLambda )
{
if( ! Oracle )
throw( NDOException( "CutPlane::SetLambda: Oracle == 0" ) );
if( tLambda ) {
for( register Index i = 0 ; i < NumVar ; i++ ) {
for( Index i = 0 ; i < NumVar ; i++ ) {
if( ( ! Oracle->GetUC( i ) ) && ( tLambda[ i ] < 0 ) )
throw( NDOException( "CutPlane::SetLambda: lower bound infeasible" ) );
......@@ -337,7 +337,7 @@ void CutPlane::SetLambda( register cLMRow tLambda )
*tB = Inf<Index>();
}
else {
for( register Index i = 0 ; i < NumVar ; i++ ) {
for( Index i = 0 ; i < NumVar ; i++ ) {
if( Oracle->GetUB( i ) < 0 )
throw( NDOException( "CutPlane::SetLambda: upper bound infeasible" ) );
......@@ -404,13 +404,13 @@ NDOSolver::NDOStatus CutPlane::Solve( void )
// write first Fi info to log file
CUTLOG( 2 , endl << "0 :\tFi(): " << AFiLambda << endl );
CUTLOG( 2 , std::endl << "0 :\tFi(): " << AFiLambda << std::endl );
// check the Lower Bound- - - - - - - - - - - - - - - - - - - - - - - - - -
if( AFiLambda < LowerBound ) {
Result = kUnbndd;
CUTLOG( 0 , endl << "\tSTOP: Fi unbounded " << endl );
CUTLOG( 0 , std::endl << "\tSTOP: Fi unbounded " << std::endl );
return( Result );
}
}
......@@ -431,10 +431,10 @@ NDOSolver::NDOStatus CutPlane::Solve( void )
OsiS->resolve();
#endif
MaxNRows = max( MaxNRows , Index( OsiS->getNumRows() ) );
MaxNRows = std::max( MaxNRows , Index( OsiS->getNumRows() ) );
if( ! OsiS->isProvenOptimal() ) {
CUTLOG( 0 , endl << "RMP has no optimal solution" << endl );
CUTLOG( 0 , std::endl << "RMP has no optimal solution" << std::endl );
Result = kError;
break;
}
......@@ -465,19 +465,19 @@ NDOSolver::NDOStatus CutPlane::Solve( void )
FiOracle::FiStatus fs = Oracle->GetFiStatus();
if( fs == FiOracle::kFiStop ) {
CUTLOG( 0 , " ~ FiOracle:STOP" << endl );
CUTLOG( 0 , " ~ FiOracle:STOP" << std::endl );
Result = kStopped;
break;
}
if( fs == FiOracle::kFiError ) {
CUTLOG( 0 , " ~ Error in the FiOracle" << endl );
CUTLOG( 0 , " ~ Error in the FiOracle" << std::endl );
Result = kError;
break;
}
if( fs == FiOracle::kFiChgd ) {
CUTLOG( 1 , " ~ Fi changed: loop" << endl );
CUTLOG( 1 , " ~ Fi changed: loop" << std::endl );
continue;
}
......@@ -504,7 +504,7 @@ NDOSolver::NDOStatus CutPlane::Solve( void )
Index DeletedRows = 0;
if( ( PurgeRows >= 0 ) && ( ParIter % PurgeInvl == 0 ) )
DeletedRows = DelRMPRows( max( PurgeRows * Gap , 1e-6 ) );
DeletedRows = DelRMPRows( std::max( PurgeRows * Gap , 1e-6 ) );
// calculate Fi( Lambda ) - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......@@ -519,10 +519,10 @@ NDOSolver::NDOStatus CutPlane::Solve( void )
#if( LOG_CUT )
if( ( NDOLLvl > 2 ) ||
( ( NDOLLvl == 2 ) && ( ! ( ParIter % PrintInvl ) ) ) )
*NDOLog << endl << ParIter << ":\tValueRMP: " << AValueRMP
<< " ~ Fi(): " << AFiLambda << " ~ Gap: " << Gap << endl
*NDOLog << std::endl << ParIter << ":\tValueRMP: " << AValueRMP
<< " ~ Fi(): " << AFiLambda << " ~ Gap: " << Gap << std::endl
<< "\tAddRows: " << RowsAdded << " ~ DelRows: " << DeletedRows
<< " ~ NumRows: " << OsiS->getNumRows() << endl;
<< " ~ NumRows: " << OsiS->getNumRows() << std::endl;
#endif
if( Result ) // something was wrong in the Fi() computation
......@@ -540,7 +540,8 @@ NDOSolver::NDOStatus CutPlane::Solve( void )
if( RowsAdded == 0 ) {
Result = kError;
CUTLOG( 0 , endl << "\tSTOP: no new subgradients added " << endl );
CUTLOG( 0 , std::endl << "\tSTOP: no new subgradients added"
<< std::endl );
break;
}
......@@ -549,7 +550,7 @@ NDOSolver::NDOStatus CutPlane::Solve( void )
if( AFiLambda < LowerBound ) {
Result = kUnbndd;
CUTLOG( 0 , endl << "\tSTOP: Fi unbounded " << endl );
CUTLOG( 0 , std::endl << "\tSTOP: Fi unbounded " << std::endl );
break;
}
......@@ -629,7 +630,7 @@ bool CutPlane::IsOptimal( HpNum eps ) const
eps = EpsLin;
return( ( ABestFiLambda < Inf<HpNum>() ) &&
( Gap <= eps * max( ABS( ABestFiLambda ) , HpNum( 1 ) ) ) );
( Gap <= eps * std::max( ABS( ABestFiLambda ) , HpNum( 1 ) ) ) );
}
/*--------------------------------------------------------------------------*/
......@@ -701,7 +702,7 @@ void CutPlane::AddVariables( Index NNwVrs , cLMRow IVs )
{
throw( NDOException( "CutPlane::AddVariables: not implemented yet." ));
CUTLOG( 3 , endl << "AddVariables => "<< NNwVrs << endl );
CUTLOG( 3 , std::endl << "AddVariables => "<< NNwVrs << std::endl );
if( NumVar >= MaxNumVar ) // no space for any new variable
return; // return
......@@ -767,7 +768,7 @@ void CutPlane::RemoveVariables( cIndex_Set whch , Index hwmny )
{
throw( NDOException( "CutPlane::RemoveVariables: not implemented yet." ) );
CUTLOG(3 , "\nRemoveVariables => " << hwmny-1 << endl );
CUTLOG(3 , "\nRemoveVariables => " << hwmny-1 << std::endl );
if( ! whch ) {
int* vars = new int[ NumVar ];
......@@ -855,13 +856,13 @@ inline void CutPlane::FiAndGi( void )
FiEvaltns++;
if( FiLambda[ FiSp ] == Inf<HpNum>() ) {
CUTLOG( 1 , "\tError: Fi( Lambda ) = - INF not supported." << endl );
CUTLOG( 1 , "\tError: Fi( Lambda ) = - INF not supported." << std::endl );
Result = kError;
return;
}
if( FiLambda[ FiSp ] == - Inf<HpNum>() ) {
CUTLOG( 1 , "\tFi( Lambda ) = INF => STOP." << endl );
CUTLOG( 1 , "\tFi( Lambda ) = INF => STOP." << std::endl );
Result = kUnbndd;
return;
}
......@@ -877,7 +878,7 @@ inline void CutPlane::FiAndGi( void )
ABestFiLambda = AFiLambda;
VectAssign( BestFiLambda , FiLambda , NrFi + 1 );
if( KpBstL )
if( KpBstL ) {
if( BaseSize < NumVar ) {
cLMRow tL = Lambda;
cIndex_Set tB = Base;
......@@ -891,6 +892,7 @@ inline void CutPlane::FiAndGi( void )
}
else
VectAssign( BestLambda , Lambda , NumVar );
}
}
// now start collecting subgradients - - - - - - - - - - - - - - - - - - - -
......@@ -915,11 +917,11 @@ inline void CutPlane::FiAndGi( void )
for( Index FiSp = 1 ; FiSp <= NrFi ; FiSp++ ) {
// test if the row is effective - - - - - - - - - - - - - - - - - - - - -
CUTLOG( 3 , endl << "Gi[ " << FiSp << " ]: " );
CUTLOG( 3 , std::endl << "Gi[ " << FiSp << " ]: " );
if( ( ValueRMP[ FiSp ] < - Inf<HpNum>() ) &&
( FiLambda[ FiSp ] - ValueRMP[ FiSp ] <=
EpsLin * max( ABS( AFiLambda ) , HpNum( 1 ) ) / NrFi ) ) {
EpsLin * std::max( ABS( AFiLambda ) , HpNum( 1 ) ) / NrFi ) ) {
CUTLOG( 3 , "not effective." );
continue; // it is not: loop
}
......@@ -1095,17 +1097,19 @@ inline void CutPlane::OutRsts( void )
{
// output results, times and statistics - - - - - - - - - - - - - - - - - - -
CUTLOG( 1 , endl << "Solve: " << SCalls );
CUTLOG( 1 , endl << "Solution Value: " << AValueRMP );
CUTLOG2( 1 , NDOt , endl << "Tot. time (sec): " << NDOt->Read() );
CUTLOG( 1 , endl << "Gap: " << Gap );
CUTLOG( 1 , endl << "Iterations: " << ParIter );
CUTLOG( 1 , endl << "Fi() time (sec): " << Oracle->FiTime() );
CUTLOG( 1 , endl << "Max Number of rows (RMP): " << MaxNRows );
CUTLOG( 1 , endl << "Final Number of rows (RMP): " << OsiS->getNumRows() );
CUTLOG( 1 , endl << "Final Number of columns (RMP): "
<< OsiS->getNumCols() );
CUTLOG( 1 , endl << "Total Fi() evaluations : " << FiEvaltns << endl );
CUTLOG( 1 , std::endl << "Solve: " << SCalls );
CUTLOG( 1 , std::endl << "Solution Value: " << AValueRMP );
CUTLOG2( 1 , NDOt , std::endl << "Tot. time (sec): " << NDOt->Read() );
CUTLOG( 1 , std::endl << "Gap: " << Gap );
CUTLOG( 1 , std::endl << "Iterations: " << ParIter );
CUTLOG( 1 , std::endl << "Fi() time (sec): " << Oracle->FiTime() );
CUTLOG( 1 , std::endl << "Max Number of rows (RMP): " << MaxNRows );
CUTLOG( 1 , std::endl << "Final Number of rows (RMP): "
<< OsiS->getNumRows() );
CUTLOG( 1 , std::endl << "Final Number of columns (RMP): "
<< OsiS->getNumCols() );
CUTLOG( 1 , std::endl << "Total Fi() evaluations : " << FiEvaltns
<< std::endl );
}
/*--------------------------------------------------------------------------*/
......
......@@ -101,7 +101,7 @@ class CutPlane : public NDOSolver
/** @name Constructor
@{ */
CutPlane( istream *iStrm = 0 );
CutPlane( std::istream *iStrm = 0 );
/**< Constructor of the class.
......
This diff is collapsed.
......@@ -80,7 +80,7 @@ class LukFiOrcl : public FiOracle
/*---------------------------- CONSTRUCTOR ---------------------------------*/
/*--------------------------------------------------------------------------*/
LukFiOrcl( istream *iStrm = nullptr );
LukFiOrcl( std::istream *iStrm = nullptr );
/**< Constructor of the class. The parameter `iStrm', if provided, is taken
as a pointer to a istream from which the algorithmic parameters for the
......
File added
......@@ -114,7 +114,7 @@ class NDOSolver
/** @name Constructor
@{ */
inline NDOSolver( istream *iStrm = 0 );
inline NDOSolver( std::istream *iStrm = 0 );
/**< Constructor of the class. The parameter `iStrm', if provided, istaken as
a pointer to a istream from which the algorithmic parameters for the NDO
......@@ -1064,7 +1064,7 @@ class NDOSolver
/*------------------- inline methods implementation ------------------------*/
/*--------------------------------------------------------------------------*/
inline NDOSolver::NDOSolver( istream *iStrm )
inline NDOSolver::NDOSolver( std::istream *iStrm )
{
// initialize algorithmic parameters - - - - - - - - - - - - - - - - - - - -
......
This diff is collapsed.
......@@ -145,7 +145,7 @@ class OSIMPSolver : public MPSolver
/** @name Constructor
@{ */
OSIMPSolver( istream *iStrm = 0 );
OSIMPSolver( std::istream *iStrm = 0 );
/*--------------------------------------------------------------------------*/
/*-------------------------- OTHER INITIALIZATIONS -------------------------*/
......
......@@ -1406,8 +1406,8 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
// and dirty" pricing and the "slow but clean" one
HpNum MnDcrs = 0; // minimum decrease to declare a descent step
Index tmpMVA = min( MaxVarAdd , B2Dim + MB2Dim ); // max number of varibales
// that can be priced in
Index tmpMVA = std::min( MaxVarAdd , B2Dim + MB2Dim );
// max number of varibales that can be priced in
// in the same iteration; in case of problems it is
// gradually decreased down to one ("strict pricing")
// to avoid loops (together with the "taboo" mechanism)
......@@ -1563,7 +1563,7 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
// maximum feasible step along tmpd - di
LMNum step = Inf<LMNum>();
cHpNum eDir = eD * max( BDim , Index( 1 ) );
cHpNum eDir = eD * std::max( BDim , Index( 1 ) );
cIndex_Set tB2 = Base2;
for( Index h ; ( h = *(tB2++) ) < InINF ; ) {
......@@ -1584,7 +1584,7 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
continue;
cLMNum dh = ti * di[ h ];
step = min( step , ( dh + bounds[ h ] ) / ( dh + d1h ) );
step = std::min( step , ( dh + bounds[ h ] ) / ( dh + d1h ) );
}
if( step == Inf<LMNum>() ) // tmpdi is feasible- - - - - - - - - - - - -
......@@ -1631,7 +1631,7 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
CalculateZ( Base2 , di );
#endif
cHpNum eDir = eD * max( BDim , Index( 1 ) );
cHpNum eDir = eD * std::max( BDim , Index( 1 ) );
cIndex_Set tB2 = Base2;
for( Index h ; ( h = *(tB2++) ) < InINF ; ) {
......@@ -1689,7 +1689,7 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
#endif
LMNum beta = Inf<LMNum>();
cHpNum eDir = eD * max( BDim , Index( 1 ) );
cHpNum eDir = eD * std::max( BDim , Index( 1 ) );
cIndex_Set tB2 = Base2;
for( Index h ; ( h = *(tB2++) ) < InINF ; ) {
......@@ -1809,8 +1809,8 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
// Bf to decrease of at most 1 / SpaceDim of its current value
//!! cHpNum RqrdDcrs = eD * ( ABS( Bf ) / SpaceDim );
cHpNum RqrdDcrs =
max( MnDcrs , HpEps * max( BDim , Index( 1 ) ) * ABS( Bf ) );
cHpNum RqrdDcrs = std::max( MnDcrs ,
HpEps * std::max( BDim , Index( 1 ) ) * ABS( Bf ) );
if( Bf - newBf < - RqrdDcrs ) { // an increasing step
#if( LOG_BMQ > 3 )
......@@ -1864,10 +1864,11 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
BfBot = HpINF; // it is safe to disable the "secure" rule ...
#if( LOG_BMQ > 3 )
if( tmpMVA < min( MaxVarAdd , B2Dim + MB2Dim ) )
if( tmpMVA < std::min( MaxVarAdd , B2Dim + MB2Dim ) )
*BMQLog << " disabling strict pricing" << endl;
#endif
tmpMVA = min( MaxVarAdd , B2Dim + MB2Dim ); //... the "strict" pricing
tmpMVA = std::min( MaxVarAdd , B2Dim + MB2Dim );
//... the "strict" pricing
ClearTabooList(); // ... and to clear the taboo list
}
......@@ -1909,7 +1910,7 @@ inline void BMinQuad::CalcOptDir( HpNum ti )
CalculateZ( MBase2 , di );
#endif
cHpNum eDir = eD * max( BDim , Index( 1 ) );
cHpNum eDir = eD * std::max( BDim , Index( 1 ) );
cIndex_Set tMB2 = MBase2;
for( Index h ; ( h = *tMB2 ) < NNStop ; tMB2++ )
......@@ -2346,7 +2347,7 @@ inline void BMinQuad::CheckGS( void )
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
#define CMP( x1 , x2 ) ABS( x1 ) > eD * max( ABS( x2 ) , HpNum( 1 ) )
#define CMP( x1 , x2 ) ABS( x1 ) > eD * std::max( ABS( x2 ) , HpNum( 1 ) )
inline void BMinQuad::CheckRA( void )
{
......
......@@ -1206,7 +1206,7 @@ class BMinQuad : public MinQuad {
LMRow tmpdi; // Temporary for primal solution (with "exact" pricing)
#if( LOG_BMQ )
ostream *BMQLog; // the output stream object
std::ostream *BMQLog; // the output stream object
#if( LOG_BMQ > 1 )
unsigned long int BCalls; // Calls counter
......
This diff is collapsed.
......@@ -1216,7 +1216,7 @@ class MinQuad {
#endif
#if( LOG_MQ )
ostream *MQLog; // the output stream object
std::ostream *MQLog; // the output stream object
#if( LOG_MQ > 1 )
unsigned long int Calls; // Calls counter
......@@ -1279,13 +1279,13 @@ inline void MinQuad::SetMaxTime( cHpNum NewMaxTime )
#if( LOG_MQ )
inline void MinQuad::SetMQLog( ostream *log )
inline void MinQuad::SetMQLog( std::ostream *log )
{
MQLog = log;
#if( LOG_MQ > 2 )
*MQLog << endl << "MinQuad: #bundle = " << MaxBDim << " ~ active = "
<< CrrBDim << "." << endl << endl;
*MQLog << std::endl << "MinQuad: #bundle = " << MaxBDim << " ~ active = "
<< CrrBDim << "." << std::endl << std::endl;
#endif
}
......
......@@ -106,7 +106,7 @@
// used in SetItem()- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#define size( x ) eDir * max( ABS( x ) , LMNum( 1 ) )
#define size( x ) eDir * std::max( ABS( x ) , LMNum( 1 ) )
/*--------------------------------------------------------------------------*/
/*-------------------------------- USING -----------------------------------*/
......@@ -264,7 +264,7 @@ void QPPenaltyMP::SetDim( cIndex MxBSz, FiOracle *Oracle, const bool UsAvSt )
throw( NDOException(
"QPPenaltyMP::SetDim: decomposable Fi not supported" ) );
DimMinQuad = min( MaxBSize , SltSize ); // allocate [B]MinQuad
DimMinQuad = std::min( MaxBSize , SltSize ); // allocate [B]MinQuad
SetMaxDim( MaxBSize , DimMinQuad , MaxSGLen ); // stuff first of all
if( UsAvSt ) {
......@@ -288,7 +288,7 @@ void QPPenaltyMP::SetDim( cIndex MxBSz, FiOracle *Oracle, const bool UsAvSt )
if( ActvVrs ) {
Buffer = new SgRow[ MaxSGLen ]; // allocate the buffer of rows
for( Index i = BFCntr = min( GTSltSize , MaxSGLen ) ; i-- ; )
for( Index i = BFCntr = std::min( GTSltSize , MaxSGLen ) ; i-- ; )
Buffer[ i ] = new SgNum[ MaxBSize ];
NrAllRws = 0;
......@@ -302,7 +302,7 @@ void QPPenaltyMP::SetDim( cIndex MxBSz, FiOracle *Oracle, const bool UsAvSt )
// allocate the minimum necessary number of "chunks" of GTSltSize
// rows, i.e. GTSltSize * ceil( CrrSGLen / GTSltSize )
NrAllRws = min( MaxSGLen , GTSltSize * ( CrrSGLen / GTSltSize ) +
NrAllRws = std::min( MaxSGLen , GTSltSize * ( CrrSGLen / GTSltSize ) +
( CrrSGLen % GTSltSize ? GTSltSize : 0 ) );
#endif
......@@ -907,7 +907,7 @@ void QPPenaltyMP::SetItem( cIndex Nm )
#endif
do
DimMinQuad = min( Index( DimMinQuad + SltSize ) , MaxBSize );
DimMinQuad = std::min( Index( DimMinQuad + SltSize ) , MaxBSize );
while( Nm >= DimMinQuad );
SetCrrBDim( DimMinQuad );
......@@ -1228,7 +1228,7 @@ void QPPenaltyMP::AddVars( cIndex NNwVrs )
#endif
while( NewSGLen > NrAllRws )
#if( G_IMPLM <= 3 )
for( Index j = min( MaxSGLen - NrAllRws , GTSltSize ) ; j-- ; )
for( Index j = std::min( MaxSGLen - NrAllRws , GTSltSize ) ; j-- ; )
#endif
TSubG[ NrAllRws++ ] = new SgNum[ MaxBSize ];
#endif
......@@ -2126,7 +2126,7 @@ inline Index QPPenaltyMP::CheckBCopy( void )
inline void QPPenaltyMP::GetNewGTRow( cIndex i )
{
if( ! BFCntr )
for( Index j = BFCntr = min( MaxSGLen - NrAllRws , GTSltSize ) ; j-- ; )
for( Index j = BFCntr = std::min( MaxSGLen - NrAllRws , GTSltSize ) ; j-- ; )
Buffer[ j ] = new SgNum[ MaxBSize ];
TSubG[ i ] = Buffer[ --BFCntr ];
......@@ -2476,7 +2476,7 @@ void QPPenaltyMP::ChgRHS( cIndex strt , cIndex stp )
/*--------------------------------------------------------------------------*/
#define AREDIFF( x , y ) ABS( x - ( y ) ) > \
EpsilonD() * max( ABS( x ) , HpNum( 1 ) )
EpsilonD() * std::max( ABS( x ) , HpNum( 1 ) )
#if( HV_NNVAR )
inline void QPPenaltyMP::CheckBounds( void )
......
......@@ -31,23 +31,44 @@
/*--------------------------------------------------------------------------*/
/*-------------------------------- MACROS ----------------------------------*/
/*--------------------------------------------------------------------------*/
/** @defgroup QPPnltMP_MACROS Compile-time switches in QPPnltMP.h
Some relevant switches are defined in MinQuad.h and BMinQuad.h.
*mandotory switches* (the code won't compile/run otherwise) are
/*------------------------------ HV_NNVAR ----------------------------------*/
LAZY_Q 0 if G_IMPLM > 1 (MinQuad.h)
SIGNAL_MBCHG 0 (BMinQuad.h)
SIGNAL_B2CHG 0 (BMinQuad.h)
#define HV_NNVAR 1
Setting
/* If no Multipliers are constrained to be NonNegative (NN), the QPPenaltyMP
TWOSIDED 1 (BMinQuad.h)
is required if upper bounds on the variables are present [see GetUB() in
FiOracle.h]; if they are not, setting TWOSIDED == 0 saves some memory.
Obviously, switches in BMinQuad.h have no influence if HV_NNVAR == 0.
Although the compile-time switches are generally thought to be hortogonal
to each other, certain combinations make no sense and should be avoided.
Some *strongly advised switches* are
CONSTR 0 if ADD_CNST == 0 (MinQuad.h)
@{ */
/*------------------------------ HV_NNVAR ----------------------------------*/
/** If no Multipliers are constrained to be NonNegative (NN), the QPPenaltyMP
class can inherit directly from the base MinQuad class rather than from
the derived class BMinQuad, saving time and space; in fact, if ! HV_NNVAR
the BMinQuad.* files need not to be compiled and linked with the code.
Obviously, tring to solve a problem with NN Multipliers and HV_NNVAR == 0
will result in an exception being thrown. */
/*------------------------------ G_IMPLM -----------------------------------*/
#define HV_NNVAR 1
#define G_IMPLM 4
/*------------------------------ G_IMPLM -----------------------------------*/
/* The two computationally expensive tasks of the (QP) algoritmh are the
/** The two computationally expensive tasks of the (QP) algoritmh are the
calculation of the entries of the Hessian matrix Q[][] (each time a new
item is inserted) and the calculation of the entries of the tentative
direction d[] (at each iteration, and possibly more than once). How these
......@@ -90,11 +111,13 @@
or only the row-wise implementation is available (G_IMPLM >= 3), they are
used for both the tasks. */
#define G_IMPLM 4
/*------------------------------ ADD_CNST ----------------------------------*/
#define ADD_CNST 0
/* If ADD_CNST == 1, general linear constraints on the Lambda space are
/** If ADD_CNST == 1, general linear constraints on the Lambda space are
allowed: automatic generation of constraints is done for cases where the
feasible set is not know a priori [see Fi() and SetGi() / GetGi() below].
......@@ -102,36 +125,7 @@
*not* compact, and therefore the Lagrangean subproblem can be *unbounded*:
in this case, constraints correspond to *extreme rays* of X. */
/*--------------------------------------------------------------------------*/
/*---------------------- REQUIRED MACRO SETTINGS ---------------------------*/
/*--------------------------------------------------------------------------*/
/* Some relevant switches are defined in MinQuad.h and BMinQuad.h.
*mandotory switches* (the code won't compile/run otherwise) are
LAZY_Q 0 if G_IMPLM > 1 (MinQuad.h)
SIGNAL_MBCHG 0 (BMinQuad.h)
SIGNAL_B2CHG 0 (BMinQuad.h)
Setting
TWOSIDED 1 (BMinQuad.h)
is required if upper bounds on the variables are present [see GetUB() in
FiOracle.h]; if they are not, setting TWOSIDED == 0 saves some memory.
Obviously, switches in BMinQuad.h have no influence if HV_NNVAR == 0. */
/*--------------------------------------------------------------------------*/
/*-------------------- STRONGLY ADVISED MACRO SETTINGS ---------------------*/
/*--------------------------------------------------------------------------*/
/* Although the compile-time switches are generally thought to be hortogonal
to each other, certain combinations make no sense and should be avoided.
Some *strongly advised switches* are
CONSTR 0 if ADD_CNST == 0 (MinQuad.h). */
/* @} end( group( QPPnltMP_MACROS ) ) */
/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/
......@@ -175,9 +169,6 @@ class QPPenaltyMP : public MPSolver ,
/*-- The following methods and data are the actual interface of the --*/
/*-- class: the standard user should use these methods and data only. --*/
/*-- --*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
public:
......@@ -188,9 +179,9 @@ class QPPenaltyMP : public MPSolver ,
/*---------------------------- CONSTRUCTOR ---------------------------------*/
/*--------------------------------------------------------------------------*/
QPPenaltyMP( istream *iStrm = 0 );
QPPenaltyMP( std::istream *iStrm = 0 );
/* Constructor of the class. The parameter `iStrm', if provided, is taken as
/** Constructor of the class. The parameter `iStrm', if provided, is taken as
a pointer to a istream from which the algorithmic parameters for the QP
solver are sequentially read in the following order. Each parameter
must be placed at the beginning of a separate line, max 128 carachters
......@@ -238,7 +229,7 @@ class QPPenaltyMP : public MPSolver ,
/*--------------------------------------------------------------------------*/
inline void SetMPLog( ostream *outs = 0 , const char lvl = 0 );
inline void SetMPLog( std::ostream *outs = 0 , const char lvl = 0 );
/* The meaning of lvl is:
......@@ -747,7 +738,7 @@ inline void QPPenaltyMP::CheckIdentical( const bool Chk )
/*--------------------------------------------------------------------------*/
inline void QPPenaltyMP::SetMPLog( ostream *outs , const char lvl )
inline void QPPenaltyMP::SetMPLog( std::ostream *outs , const char lvl )
{
if( ( MPLog = outs ) )
MPLLvl = lvl;
......
......@@ -111,7 +111,7 @@ class Deflection
* amounts of information, the specific effect of each value being derived-
* class-dependent. outs == 0 implies lvl == 0. */
virtual void SetVOLLog( ostream *outs = 0 , const char lvl = 0 )
virtual void SetVOLLog( std::ostream *outs = 0 , const char lvl = 0 )
{
if( ( VOLLog = outs ) )
VOLLLvl = lvl;
......@@ -245,7 +245,7 @@ class Deflection
/*--------------------------------------------------------------------------*/
SubGrad *Solver; ///< (pointer to) the SubGrad solver
ostream *VOLLog; ///< the output stream object
std::ostream *VOLLog; ///< the output stream object
char VOLLLvl; ///< the "level of verbosity"
/*--------------------------------------------------------------------------*/
......
......@@ -63,6 +63,8 @@
#include "Deflection.h"
#include "Stepsize.h"
#include <cmath>
/*--------------------------------------------------------------------------*/
/*----------------------------- NAMESPACE ----------------------------------*/
/*--------------------------------------------------------------------------*/
......@@ -107,9 +109,7 @@ class PrimalDual : public Deflection , public Stepsize
/*---------------------------- CONSTRUCTOR ---------------------------------*/
/*--------------------------------------------------------------------------*/
inline PrimalDual( SubGrad *slvr , istream *iStrm = 0 );
/**< Constructor of the class, which derives from both Deflection and
/** Constructor of the class, which derives from both Deflection and
Stepsize. Since the constructor of PrimalDual is executed <em>after</em>
the one of Stepsize, the following parameters specific for PrimalDual have
to be found in the stream \a after those of the base class Stepsize [see the
......@@ -118,10 +118,16 @@ class PrimalDual : public Deflection , public Stepsize
-# bool average [true] if true simple averages are used, otherwise
weighted averages are used
For this class, the general parameter LpsFct -defined in Stepsize.h- represents
the gamma factor \a F used to set \f$\omega_i\f$. */
For this class, the general parameter LpsFct -defined in Stepsize.h-
represents the gamma factor \a F used to set \f$\omega_i\f$. */
PrimalDual( SubGrad *slvr , istream *iStrm = 0 )
: Deflection( slvr ) , Stepsize( slvr , iStrm )
{
DfltdSfInpt( iStrm , average , bool( true ) );
}
/*@} -----------------------------------------------------------------------*/
/*@} -----------------------------------------------------------------------*/
/*-------------------------- OTHER INITIALIZATIONS -------------------------*/
/*--------------------------------------------------------------------------*/
/** @name Other initializations
......@@ -208,16 +214,6 @@ class PrimalDual : public Deflection , public Stepsize
/*------------------- inline methods implementation ------------------------*/