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

Macros

#define LOG_BMQ   0
 
#define LAZY_D   0
 
#define TWOSIDED   1
 
#define SIGNAL_MBCHG   0
 
#define SIGNAL_B2CHG   0
 
#define BEXACT   0
 
#define CNDVD_TMP   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

◆ BEXACT

#define BEXACT   0

Analogous to the EXACT macro of MinQuad.h: if BEXACT == 0, some numbers are kept updated in O( 1 ) per iteration rather than recalculated from scratch in linear time at each iteration.

◆ CNDVD_TMP

#define CNDVD_TMP   1

In the code, one temporary is (rarely) used to build the primal solution d; it is only used, if ever, within SolveQP() [see below]. If CNDVD_TMP == 0, SDim LMNum's are allocated in the constructor for this temporary, and deallocated in the destructor. If CNDVD_TMP > 0, no memory is allocated by BMinQuad and the caller is required to supply the memory with SettmpD() and reclaim it with GettmpD() [see].

◆ LAZY_D

#define LAZY_D   0

At any iteration of the algorithm, the value of the constrained entries of the solution d[] must be calculated; to do that, it is necessary to know all the entries z[ i ] of the "aggregated subgradient" z for each name ‘i’ that has been declared as a constrained variable. How such entries are calculated depends on LAZY_D: for each value of the switch, a different form of CalculateZ() [see] is used.

LAZY_D == 0 all such entries of z have to be computed in one blow by a single call to CalculateZ( < all > ): note that some of the entries may not be actually required in the current iteration;

LAZY_D == 1 the entries are divided in two sets, one corresponding to "active" variables and the other to "inactive" ones, with calls to CalculateZ( < a set > ); if MaxVar[Add/Rmv] == Inf< Index >() [see below] all the variables in the group will be needed each time the set is required (while those in the other set may not be needed), but if MaxVar[Add/Rmv] < Inf< Index >() some of the entries may still be calculated without a need;

LAZY_D == 2 the value of each necessary entry is requested by a call to CalculateZ( < one > ): in this case, entries corresponding to unconstrained variables are never required.

◆ LOG_BMQ

#define LOG_BMQ   0

This macro controls how (if any) BMinQuad produces a log of its activities on a ostream object set with the method SetBMQLog() [see below]:

0 => no log at all (SetBMQLog() 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 variables
  • the number of calls
  • the average number of constrained variables (in each call) (+ what is reported by MinQuad, if any);

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 of the algorithm is printed;

5 => the log is very verbose, telling the name of all variables that move in and out of the "base" of the BTT algorithm.

◆ SIGNAL_MBCHG

#define SIGNAL_MBCHG   0

In some pure virtual methods of the class [see GiTG[j](), CalculateZ() and GiTLB()], information is requested from the outside. Two groups of protected fields of the class are used by these methods, respectively (Mult, Base, BDim) by CalculateZ[h]() and (MBase2, MB2Dim, Base2, B2Dim) by GiTG[j](). If SIGNAL_XXCHG is set to one, then a pure virtual method XXHasChgd() is added to the protected interface of the class: this method is called each time the corresponding group of fields changes, giving an "hook" to derived classes to react to the changes if necessary.

◆ TWOSIDED

#define TWOSIDED   1

Often, box constraints l[ i ] <= d[ i ] <= u[ i ] are even "too general", since simple lower bounds l[ i ] <= d[ i ] suffice instead; by setting TWOSIDED == 0, we allow the code to deal only with lower bounds, saving space and time.