NDOSolver / FiOracle
Interfaces and Solvers for NonDifferentiable Optimization
Loading...
Searching...
No Matches
MinQuad.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*-------------------------- File MinQuad.h --------------------------------*/
3/*--------------------------------------------------------------------------*/
29/*--------------------------------------------------------------------------*/
30/*----------------------------- DEFINITIONS --------------------------------*/
31/*--------------------------------------------------------------------------*/
32
33#ifndef __MinQuad
34 #define __MinQuad /* self-identification: #endif at the end of the file */
35
36/*--------------------------------------------------------------------------*/
37/*------------------------------- MACROS -----------------------------------*/
38/*--------------------------------------------------------------------------*/
46/*------------------------------- LOG_MQ -----------------------------------*/
69#define LOG_MQ 0
70
71/*------------------------------ VARCOEFF ----------------------------------*/
83#define VARCOEFF 0
84
85/*--------------------------- WASTE_MEM ------------------------------------*/
101#define WASTE_MEM 2
102
103/*------------------------------ LAZY_Q ------------------------------------*/
111#define LAZY_Q 0
112
113/*------------------------------- EXACT ------------------------------------*/
120#define EXACT 1
121
123/*--------------------------------------------------------------------------*/
124/*------------------------------ INCLUDES ----------------------------------*/
125/*--------------------------------------------------------------------------*/
126
127#include "OPTtypes.h"
128
129#if( LOG_MQ )
130 #include <iostream>
131#endif
132
133/*--------------------------------------------------------------------------*/
134/*------------------------ NAMESPACE and USINGS ----------------------------*/
135/*--------------------------------------------------------------------------*/
136
137namespace MinQuad_di_unipi_it
138{
145 using namespace OPTtypes_di_unipi_it;
146
147/*--------------------------------------------------------------------------*/
148/*---------------------------- CLASS MinQuad -------------------------------*/
149/*--------------------------------------------------------------------------*/
150/*---------------------------- GENERAL NOTES -------------------------------*/
151/*--------------------------------------------------------------------------*/
188class MinQuad {
189
190/*--------------------------------------------------------------------------*/
191/*----------------------- PUBLIC PART OF THE CLASS -------------------------*/
192/*--------------------------------------------------------------------------*/
193/*-- --*/
194/*-- The following methods and data are the actual interface of the --*/
195/*-- class: the standard user should use these methods and data only. --*/
196/*-- --*/
197/*--------------------------------------------------------------------------*/
198
199 public:
200
201/*--------------------------------------------------------------------------*/
202/*---------------------------- PUBLIC TYPES --------------------------------*/
203/*--------------------------------------------------------------------------*/
209 enum MQError { kOK = 0 ,
210
216
218
220 kFatal
221 };
222
224/*--------------------------- PUBLIC METHODS -------------------------------*/
225/*--------------------------------------------------------------------------*/
226/*----------------------------- CONSTRUCTOR --------------------------------*/
227/*--------------------------------------------------------------------------*/
235 MinQuad( void );
236
238/*-------------------------- OTHER INITIALIZATIONS -------------------------*/
239/*--------------------------------------------------------------------------*/
278 virtual void SetMaxDim( Index m , Index n , Index SDim = 0 );
279
280/*--------------------------------------------------------------------------*/
288 void SetCrrBDim( cIndex Newn );
289
290/*--------------------------------------------------------------------------*/
305 void SetLB( HpNum LB = -Inf< HpNum >() )
306 {
307 LwrBnd = -LB;
308 if( LBIsInB ) {
309 Lin = Inf< HpNum >();
310 if( LwrBnd == Inf< HpNum >() )
311 LBIsInB = 0;
312 }
313 }
314
315/*--------------------------------------------------------------------------*/
330 void SetEpsilonR( HpNum NeweR = 0 );
331
332/*--------------------------------------------------------------------------*/
361 void SetPricing( cHpNum Brk = Inf< HpNum >() ) { EpsRo = Brk; }
362
363/*----------------------------------------------------------------------------
364 In typical conditions, obtaining an x such that f( x ) ~= 0 means
365 terminating; hence, the extra stopping condition "f() <= MinFVal" can help
366 to avoid useless operations and the numerical problems that can occur when
367 f() is too near to the machine precision. This method allow to set MinFVal
368 to an user-provided value; if it is never called,
369 MinFVal == - Inf< HpNum >().
370
371 void SetMinFVal( cHpNum NewMinFVal ) { MinFVal = NewMinFVal; }
372
373----------------------------------------------------------------------------*/
379 void SetMaxTime( cHpNum NewMaxTime )
380 {
381 MaxTime = NewMaxTime > 0 ? NewMaxTime : 0;
382 }
383
384/*--------------------------------------------------------------------------*/
385
386#if( LOG_MQ )
392 void SetMQLog( ostream *log )
393 {
394 MQLog = log;
395
396 #if( LOG_MQ > 2 )
397 *MQLog << std::endl << "MinQuad: #bundle = " << MaxBDim << " ~ active = "
398 << CrrBDim << "." << std::endl << std::endl;
399 #endif
400 }
401
402#endif
403
404/*--------------------------------------------------------------------------*/
411 virtual void SetMQTime( const bool TimeIt = true )
412 {
413 if( TimeIt )
414 if( MQt )
415 MQt->ReSet();
416 else
417 MQt = new OPTtimers();
418 else {
419 delete MQt;
420 MQt = 0;
421 }
422 }
423
425/*------------- METHODS FOR ADDING / REMOVING / CHANGING DATA --------------*/
426/*--------------------------------------------------------------------------*/
435 virtual void AddSubGrad( cIndex n , cHpNum alfan );
436
437/*--------------------------------------------------------------------------*/
452 virtual void AddConstr( cIndex n , cHpNum alfan );
453
454/*--------------------------------------------------------------------------*/
456
457 bool IsThere( cIndex n ) { return( G[ n ] != 0 ); }
458
459/*--------------------------------------------------------------------------*/
461
462 bool IsASubG( cIndex n ) { return( ( G[ n ] & 1 ) == 1 ); }
463
464/*--------------------------------------------------------------------------*/
466
467 bool IsAConst( cIndex n ) { return( ( G[ n ] & 2 ) == 2 ); }
468
469/*--------------------------------------------------------------------------*/
471
472 bool IsLB( void ) { return( LwrBnd < Inf< HpNum >() ); }
473
474/*--------------------------------------------------------------------------*/
481 Index MaxItemN( void ) { return( NxtBIdx ); }
482
483/*--------------------------------------------------------------------------*/
487 void ResetBundle( cIndex which );
488
489/*--------------------------------------------------------------------------*/
491
492 void ResetBundle( void );
493
494/*--------------------------------------------------------------------------*/
501 virtual void ChangeAlfa( cIndex i , cHpNum DeltaAlfai )
502 {
503 if( G[ i ] && DeltaAlfai ) {
504 Alfa[ i ] += DeltaAlfai;
505
506 if( G[ i ] & 4 ) // IsInBse == 4
507 z1Tz2 = Lin = Inf< HpNum >(); // Alfa (=> z2) is changed
508 }
509 }
510
511/*--------------------------------------------------------------------------*/
522 virtual void ChangeAlfa( cHpNum DeltaAlfa );
523
524/*--------------------------------------------------------------------------*/
570 virtual void MoveAlongD( cHpNum Tau , cHpNum DeltaFi );
571
572/*--------------------------------------------------------------------------*/
576 virtual void ReadAlfa( HpRow NewAlfa );
577
578/*--------------------------------------------------------------------------*/
582 virtual cHpRow ReadAlfa( void ) { return( Alfa ); }
583
584/*--------------------------------------------------------------------------*/
586
587 cHpNum ReadLB( void ) { return( - LwrBnd ); }
588
589/*--------------------------------------------------------------------------*/
593 virtual void SetGTz( cIndex i , cHpNum GTzi ) { GTz[ i ] = GTzi; }
594
595/*--------------------------------------------------------------------------*/
614 void AddSGSpaceDim( cSgRow NewDim , const bool UpdtB = true );
615
616/*--------------------------------------------------------------------------*/
623 void AddSGSpaceDim( cSgRow NewDim , cHpNum lbh , const bool UpdtB = true );
624
625/*--------------------------------------------------------------------------*/
645 void CutSGSpaceDim( cSgRow OldDim , const bool UpdtB = true );
646
647/*--------------------------------------------------------------------------*/
654 void CutSGSpaceDim( cSgRow OldDim , cHpNum lbh , const bool UpdtB = true );
655
656/*--------------------------------------------------------------------------*/
673 void ChangeQ( void );
674
675/*--------------------------------------------------------------------------*/
686 void UpdateB( void );
687
688/*--------------------------------------------------------------------------*/
698 void ResetB( void );
699
700/*--------------------------------------------------------------------------*/
701
702#if( VARCOEFF )
703
716 void ChangeCoefficient( cIndex i , cHpNum ci );
717
718#endif
719
721/*-------------------- METHODS FOR SOLVING THE PROBLEM ---------------------*/
722/*--------------------------------------------------------------------------*/
753 virtual MQError SolveQP( HpNum ti );
754
756/*---------------------- METHODS FOR READING RESULTS -----------------------*/
757/*--------------------------------------------------------------------------*/
765 virtual HpNum ReadzNorm( void ) { return( Quad ); }
766
767/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
776 virtual HpNum ReadSigma( const bool IncldCnst = true )
777 {
778 if( IncldCnst || ( ! CBDim ) )
779 return( Lin );
780 else {
781 HpNum tS = 0;
782 cHpRow tM = Mult;
783 cIndex_Set tB = Base;
784 for( Index h ; ( h = *(tB++) ) < Inf< Index >() ; tM++ )
785 if( ! IsAConst( h ) )
786 tS += (*tM) * Alfa[ h ];
787
788 return( tS );
789 }
790 }
791
792/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
805 HpNum Readv( void )
806 {
807 HpNum tv = - LastRo;
808
809 if( tv < Inf< HpNum >() )
810 tv *= PrvsTi;
811
812 return( tv );
813 }
814
815/*--------------------------------------------------------------------------*/
825 cHpRow ReadMult( void ) { return( Mult ); }
826
827/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
831 Index ReadBDim( void ) { return( BDim ); }
832
833/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
840 cIndex_Set ReadBase( void ) { return( Base ); }
841
842/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
844
845 bool IsInBase( cIndex n ) { return( ( G[ n ] & 4 ) == 4 ); }
846
847/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
853 Index ReadCBDim( void ) { return( CBDim ); }
854
855/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
874 cHpRow ReadInfDir( void ) { return( tmpv ); }
875
876/*--------------------------------------------------------------------------*/
881 HpNum ReadLBMult( void ) { return( LBIsInB ? LBMult : 0 ); }
882
883/*--------------------------------------------------------------------------*/
888 virtual HpNum ReadGTz( cIndex i ) { return( GTz[ i ] ); }
889
890/*--------------------------------------------------------------------------*/
907 virtual void SensitAnals1( HpNum &v1 , HpNum &v2 , HpNum &v3 );
908
909/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
915 void SensitAnals2( HpNum v1 , HpNum v2 , HpRow x1 , HpRow x2 );
916
917/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
923 void SensitAnals3( cHpNum v1 , cHpNum v2 , HpRow x1 , HpRow x2 ,
924 HpNum &tMin , HpNum &tMax );
925
926/*--------------------------------------------------------------------------*/
928
929 void MQTime( double &t_us , double &t_ss )
930 {
931 t_us = t_ss = 0;
932 if( MQt )
933 MQt->Read( t_us , t_ss );
934 }
935
936/*--------------------------------------------------------------------------*/
938
939 double MQTime( void ) { return( MQt ? MQt->Read() : 0 ); }
940
942/*-------------- METHODS FOR READING THE DATA OF THE PROBLEM ---------------*/
943/*--------------------------------------------------------------------------*/
950 HpNum EpsilonR( void ) { return( eR * Lmu * ( BDim ? BDim : 1 ) ); }
951
952/*--------------------------------------------------------------------------*/
960 {
961 #if( LAZY_Q )
962 if( i >= j ) {
963 if( Q[ i ][ j ] == -QuINF )
964 Q[ i ][ j ] = GiTGj( j , i );
965
966 return( Q[ i ][ j ] );
967 }
968 else {
969 if( Q[ j ][ i ] == -QuINF )
970 Q[ j ][ i ] = GiTGj( i , j );
971
972 return( Q[ j ][ i ] );
973 }
974 #else
975 return( i >= j ? Q[ i ][ j ] : Q[ j ][ i ] );
976 #endif
977 }
978
979/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
981
983 {
984 #if( LAZY_Q )
985 if( Q[ i ][ i ] == -QuINF )
986 Q[ i ][ i ] = GiTGj( i , i );
987 #endif
988
989 return( Q[ i ][ i ] );
990 }
991
993/*------------------------------ DESTRUCTOR --------------------------------*/
994/*--------------------------------------------------------------------------*/
999
1000 virtual ~MinQuad();
1001
1003/*-------------------- PROTECTED PART OF THE CLASS -------------------------*/
1004/*--------------------------------------------------------------------------*/
1005
1006 protected:
1007
1008/*--------------------------------------------------------------------------*/
1009/*-------------------------- PURE VIRTUAL METHODS --------------------------*/
1010/*--------------------------------------------------------------------------*/
1058#if( LAZY_Q )
1059
1060 virtual QuNum GiTGj( cIndex i , cIndex j ) = 0;
1061
1062#else
1063
1064 virtual void GiTG( cIndex i , QuRow Qi , cIndex iMax ) = 0;
1065
1066#endif
1067
1069/*------------------ "REAL" PROTECTED PART OF THE CLASS --------------------*/
1070/*--------------------------------------------------------------------------*/
1079/*--------------------------------------------------------------------------*/
1080/*-------------------------- PROTECTED METHODS -----------------------------*/
1081/*--------------------------------------------------------------------------*/
1086 void AlfaChanged( void ) { z1Tz2 = Lin = Inf< HpNum >(); }
1087
1088/*--------------------------------------------------------------------------*/
1089/*--------------------- PROTECTED DATA STRUCTURES --------------------------*/
1090/*--------------------------------------------------------------------------*/
1091
1099
1105
1109
1112 // HpNum MinFVal; < Stop if f() <= MinFVal
1113
1119
1121/*--------------------- PRIVATE PART OF THE CLASS --------------------------*/
1122/*--------------------------------------------------------------------------*/
1123/*-- --*/
1124/*-- Nobody should ever look at this part: everything that is under this --*/
1125/*-- advice may be changed without notice in any new release of the code. --*/
1126/*-- --*/
1127/*--------------------------------------------------------------------------*/
1128
1129 private:
1130
1131/*--------------------------------------------------------------------------*/
1132/*-------------------------- PRIVATE METHODS -------------------------------*/
1133/*--------------------------------------------------------------------------*/
1134
1135 void GjTGBk( cIndex j , cIndex_Set Bk , Index Dim , HpRow v );
1136
1137/*--------------------------------------------------------------------------*/
1138
1139 void RebuildBase( void );
1140
1141/*--------------------------------------------------------------------------*/
1142
1143 void CalcOptDir( cHpNum ti );
1144
1145/*--------------------------------------------------------------------------*/
1146
1147 bool Feasible( void );
1148
1149/*--------------------------------------------------------------------------*/
1150
1151 HpNum vPerAlfa( cHpRow v );
1152
1153/*--------------------------------------------------------------------------*/
1154
1155 HpNum CalculateDelta( cIndex i );
1156
1157/*--------------------------------------------------------------------------*/
1158
1159 void AddSubGradToBase( Index BD , cHpNum Delta );
1160
1161/*--------------------------------------------------------------------------*/
1162
1163 void ChkNwLinInd( void );
1164
1165/*--------------------------------------------------------------------------*/
1166
1167 void CutSubGradFromBase( cIndex s );
1168
1169/*--------------------------------------------------------------------------*/
1170
1171 void MoveSubgradToLastPos( cIndex s );
1172
1173/*--------------------------------------------------------------------------*/
1174
1175 void UpdateLmu( cIndex s );
1176
1177/*--------------------------------------------------------------------------*/
1178
1179 void ComputeQuad( void );
1180
1181/*--------------------------------------------------------------------------*/
1182
1183 void MemDealloc( void );
1184
1185/*--------------------------------------------------------------------------*/
1186
1187 void CheckB( void );
1188
1189 void CheckQ( void );
1190
1191/*--------------------------------------------------------------------------*/
1192/*----------------------- PRIVATE DATA STRUCTURES -------------------------*/
1193/*--------------------------------------------------------------------------*/
1194
1195 Index_Set Order; // Order[ 0 .. ActBDim - 1 ] contains the "names" of
1196 // all the items currently in the bundle
1197 char *G; // Which position contains what in the bundle
1198
1199 QuMat Q; // Q = G^T * G (the lower triangular part)
1200
1201 HpMat L; // L_B * L_B^T = Q_B (L may be trapezoidal)
1202
1203 HpRow z1; // L_{B'}^{-1} * e_{B'} \ B' the "linearly
1204 HpRow z2; // L_{B'}^{-1} * Alfa_{B'} / independent" part of B
1205 #if( VARCOEFF )
1206 HpRow cf; // Coefficients of the linear equality constraint
1207 #endif
1208
1209 HpNum f; // f( x ) = (1/2) * ti * Quad + Lin
1210 HpNum Minf; // Min. value of f() got in this run
1211 HpNum LastRo; // Latest value of ro = - v / ti
1212 HpNum z1Tz2; // z1 * z2
1213 HpNum z1Norm; // || z1 ||^2
1214 HpNum LhTz1; // L[ BDim - 1 ] * z1 \ used by SensytAnalsX()
1215 HpNum LhTz2; // L[ BDim - 1 ] * z2 / if Dependent == 1
1216 #if( ! EXACT )
1217 HpNum LhNorm; // || Lh ||^2 \ set by CalculateDelta, on the base
1218 HpNum LjNorm; // || Lj ||^2 / of the current value of Dependent
1219 #endif
1220 HpNum LwrBnd; // the Lower Bound on v
1221 HpNum LBMult; // the multiplier corresponding to LwrBnd
1222
1223 Index Dependent; // How many items in Base are lin. dep. (0, 1 or 2)
1224 Index LBIsInB; // 1 <=> if the Lower Bound is "in Base"
1225 Index SgSpDim; // Max. dimension of a base
1226 Index CrrBDim; // Max. *active* dimension of the bundle
1227
1228 Index Ename; // The name of the item that has entered last
1229 Index Ewher; // The position in Base of the item Ename
1230 Index Eordr; // The position in Order of the item Ename
1231 Index TLDim; // The number of "taboo" items
1232 Index LiMax; // Index of the max ...
1233 Index LiMin; // ... and of the min. diagonal element of L
1234 HpNum Lmu; // Lmu = L[ iMax ][ iMax ] / L[ iMin ][ iMin ], i.e.
1235 // the condition number of L
1236 HpNum EpsRo; // The "steepest" pricing is interrupted if
1237 // df < - EpsRo * BDim * | f |
1238 Index CBDim; // <= BDim - 1: how many of the items in Base are NOT
1239 // subgradients (i.e. are constraints)
1240
1241 HpNum MaxTime; // maximum time in each call to SolveQP()
1242 bool AddedOne; // true if some new item has been added to the bundle
1243 // since the last call
1244 bool LocalOptima; // true if CalcOptDir() ended in a local optima
1245
1246 #if( ! LAZY_Q )
1247 QuRow tempQ; // Temporary of QuNum's
1248 #endif
1249
1250 #if( ! WASTE_MEM )
1251 HpRow tmpr; // Extra temporary for MoveSubgradToLastPos()
1252 #endif
1253
1254 #if( LOG_MQ )
1255 std::ostream *MQLog; // the output stream object
1256
1257 #if( LOG_MQ > 1 )
1258 unsigned long int Calls; // Calls counter
1259 unsigned long int Step; // Step counter
1260 unsigned long int Success; // Succesfull calls counter
1261 float SumBDim; // Sum( all steps i ) BDim_i
1262 float SumActBDim; // Sum( all calls i ) ActBDim_i
1263 float SumGSBase; // Sum( all steps i ) CBDim_i / BDim_i
1264 float SumGSbundle; // Sum( all calls i ) ActCNum_i / ActBDim_i
1265 unsigned long int Insert; // Total n. of insertions
1266 unsigned long int Delete; // Total n. of deletions
1267 unsigned long int SGSIncr; // Total n. of calls to AddSGSpaceDim()
1268 unsigned long int SGSDecr; // Total n. of calls to CutSGSpaceDim()
1269 #endif
1270 #endif
1271
1272 OPTtimers *MQt;
1273
1274/*--------------------------------------------------------------------------*/
1275/*--------------------------------------------------------------------------*/
1276
1277 }; // end( class MinQuad )
1278
1279/*--------------------------------------------------------------------------*/
1280
1281 } // end( namespace MinQuad_di_unipi_it )
1282
1283/*--------------------------------------------------------------------------*/
1284/*--------------------------------------------------------------------------*/
1285
1286#endif /* MinQuad.h included */
1287
1288/*--------------------------------------------------------------------------*/
1289/*----------------------- End File MinQuad.h -------------------------------*/
1290/*--------------------------------------------------------------------------*/
Definition MinQuad.h:188
void AddSGSpaceDim(cSgRow NewDim, cHpNum lbh, const bool UpdtB=true)
void MQTime(double &t_us, double &t_ss)
Return the user and sistem time (in seconds) spent so far by SolveQP().
Definition MinQuad.h:929
Index_Set Base
Base (set of strictly positive variables)
Definition MinQuad.h:1101
virtual void GiTG(cIndex i, QuRow Qi, cIndex iMax)=0
QuNum LowQ(cIndex i, cIndex j)
Definition MinQuad.h:959
HpNum EpsilonR(void)
Definition MinQuad.h:950
Index ReadBDim(void)
Definition MinQuad.h:831
bool IsThere(cIndex n)
Returns true if there is an item with name 'n'.
Definition MinQuad.h:457
virtual MQError SolveQP(HpNum ti)
QuNum LowQ(cIndex i)
LowQ( i ) = LowQ( i , i )
Definition MinQuad.h:982
void AddSGSpaceDim(cSgRow NewDim, const bool UpdtB=true)
cIndex_Set ReadBase(void)
Definition MinQuad.h:840
HpRow tmpa
Definition MinQuad.h:1114
Index MaxItemN(void)
Definition MinQuad.h:481
HpRow tmpv
like tmpa
Definition MinQuad.h:1118
void ResetBundle(cIndex which)
cHpNum ReadLB(void)
returns the current value of the Lower Bound
Definition MinQuad.h:587
virtual void SetGTz(cIndex i, cHpNum GTzi)
Definition MinQuad.h:593
HpRow Alfa
Linearization errors.
Definition MinQuad.h:1108
bool IsASubG(cIndex n)
Returns true if the item with "name" 'n' is a subgradient.
Definition MinQuad.h:462
virtual cHpRow ReadAlfa(void)
Definition MinQuad.h:582
double MQTime(void)
Return the total time (in seconds) spent so far by SolveQP().
Definition MinQuad.h:939
virtual void ChangeAlfa(cIndex i, cHpNum DeltaAlfai)
Definition MinQuad.h:501
cHpRow ReadInfDir(void)
Definition MinQuad.h:874
void SetLB(HpNum LB=-Inf< HpNum >())
Definition MinQuad.h:305
void SetPricing(cHpNum Brk=Inf< HpNum >())
Definition MinQuad.h:361
virtual void SetMaxDim(Index m, Index n, Index SDim=0)
void SetCrrBDim(cIndex Newn)
bool IsLB(void)
Returns true if a Lower Bound has been set.
Definition MinQuad.h:472
bool IsAConst(cIndex n)
Returns true if the item with "name" 'n' is a constraint.
Definition MinQuad.h:467
HpNum Readv(void)
Definition MinQuad.h:805
virtual HpNum ReadGTz(cIndex i)
Definition MinQuad.h:888
void CutSGSpaceDim(cSgRow OldDim, cHpNum lbh, const bool UpdtB=true)
virtual void AddConstr(cIndex n, cHpNum alfan)
void CutSGSpaceDim(cSgRow OldDim, const bool UpdtB=true)
virtual void ReadAlfa(HpRow NewAlfa)
HpNum eR
Relative error for "== 0" tests.
Definition MinQuad.h:1111
HpNum ReadLBMult(void)
Definition MinQuad.h:881
MQError
Definition MinQuad.h:209
@ kIncreasingStep
another kind of numerical issue
Definition MinQuad.h:212
@ kInvalidV
another kind of numerical issue
Definition MinQuad.h:214
@ kLoop
another kind of numerical issue
Definition MinQuad.h:215
@ kNegativeDelta
one kind of numerical issue
Definition MinQuad.h:211
@ kOK
everything went fine
Definition MinQuad.h:209
@ kQPPrimUnbndd
the problem is proven to be unbounded
Definition MinQuad.h:217
@ kStpTime
stopped due to time limit
Definition MinQuad.h:219
@ kFatal
a fatal numerical error
Definition MinQuad.h:220
@ kNegVarInBase
another kind of numerical issue
Definition MinQuad.h:213
bool IsInBase(cIndex n)
Returns true if the "name" 'n' is in the optimal base.
Definition MinQuad.h:845
Index ReadCBDim(void)
Definition MinQuad.h:853
virtual void MoveAlongD(cHpNum Tau, cHpNum DeltaFi)
HpRow GTz
Definition MinQuad.h:1106
virtual ~MinQuad()
Memory deallocation. Statistics (if any) are printed.
Index ActCNum
Definition MinQuad.h:1094
void SensitAnals2(HpNum v1, HpNum v2, HpRow x1, HpRow x2)
Index NxtBIdx
Definition MinQuad.h:1096
virtual HpNum ReadzNorm(void)
Definition MinQuad.h:765
virtual void SensitAnals1(HpNum &v1, HpNum &v2, HpNum &v3)
virtual HpNum ReadSigma(const bool IncldCnst=true)
Definition MinQuad.h:776
HpNum PrvsTi
Value of ti in the latest call of CalcOptDir()
Definition MinQuad.h:1110
HpRow Mult
Primal variables.
Definition MinQuad.h:1100
Index ActBDim
Number of items currently in the bundle.
Definition MinQuad.h:1093
void SetMaxTime(cHpNum NewMaxTime)
Definition MinQuad.h:379
HpNum Lin
Alfa^T * Mult.
Definition MinQuad.h:1104
cHpRow ReadMult(void)
Definition MinQuad.h:825
void SetEpsilonR(HpNum NeweR=0)
Index MaxBDim
Max. dimension of the bundle.
Definition MinQuad.h:1092
void ResetBundle(void)
Complete reset of the bundle: all items are eliminated.
HpNum Quad
Mult^T * Q * Mult.
Definition MinQuad.h:1103
virtual void AddSubGrad(cIndex n, cHpNum alfan)
virtual void ChangeAlfa(cHpNum DeltaAlfa)
MQError QPStatus
termination code of SolveQP()
Definition MinQuad.h:1098
Index BDim
n. of items in Base
Definition MinQuad.h:1102
void SensitAnals3(cHpNum v1, cHpNum v2, HpRow x1, HpRow x2, HpNum &tMin, HpNum &tMax)
virtual void SetMQTime(const bool TimeIt=true)
Definition MinQuad.h:411
void AlfaChanged(void)
Definition MinQuad.h:1086
Definition OPTUtils.h:144
void ReSet(void)
reset the timer
Definition OPTUtils.h:214
double Read(void)
Definition OPTUtils.h:184
HpRow * HpMat
"finer" (fp) matrix
Definition OPTtypes.h:100
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
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
QuRow * QuMat
Q (itself)
Definition OPTtypes.h:122
double QuNum
numbers in Q ( G{i}{T} * G{j} )
Definition OPTtypes.h:120
QuNum * QuRow
row of Q
Definition OPTtypes.h:121
cSgNum * cSgRow
a read-only subgradient
Definition OPTtypes.h:116
static constexpr T Inf(void) noexcept
Inf< T >() = infinity value for T.
Definition OPTUtils.h:357
Definition BMinQuad.h:157
Definition OPTtypes.h:41