NDOSolver / FiOracle
Interfaces and Solvers for NonDifferentiable Optimization
Loading...
Searching...
No Matches
Setting algorithmic parameters for the MP solution

Functions

virtual void SetLowerBound (cHpNum LwBnd=- Inf< HpNum >(), cIndex wFi=Inf< Index >())=0
 
virtual void CheckIdentical (const bool Chk=true)
 
virtual void SetMPLog (std::ostream *outs=0, const char lvl=0)
 
virtual void SetMPTime (const bool TimeIt=true)
 

Other initializations

virtual void SetPar (const int wp, cHpNum value)=0
 
virtual void SetThreads (int nthreads)
 

Detailed Description

The solution of the Master Problem may be a costly task; hence, especially in the first iterations it may just not be smart to solve it exactly. This requires properly setting algorithmic parameters of the MPSolver. At least the algorithmic parameters defined in the base class need to be handled by the derived ones, although they can possibly add their own.

Function Documentation

◆ CheckIdentical()

virtual void CheckIdentical ( const bool Chk = true)
inlinevirtual

When a new item is inserted in the bundle, checks can be done to ensure that it is not identical to other items already present, i.e., an useless duplicate [see CheckItem() below]. Since these checks can be costly, they are done only if CheckIdentical( true ) is called; by default, or if CheckIdentical( false ) is called, they are not.

Reimplemented in MPTester, OSIMPSolver, and QPPenaltyMP.

◆ SetLowerBound()

virtual void SetLowerBound ( cHpNum LwBnd = InfHpNum >(),
cIndex wFi = InfIndex >() )
pure virtual

Sets a lower bound on the value of the (translated) model Fi_{B,Lambda}; since Fi_{B,Lambda}( 0 ) = 0, LwBnd must clearly be a nonpositive value.

Note
The translated model is Fi_{B,Lambda} is only translated w.r.t. the function value in Lambda of the non-easy components, while the easy components retain their original value. This means that LwBnd must be the original value of the lower bound minus the value \sum_{ k is not an easy component } Fi[ k ]( Lambda )
In the above formula, the 0-th linear component is considered to be a non-easy component, i.e., its value has to be subtracted from the original value of the lower bound. There can hardly be an easier component than the 0-th one, but the variable in the master problem is d = Lambda1 - Lambda and the term in the objective function is RHS * d, therefore the 0-th component is naturally translated w.r.t. Fi[ 0 ]( Lambda ) like the non-easy ones.

When Fi is a decomposable function [see SetDim() above], each of its components may have a separate model Fi[ k ]_{B,Lambda}, thus this method has different meanings according to the value of wFi. For 1 <= wFi <= NrFi, the lower bound is on the individual model Fi[ wFi ]_{B,Lambda}, while for wFi > NrFi the lower bound is on the global model Fi_{B,Lambda} = sum_{k = 0 ... NrFi} Fi[ k ]_{B,Lambda}. Note that the 0-th component is taken into account for the global model, while, being a linear function, it clearly cannot have any "individual" lower bound.

Note
Individual lower bounds are meaningless for "easy" components of Fi() [see FiOracle::GetBNC() ...], and therefore they are not allowed.

These lower bounds are automatically updated when the current point Lambda is changed [see ChangeCurrPoint() below], and they are equivalent to inserting in the bundle of the proper component an all-0 subgradient with alfa_{Lambda}[ i ] = - LwBnd (which is nonnegative). The same holds for the "global" lower bound, except that it is an "aggregated" all-zero subgradient.

Passing - Inf< HpNum >() as the lower bound means that no such bound is available; this is the default.

Implemented in MPTester, OSIMPSolver, and QPPenaltyMP.

◆ SetMPLog()

virtual void SetMPLog ( std::ostream * outs = 0,
const char lvl = 0 )
inlinevirtual

The class outputs "log" information onto the ostream pointed by outs. lvl controls the "level of verbosity" of the code: lvl == 0 means that nothing at all is printed, and values larger than 0 mean increasing amounts of information, the specific effect of each value being derived- class-dependent. outs == 0 implies lvl == 0.

Reimplemented in MPTester, and QPPenaltyMP.

◆ SetMPTime()

virtual void SetMPTime ( const bool TimeIt = true)
inlinevirtual

SetMPTime() allocates an OPTtimers object [see OPTtypes.h] that should be used for timing the calls to relevant methods of the class. The time can be read with MPTime() [see below]. By default, or if SetMPTime( false ) is called, no timing is done. Note that, since all the relevant methods of the class are pure virtual, MPSolver can only manage the OPTtimers object, but it is due to derived classes to actually implement the timing.

Note that time accumulates over the calls: calling SetMPTime(), however, resets the counters, allowing to time specific groups of calls.

Reimplemented in MPTester.

◆ SetPar()

virtual void SetPar ( const int wp,
cHpNum value )
pure virtual

Change "float" algorithmic parameters of the MPSolver. This method is pure virtual, i.e., it has to be defined in derived classes, which may extend this it to allow setting the algorithmic-specific parameters.

The enum MPParam is used for selecting the parameter to be set, with the following intended meaning:

  • kMaxTme: maximum running time (in seconds) for each call to SolveMP() [see below]. A 0 or negative value means "no time limit", which should be the default. If more time required, SolveMP() should stop returning kStppd. Note that this check can only be performed if timing of the code is activated [see SetMPTime() below].
  • kOptEps: tells the solver to solve the MP only with at least the specified relative precision (>= 0), the exact meaning of this being solver-dependent. The solver can always decide to use higher precision than that, if so it prefers. By default a solver-specific "minimal" precision is used.
  • kFsbEps: tells the solver to tolerate the specified relative violation of in the (primal) constraints; the solver can always decide to use higher precision than that, if so it prefers. By default a solver-specific "minimal" precision is used.

Note that the type of ‘wp’ is int rather than MPParam, which is not a problem as enums can always be used where intsare required (i.e., SetPar( MPSolver::kMaxTime , ... ) is a valid call). This is done in order to allow derived classes to extend the set of parameters they can handle while keeping the same signature for SetPar().

Implemented in MPTester, OSIMPSolver, and QPPenaltyMP.

◆ SetThreads()

virtual void SetThreads ( int nthreads)
inlinevirtual

Set the maximum number of threads that the MPSolver is allowed to use. This method is given a default empty implementation (doing nothing) for those MPSolver that do no have any parallel processing capability.

Reimplemented in MPTester, and OSIMPSolver.