46#define SubGrad_HANDLES_CONSTRAINTS 0
84#if SubGrad_HANDLES_CONSTRAINTS
85 #include "CQKnPClass.h"
95 #if SubGrad_HANDLES_CONSTRAINTS
96 using namespace CQKnPClass_di_unipi_it;
187 kSGPar2 , kSGPar3 , kSGPar4 , kSGPar5 };
307#if SubGrad_HANDLES_CONSTRAINTS
309 void SetQKNP( CQKnPClass *KNP =
nullptr );
337 void KeepBestLambda(
const bool KBL =
true );
341 void SetPar(
const int wp ,
const int value );
357 void SetPar(
const int wp ,
const bool value );
364 void SetNDOLog( std::ostream *outs = 0 ,
const char lvl = 0 );
530 inline void GetPar(
const int wp ,
int &value );
534 inline void GetPar(
const int wp ,
bool &value );
694 #if SubGrad_HANDLES_CONSTRAINTS
754 inline void Log1(
void );
756 inline void Log2(
void );
758 inline void Log3(
void );
760 inline void Log4(
void );
780 #if SubGrad_HANDLES_CONSTRAINTS
781 void EvalConst(
void );
795 void InitStepsize(
void );
797 void InitDeflection(
void );
801 void ChgLambdaHat(
void );
805 void UpdateSigma(
void );
809 void UpdtLowerBound(
void );
813 void MemDealloc(
void );
828 case( kSGPar1 ): value =
SGPar1;
break;
829 case( kSGPar3 ): value =
SGPar3;
break;
830 case( kSGPar5 ): value =
SGPar5;
break;
840 case( kSGPar2 ): value =
SGPar2;
break;
850 case( kSGPar4 ): value =
SGPar4;
break;
851 default:
throw(
NDOException(
"GetPar( bool ): unknown parameter" ) );
Definition Deflection.h:63
Definition FiOracle.h:231
FiStatus
Definition FiOracle.h:248
NDOStatus
Definition NDOSlver.h:91
virtual void GetPar(const int wp, int &value)
Definition NDOSlver.h:1075
bool ZeroComp
true if Fi() comes with the 0-th component
Definition SubGrad.h:724
bool DoSS
SS vs NS.
Definition SubGrad.h:739
LMRow LambdaBest
the best point found so far
Definition SubGrad.h:657
HpNum step
the stepsize
Definition SubGrad.h:667
LMRow lb
lower bounds on the variables
Definition SubGrad.h:692
HpNum SGPar2
incremental factor
Definition SubGrad.h:625
void ReSetAlg(unsigned char RstLvl=0)
bool LHasChgd
Definition SubGrad.h:650
void SetPar(const int wp, const int value)
HpNum Sigma
Definition SubGrad.h:669
LMRow LambdaBar
the stability center
Definition SubGrad.h:639
HpNum FiLambda
full function value at Lambda
Definition SubGrad.h:644
HpNum SigmaHat
Definition SubGrad.h:674
Index MaxNumVar
maximum number of variables
Definition SubGrad.h:637
bool DirPos
Definition SubGrad.h:731
LMRow LambdaHat
the point
Definition SubGrad.h:646
HpNum ReadFiVal(cIndex wFi=Inf< Index >())
void ChgSbG(cIndex strt=0, Index stp=Inf< Index >(), cIndex wFi=Inf< Index >())
HpNum dM1Gk
scalar product
Definition SubGrad.h:686
bool IsOptimal(HpNum eps=0)
bool LHasProj
Definition SubGrad.h:652
HpNum FiBest
the best value of found so far
Definition SubGrad.h:656
Index NItIncr
Definition SubGrad.h:725
bool dM1GkDone
Definition SubGrad.h:688
Stepsize * stepsize
pointer to the Stepsize class
Definition SubGrad.h:633
Index_Set SGBase
the set of indices of Gi[ wFi ]( Lambda )
Definition SubGrad.h:680
vector< Index > Seq
Definition SubGrad.h:729
HpNum FiBar
full function value at LambdaBar
Definition SubGrad.h:640
void GetPar(const int wp, int &value)
Definition SubGrad.h:825
SgRow dir
the direction
Definition SubGrad.h:664
void RemoveVariables(cIndex_Set whch=0, Index hwmny=0)
bool EmptySet
true, if the feasible set is empty
Definition SubGrad.h:742
SgRow Gi
Gi[ wFi ]( Lambda ), the subgradient.
Definition SubGrad.h:663
void SetPar(const int wp, cHpNum value)
HpNum NrmDir
the (squared) direction's norm
Definition SubGrad.h:683
HpNum ReadBestFiVal(cIndex wFi=Inf< Index >())
bool SGPar4
control if is kept
Definition SubGrad.h:629
HpNum LowerBound
Lower Bound over the full function .
Definition SubGrad.h:659
Index CNSCntr
counter of consecutive NS
Definition SubGrad.h:736
SGParam
Definition SubGrad.h:186
cHpRow ReadMult(cIndex_Set &I, Index &D, cIndex wFi=Inf< Index >())
FiOracle::FiStatus fs
FiOracle status.
Definition SubGrad.h:741
LMRow ub
upper bounds on the variables
Definition SubGrad.h:691
LMRow Lambda
Definition SubGrad.h:642
void SetFiOracle(FiOracle *Fi=nullptr)
Index CSSCntr
counter of consecutive SS
Definition SubGrad.h:735
Index SGPar5
seed
Definition SubGrad.h:631
void SetLambda(cLMRow tLambda=nullptr)
HpNum alpha
the deflection parameter
Definition SubGrad.h:666
void SetPar(const int wp, const bool value)
HpNum ReadLBMult(cIndex wFi=Inf< Index >())
HpNum Epsilon
Definition SubGrad.h:671
bool KpBstL
if LambdaBest has to be kept
Definition SubGrad.h:655
bool TrueLB
Definition SubGrad.h:660
cLMRow ReadSol(cIndex_Set &I, Index &D)
cLMRow ReadBestSol(cIndex_Set &I, Index &D)
void AddVariables(Index NNwVrs, cLMRow IVs=0)
HpNum HatEpsilon
Definition SubGrad.h:676
void FiAndGi(cIndex wFi=Inf< Index >())
Index SGPar1
projection-strategy parameters
Definition SubGrad.h:623
void SetStepsize(Stepsize *STP=nullptr)
void SetNDOLog(std::ostream *outs=0, const char lvl=0)
Deflection * deflection
pointer to the Deflection class
Definition SubGrad.h:635
bool InnIter
if true, the current iteration is an inner one
Definition SubGrad.h:727
HpNum FiHat
full function value at HLmb
Definition SubGrad.h:647
Index CSmallStep
counter of consecutive short step
Definition SubGrad.h:738
void SetDeflection(Deflection *Vol=nullptr)
void ChgFiV(cIndex wFi=Inf< Index >())
Index SGPar3
scheme: stepsize(deflection)-restricted
Definition SubGrad.h:627
std::mt19937 myrandom
random generator for incremental steps
Definition SubGrad.h:722
HpNum NrmGi
the (squared) subgradient's norm
Definition SubGrad.h:682
SubGrad(std::istream *iStrm=0)
HpNum dGk
scalar product
Definition SubGrad.h:685
HpNum * HpRow
"finer" (fp) array
Definition OPTtypes.h:99
const HpNum cHpNum
a read-only HpNum
Definition OPTtypes.h:102
double HpNum
"finer" floating point numbers
Definition OPTtypes.h:98
const Index cIndex
a read-only Index
Definition OPTtypes.h:64
cIndex * cIndex_Set
read-only array
Definition OPTtypes.h:65
SIndex * SIndex_Set
set (array) of s. indices
Definition OPTtypes.h:71
Index * Index_Set
set (array) of indices
Definition OPTtypes.h:61
unsigned int Index
Index in a vector ( >= 0 )
Definition OPTtypes.h:60
cHpNum * cHpRow
read-only array
Definition OPTtypes.h:103
SgNum * SgRow
a subgradient
Definition OPTtypes.h:112
LMNum * LMRow
a vector of Lagrangean Multipliers
Definition OPTtypes.h:130
double LMNum
a Lagrangean Multiplier
Definition OPTtypes.h:129
cLMNum * cLMRow
a read-only vector of LMs
Definition OPTtypes.h:134
static constexpr T Inf(void) noexcept
Inf< T >() = infinity value for T.
Definition OPTUtils.h:357