ConicBundle
|
base class for use with SumBlockModel for storing and managing essential data of evaluations and the bundle describing the model More...
#include <BundleData.hxx>
Public Member Functions | |
BundleData () | |
calls clear() | |
virtual void | clear (CH_Matrix_Classes::Integer start_modification_id=0) |
reset to initial state (also used by the default constructor) | |
virtual int | init (const BundleData *bd) |
initialize from other BundleData | |
BundleData * | clone () const |
return a pointer to a clone of this | |
virtual CH_Matrix_Classes::Integer | get_dim () const |
returns the observed dimension; intially this is negative until the first point is worked on | |
virtual FunctionTask | get_function_task () const |
the purpose or mode the function is used in, see FunctionTask | |
virtual CH_Matrix_Classes::Real | get_function_factor () const |
the factor by which the minorants (except for the aggregate) need to be multiplied in order to match the current function scaling | |
virtual CH_Matrix_Classes::Integer | get_modification_id () const |
the value is negative if not initialized and otherwise gives the number of modifications applied to the function | |
virtual CH_Matrix_Classes::Integer | get_center_modification_id () const |
the value is negative if not initialized and otherwise gives the number of modifications applied to the function | |
virtual CH_Matrix_Classes::Real | get_center_ub () const |
the value of the upper bound stored for center (without function_factor) if its modification id is up to date | |
virtual CH_Matrix_Classes::Integer | get_center_id () const |
the point id for which center was computed if its modification id is up to date | |
virtual CH_Matrix_Classes::Integer | get_cand_modification_id () const |
the value is negative if not initialized and otherwise gives the number of modifications applied to the function | |
virtual CH_Matrix_Classes::Real | get_cand_ub () const |
the value of the upper bound stored for the candidate (without function_factor) if its modification id is up to date | |
virtual CH_Matrix_Classes::Integer | get_cand_id () const |
the point id for which cand was computed if its modification id is up to date | |
const MinorantBundle & | get_old_minorants () const |
returns the bundle collected in store_old_minorants() | |
virtual int | do_step (CH_Matrix_Classes::Integer point_id) |
if the candidate information is available and consitent for point_id, copy it from cand to center and return 0, otherwise return 1 | |
virtual int | synchronize_ids (CH_Matrix_Classes::Integer &new_center_ub_fid, CH_Matrix_Classes::Integer new_center_id, CH_Matrix_Classes::Integer old_center_id, CH_Matrix_Classes::Integer &new_cand_ub_fid, CH_Matrix_Classes::Integer new_cand_id, CH_Matrix_Classes::Integer old_cand_id, CH_Matrix_Classes::Integer &new_aggregate_id, CH_Matrix_Classes::Integer new_prex_id=0) |
synchronize ids in any case by discarding inconsistent parts but return number of errors | |
virtual bool | center_modified (CH_Matrix_Classes::Integer ¢er_ub_fid, CH_Matrix_Classes::Integer check_center_id) |
check whether center computation is still valid for this point and modification id | |
virtual bool | model_aggregate_modified (CH_Matrix_Classes::Integer model_aggregate_id) |
check whether aggregate is available and has the same id | |
virtual void | clear_model (bool discard_minorants_only=false) |
clear the cutting model and all function evaluations; for special cutting models of support functions it may sometimes be possible and sufficient to keep the model and its values but to regenerate the minorants when needed; if in this case only the current minorants should be deleted, set discard_minorants_only to true. | |
virtual void | clear_aggregates () |
delete all kinds of aggregates but keep explicit parts of the cutting model | |
virtual int | call_primal_extender (PrimalExtender &, bool include_candidates=true) |
see the last argument of FunctionOracle::evaluate() | |
virtual int | apply_modification (const GroundsetModification &, MinorantExtender *mex) |
rearrange/extend the minorants according to the given groundset modifications | |
virtual const PrimalData * | get_approximate_primal () const |
return the PrimalData corresponding to the aggregate | |
virtual const PrimalData * | get_center_primal () const |
return the PrimalData corresponding to the aggregate | |
virtual const PrimalData * | get_candidate_primal () const |
return the PrimalData delivered by the last call of FunctionOracle::evaluate() | |
virtual const SumBundle & | get_sumbundle () const |
return the sumbundle | |
virtual bool | get_local_model_active () const |
return the sumbundle | |
virtual CH_Matrix_Classes::Real | get_model_curvature () const |
return a rough curvature estimate to judge the relevance of providing a good model for this oracle | |
virtual int | get_latest_minorants (MinorantBundle &latest_minorants, CH_Matrix_Classes::Integer max_number) |
the latest minorants available; the number may fall below or exceed the one requested in request_n_latest_minorants(); the minorants still need to be mutliplied by function_factor | |
virtual int | get_model_data (MinorantBundle &model_minorants, CH_Matrix_Classes::Matrix &model_coeff) const |
the minorants currently used in the model; the list may be empty or max contain other minorants than returned in get_latest_minorants(); the minorants still need to be mutliplied by function_factor | |
virtual const MinorantPointer & | get_aggregate () const |
the aggregate minorant as currently in use in the bundle method; it already includes the function_factor | |
Public Member Functions inherited from ConicBundle::VariableMetricBundleData | |
virtual | ~VariableMetricBundleData () |
virtual destructor | |
virtual const CH_Matrix_Classes::Symmatrix & | get_denseH () const |
allows to retrieve dense variable metric information stored here | |
virtual CH_Matrix_Classes::Symmatrix & | set_denseH () |
allows to retrieve the dense variable metric information generated in the previous call and allows to store the new one in the end | |
virtual const CH_Matrix_Classes::Matrix & | get_lowrankH () const |
allows to retrieve low rank variable metric information stored here | |
virtual CH_Matrix_Classes::Matrix & | set_lowrankH () |
allows to retrieve the low rank variable metric information generated in the previous call and allows to store the new one in the end | |
virtual const CH_Matrix_Classes::Matrix & | get_diagH () const |
allows to retrieve the diagonal variable metric information generated in the previous call and allows to store the new one in the end | |
virtual CH_Matrix_Classes::Matrix & | set_diagH () |
allows to retrieve the diagonal variable metric information generated in the previous call and allows to store the new one in the end | |
Public Member Functions inherited from ConicBundle::CBout | |
virtual void | set_out (std::ostream *out=0, int print_level=1) |
Specifies the output level (out==NULL: no output at all, out!=NULL and level=0: errors and warnings, level>0 increasingly detailed information) More... | |
virtual void | set_cbout (const CBout *cb, int incr=-1) |
Specifies the output level relative to the given CBout class. More... | |
void | clear_cbout () |
reset to default settings (out=0,print_level=1) | |
CBout (const CBout *cb=0, int incr=-1) | |
calls set_cbout | |
CBout (std::ostream *outp, int pl=1) | |
initialize correspondingly | |
CBout (const CBout &cb, int incr=0) | |
copy constructor | |
virtual bool | cb_out (int pl=-1) const |
Returns true if out!=0 and (pl<print_level), pl<0 should be used for WARNINGS and ERRORS only, pl==0 for usual output. | |
std::ostream & | get_out () const |
If cb_out() returned true, this returns the output stream, but it will abort if called with out==0. | |
std::ostream * | get_out_ptr () const |
returns the pointer to the output stream | |
int | get_print_level () const |
returns the print_level | |
virtual int | mfile_data (std::ostream &out) const |
writes problem data to the given outstream | |
Protected Member Functions | |
virtual FunctionTask & | set_function_task () |
the purpose or mode the function is used in, see FunctionTask | |
virtual CH_Matrix_Classes::Real & | set_function_factor () |
the factor by which the minorants (except for the aggregate) need to be multiplied in order to match the current function scaling | |
virtual CH_Matrix_Classes::Integer & | set_center_ub_mid () |
the modification_id when center was computed; -1 indicates not initialized | |
virtual MinorantPointer & | set_aggregate () |
the aggregate minorant as currently in use in the bundle method; it already includes the function_factor | |
virtual CH_Matrix_Classes::Integer & | set_aggregate_id () |
the identification number of the aggregate minorant | |
virtual SumBundle & | set_sumbundle () |
return the sumbundle | |
virtual MinorantBundle & | set_old_minorants () |
return old_minorants | |
virtual CH_Matrix_Classes::Integer | get_prex_id () const |
for keeping track of changes by primal extenders | |
Protected Attributes | |
CH_Matrix_Classes::Integer | cand_ub_mid |
modification id for which cand_ub was computed, <0 if not initialized | |
CH_Matrix_Classes::Real | cand_ub |
upper bound on function value for modification id cand_mid and candidate with point id cand_id (does not include the effect of function_factor and function_task) | |
CH_Matrix_Classes::Real | cand_relprec |
relative precision used in computing cand_ub | |
CH_Matrix_Classes::Integer | cand_id |
point id of the stored candidate | |
MinorantPointer | local_aggregate |
the local (possibly empty) aggregate linear minorant of the model handled by this and its descendants. It includes function_factor and function_task, and comprises the local_model parts and the active sumbundle parts | |
Private Member Functions | |
virtual int | store_old_minorant (MinorantPointer &minorant) |
if max_old_minorants > 0, it adds the minorant cyclically to old_minorants keeping max_old_minorants of them | |
Private Attributes | |
CH_Matrix_Classes::Integer | dim |
the incoming dimension, once it is detected, -1 if not yet clear (some need it, but it is mainly for consistency checks and should be initialized in eval_function, lb_function, recompute_center, and updated in apply_modification) | |
FunctionTask | function_task |
see FunctionTask | |
CH_Matrix_Classes::Real | function_factor |
>0, interpreted according to function_task | |
CH_Matrix_Classes::Integer | modification_id |
increased on any modification applied to the function or function_factor | |
CH_Matrix_Classes::Integer | center_ub_mid |
modification id for which center_ub was computed, <0 if not initialized | |
CH_Matrix_Classes::Real | center_ub |
upper bound on function value for modification id center_mid and center with point id center_id (does not include the effect of function_factor and function_task) | |
CH_Matrix_Classes::Real | center_relprec |
relative precision used in computing center_ub | |
CH_Matrix_Classes::Integer | center_id |
point id of the stored center | |
CH_Matrix_Classes::Integer | aggregate_id |
if available and ids match, the aggregate need not be recomputed | |
MinorantPointer | aggregate |
the aggregate linear minorant of the entire model (including function_factor and function_task) | |
bool | local_model_active |
true if the local model is initialized and contributes to the model (maybe in addition to the sumbundle) | |
SumBundle | sumbundle |
for switching/splitting between a local model and a common SumModel this stores the (potential) contribution to a common model | |
CH_Matrix_Classes::Integer | max_old_minorants |
==0 by default, otherwise it gives the maximum number of the most recent candidate minorants to be stored | |
MinorantBundle | old_minorants |
minorants collected e.g. for variable metric, holds the at most max_old_minorants most recent candidate minorants | |
CH_Matrix_Classes::Integer | minorant_nexti |
points to next position for storing in old_minorants (in a cyclic fashion) | |
CH_Matrix_Classes::Real | model_curvature |
this value >= 0 gives an estimate of the "model curvature" in cand_y (may be zero) | |
CH_Matrix_Classes::Integer | prex_id |
counter for keeping track of PriamlExtender calls | |
Friends | |
class | SumBlockModel |
class | ConeModel |
class | SumModel |
class | AFTModel |
class | AFTData |
base class for use with SumBlockModel for storing and managing essential data of evaluations and the bundle describing the model
This and all derived classes serve to store the essential part of the model, so that saving and restoring this should allow to continue from exactly the same model again. This is for supporting branch and bound approaches and the like.
It also provides some essential common data and routines that are needed for consistent handling of problem changes or contributions to a common bundle model for sums of convex functions as required by the abstract SumBlockModel extending the BundleModel.
In order to support changes on the fly while keeping the number of recomputations at a minimum, all modifications of the function or the model lead to appropriate changes in certain id counters.
In particular, a nonnegative modification_id will be increased whenever the function changes. In order to check validity of the function values of the candidate and the center, appropriate ids of the arguments (a point id - this id being assigned by BundleSolver and not here - and the modification id) are stored at evaluation together with the relative precision, so that validity of the stored results can be checked by comparing the ids to the current values. A negative id will always signal an uninitiliazed or outdated number. This is used, e.g., if information is discarded by clear_model().
The handling of the model aggregate is a bit different, because its validity and availablility depends on the changes of the cutting model, which may have many different causes. Furthermore the aggregate may consist of different parts due to contriubtions in the SumBundle. The aggregate_id is increased whenever a new aggregate is computed (all parts will be computed at the same time). The overall aggregate can be marked invalid by setting aggregate to empty (no need to increase the aggregate id at such an occasion).
The part stored in local_aggregate represents the model parts handled by the model itself or by its descendants, i.e., it includes the local part, the root parts of its SumBundleHandler and the local parts of its descendants. It does not contain the contributions of itself and its descendants to the SumBundle of a parent. In particular, if the entire model is contributed to the SumBundle of a parent, local_aggregate will be empty.
The full aggregate contains all parts, i.e., on top of the local_aggregate it includes the aggregate of the contributions of itself and its descendants. In essence, the aggregate gives the full aggregate of the entire model representing this funciton with all its descendants.