NDOSolver / FiOracle
Interfaces and Solvers for NonDifferentiable Optimization
Loading...
Searching...
No Matches
Compile-time switches in MinQuad.h

Macros

#define LOG_MQ   0
 
#define VARCOEFF   0
 
#define WASTE_MEM   2
 
#define LAZY_Q   0
 
#define EXACT   1
 

Detailed Description

These macros control some important details of the class behavior. Although using macros for activating features of the interface is not very C++, switching off some unused features may allow some implementation to be more efficient in running time or memory.

Macro Definition Documentation

◆ EXACT

#define EXACT   1

If EXACT > 0, the scalar products x * y for x and y in {z1, z2, Lh, Lj} are calculated from scratch at each iteration rather than kept updated in O( 1 ). This is costly, but it avoids accumulation of rounding errors that may lead to faults (and therefore to costly refactorizations) or even to errors.

◆ LAZY_Q

#define LAZY_Q   0

If LAZY_Q > 0, Q[ i , j ] is calculated, with a call to GiTGj( i , j ) [see], only the first time - if any - that it is required. This may save the calculation of some scalar products, but slows down the access to Q[]. If LAZY_Q == 0 instead, all the scalar products corresponding to item i are required in one blow with a call to GiTG( i ... ) [see below] when i is inserted in the bundle [see Add[SubGrad/Constr]() below].

◆ LOG_MQ

#define LOG_MQ   0

This macro controls how (if any) MinQuad produces a log of its activities on a ostream object set with the method SetMQLog():

0 => no log at all (SetMQLog() is even removed from the interface);

1 => "basic" log: only the ERRORs are reported;

2 => as 1, plus the following indices are kept updated and succinctly (in a row, tab-separated) reported when the object is destroyed:

  • the number of calls
  • the average dimension of the base (in each step)
  • the average dimension of the bundle (in each call)
  • the total time spent by SolveQP() (if TIMERS_MQ > 0);

3 => as 2, but performances reports are more verbose and the "Faults" are also reported: Faults can happen in the normal run of the algorithm, but might also depend on erroneous settings of the parameters;

4 => a detailed step-by-step log the algorithm is displayed;

5 => as 4, plus some further debug informations are printed.

◆ VARCOEFF

#define VARCOEFF   0

The typical (QP) that has to be solved has the linear equality constraint

Sum{ i } Mult[ i ] == 1.

However, by setting VARCOEFF > 0 it is turned into the more general

Sum{ i } cf[ i ] * Mult[ i ] == 1

where cf[ i ] are user-provided (nonnegative) coefficients, that can be changed between two subsequent iterations.

◆ WASTE_MEM

#define WASTE_MEM   2

This macro controls the handling of memory within an object of class MinQuad. There are three possible values:

0 = the minimum amount of memory is allocated, and no calls to new() and delete() are done within the normal execution of the algorithm: some tasks require considerably more computational effort;

1 = almost the minimum amount of memory is allocated, but some calls to new() and delete() are done (i.e. the amount of memory used can grow a little bit during a call to a method); this speeds up calculations;

2 = more memory is used, but calculations are even faster; this option can be convenient for small problems and/or if the C++ RTS is slow in allocating and deallocating memory.