CNDSM
1.00
|
The class Stepsize provides an interface for the stepsize rule, to be used in the SubGrad solver [see SubGrad.h]. More...
#include <Stepsize.h>
Public Member Functions | |
Constructor | |
Stepsize (SubGrad *slvr, istream *iStrm=0) | |
Constructor of the class. More... | |
Stepsize (SubGrad *slvr, istream *iStrm=0) | |
Constructor of the class. More... | |
Other initializations | |
virtual void | SetSTPLog (ostream *outs=0, const char lvl=0) |
The class outputs "log" information onto the ostream pointed by outs. More... | |
virtual void | Format (void) |
The method initializes the stepsize rule. More... | |
virtual void | SetSTPLog (ostream *outs=0, const char lvl=0) |
The class outputs "log" information onto the ostream pointed by outs. More... | |
virtual void | Format (void) |
The method initializes the stepsize rule. More... | |
Stepsize computation | |
virtual void | NewStep (void)=0 |
This method must be called before GetStepsize() [see below]. More... | |
virtual bool | NeedsdkM1Gk (void) |
Returns true if the stepsize requires the scalar product ![]() | |
virtual void | NewStep (void)=0 |
This method must be called before GetStepsize() [see below]. More... | |
virtual bool | NeedsdkM1Gk (void) |
Returns true if the stepsize requires the scalar product ![]() | |
Reading the solution | |
virtual HpNum | GetStepsize (bool StepIsIncr=false) |
This function must be called after NewStep() [see above]. More... | |
virtual HpNum | GetLev (void) |
This function must be called after NewStep() [see above]. More... | |
virtual HpNum | GetBeta (void) |
This function must be called after NewStep() [see above]. More... | |
virtual HpNum | GetStepsize (bool StepIsIncr=false) |
This function must be called after NewStep() [see above]. More... | |
virtual HpNum | GetLev (void) |
This function must be called after NewStep() [see above]. More... | |
virtual HpNum | GetBeta (void) |
This function must be called after NewStep() [see above]. More... | |
Adding / removing / changing data | |
virtual void | SetMaxBeta (const HpNum alpha) |
Changes the maximum value of ![]() | |
virtual void | SetMaxBeta (const HpNum alpha) |
Changes the maximum value of ![]() | |
Destructor | |
virtual | ~Stepsize () |
virtual | ~Stepsize () |
Protected Member Functions | |
virtual bool | UpdateTargetLevel (void) |
It tries to provide a new target level ![]() | |
virtual bool | UpdateTargetLevel (void) |
It tries to provide a new target level ![]() | |
Protected methods to read from Subgrad | |
These methods are used to provide access to the information stored into the SubGrad object. Stepsize is a "friend" of SubGrad and therefore it can read its protected data structures, but classes derived from Stepsize are not friend of SubGrad and cannot. This is why these methods are defined in the base class (and implemented in SubGrad.C). | |
HpNum | GetCoeffDefl (void) |
Returns the deflection coefficient ![]() | |
FiOracle * | GetOracle (void) |
Returns the pointer to FiOracle. More... | |
cHpNum | GetGiNorm (void) |
Returns the norm of the subgradient ![]() | |
cHpNum | GetDNorm (void) |
Returns the norm of the direction ![]() | |
cHpNum | GetdGk (void) |
Returns the scalar product ![]() | |
HpNum | GetdkM1Gk (void) |
Returns the scalar product ![]() | |
Index | GetNItIcr (void) |
Returns NItIncr, the parameter for incremental iterations [see SubGrad.h]. | |
cHpNum | ReadFkVal (void) |
Returns FiLambda [ see SubGrad.h ]. More... | |
cHpNum | ReadFiBar (void) |
Returns FiBar [ see SubGrad.h ]. More... | |
HpNum | GetCoeffDefl (void) |
Returns the deflection coefficient ![]() | |
FiOracle * | GetOracle (void) |
Returns the pointer to FiOracle. More... | |
cHpNum | GetGiNorm (void) |
Returns the norm of the subgradient ![]() | |
cHpNum | GetDNorm (void) |
Returns the norm of the direction ![]() | |
cHpNum | GetdGk (void) |
Returns the scalar product ![]() | |
HpNum | GetdkM1Gk (void) |
Returns the scalar product ![]() | |
Index | GetNItIcr (void) |
Returns NItIncr, the parameter for incremental iterations [see SubGrad.h]. | |
cHpNum | ReadFkVal (void) |
Returns FiLambda [ see SubGrad.h ]. More... | |
cHpNum | ReadFiBar (void) |
Returns FiBar [ see SubGrad.h ]. More... | |
Protected Attributes | |
SubGrad * | Solver |
(pointer to) the SubGrad solver | |
ostream * | STPLog |
the output stream object | |
char | STPLLvl |
the "level of verbosity" | |
HpNum | FiLev |
the target level ![]() | |
HpNum | Beta |
beta factor ![]() | |
HpNum | MaxBeta |
maximum value for beta factor | |
HpNum | LpsFct |
scaling factor | |
The class Stepsize provides an interface for the stepsize rule, to be used in the SubGrad solver [see SubGrad.h].
The main functions of the class are NewStep() and GetStepsize(). While NewStep() sets up a new step, the value is passed to the SubGrad solver by means of a call to GetStepsize().
The user must extend the class to one or more stepsize rules following this interface.
Constructor of the class.
The parameter `iStrm', if provided, is taken as a pointer to a istream from which the algorithmic parameters for the stepsize formula are sequentially read in the following order. Each must be placed at the beginning of a separate line, max 255 characters long, with all the rest of the line up to the first newline character '
' (apart from a separating whitespace) being available for comments. Any line whose first character is '#' and any blank line is ignored. If 0 is passed, the file ends before reaching a given parameter, or some parameter is in the wrong format, each non-specified parameter is given a default value, shown in [] below.
Only a few parameters are deemed to be general enough to be put in the basic Stepsize class; however, the same stream can be used for passing the (possibly many more) algorithmic parameters to the derived classes. Since the constructor of Stepsize is executed before the ones of the derived classes, the specific parameters for the derived classes have just to be found in the stream after those of the base class.
HpNum LpsFct [1] a general scaling factor (for instance, it is the Lipschitz factor in the target value SR)
Constructor of the class.
The parameter `iStrm', if provided, is taken as a pointer to a istream from which the algorithmic parameters for the stepsize formula are sequentially read in the following order. Each must be placed at the beginning of a separate line, max 255 characters long, with all the rest of the line up to the first newline character '
' (apart from a separating whitespace) being available for comments. Any line whose first character is '#' and any blank line is ignored. If 0 is passed, the file ends before reaching a given parameter, or some parameter is in the wrong format, each non-specified parameter is given a default value, shown in [] below.
Only a few parameters are deemed to be general enough to be put in the basic Stepsize class; however, the same stream can be used for passing the (possibly many more) algorithmic parameters to the derived classes. Since the constructor of Stepsize is executed before the ones of the derived classes, the specific parameters for the derived classes have just to be found in the stream after those of the base class.
HpNum LpsFct [1] a general scaling factor (for instance, it is the Lipschitz factor in the target value SR)
|
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.
Referenced by ColorTV::ColorTV(), FumeroTV::FumeroTV(), and Polyak::Polyak().
|
inlinevirtual |
The method initializes the stepsize rule.
Referenced by ColorTV::ColorTV(), and FumeroTV::FumeroTV().
|
pure virtual |
This method must be called before GetStepsize() [see below].
This is indeed the core of every derived class, producing a new step.
If the derived class implements a target value stepsize rule, the method must compute both the scalar and the level
.
Typically, the previous step will be unavailable after the call to NewStep() [see GetStepsize()].
|
inlinevirtual |
Returns true if the stepsize requires the scalar product .
The default implementation don't require this value.
|
inlinevirtual |
This function must be called after NewStep() [see above].
It returns the step value .
The default implementation offers support to the target value SR . For that rule the computation is based on the scalar and the level
[see NewStep()], i.e. the stepsize has the form of:
If true is passed, is required the stepsize for an inner iteration, otherwise for an outer iteration.
|
inlinevirtual |
This function must be called after NewStep() [see above].
The default implementation returns the level for a target value stepsize rule [see below]. It should throw exception for other forms of the stepsize rule.
|
inlinevirtual |
This function must be called after NewStep() [see above].
The default implementation returns the scalar for a target value stepsize rule [see below]. It should throw exception for other forms of the stepsize rule.
|
inlinevirtual |
Changes the maximum value of for a target value stepsize rule.
Typically, the method implements the safe rule of the stepsize-restricted approach. Passing the deflection coefficient does exactly this job.
|
inlineprotectedvirtual |
It tries to provide a new target level .
It true is returned, the level has been changed. By default, it returns false.
|
protected |
Returns the deflection coefficient .
|
protected |
Returns the pointer to FiOracle.
Thus, stepsize can ask directly the FiOracle object for the function information.
Referenced by ColorTV::ColorTV(), and FumeroTV::FumeroTV().
|
protected |
Returns the norm of the subgradient .
|
protected |
Returns the norm of the direction .
|
protected |
Returns the scalar product .
Referenced by ColorTV::ColorTV().
|
protected |
Returns the scalar product .
|
protected |
Returns FiLambda [ see SubGrad.h ].
Referenced by ColorTV::ColorTV(), and FumeroTV::FumeroTV().
|
protected |
Returns FiBar [ see SubGrad.h ].
|
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.
|
inlinevirtual |
The method initializes the stepsize rule.
|
pure virtual |
This method must be called before GetStepsize() [see below].
This is indeed the core of every derived class, producing a new step.
If the derived class implements a target value stepsize rule, the method must compute both the scalar and the level
.
Typically, the previous step will be unavailable after the call to NewStep() [see GetStepsize()].
|
inlinevirtual |
Returns true if the stepsize requires the scalar product .
The default implementation don't require this value.
|
inlinevirtual |
This function must be called after NewStep() [see above].
It returns the step value .
The default implementation offers support to the target value SR . For that rule the computation is based on the scalar and the level
[see NewStep()], i.e. the stepsize has the form of:
If true is passed, is required the stepsize for an inner iteration, otherwise for an outer iteration.
|
inlinevirtual |
This function must be called after NewStep() [see above].
The default implementation returns the level for a target value stepsize rule [see below]. It should throw exception for other forms of the stepsize rule.
|
inlinevirtual |
This function must be called after NewStep() [see above].
The default implementation returns the scalar for a target value stepsize rule [see below]. It should throw exception for other forms of the stepsize rule.
|
inlinevirtual |
Changes the maximum value of for a target value stepsize rule.
Typically, the method implements the safe rule of the stepsize-restricted approach. Passing the deflection coefficient does exactly this job.
|
inlineprotectedvirtual |
It tries to provide a new target level .
It true is returned, the level has been changed. By default, it returns false.
|
protected |
Returns the deflection coefficient .
|
protected |
|
protected |
Returns the norm of the subgradient .
|
protected |
Returns the norm of the direction .
|
protected |
Returns the scalar product .
|
protected |
Returns the scalar product .
|
protected |
Returns FiLambda [ see SubGrad.h ].
|
protected |
Returns FiBar [ see SubGrad.h ].