ConicBundle
|
implements (as a derived class of ConeModel) a standard cutting plane model for a MatrixBoxOracle More...
#include <BoxModel.hxx>
Public Member Functions | |
virtual void | clear () |
resets all data to initial status of this class, also the bundle parameters | |
BoxModel (BoxOracle *fo, CH_Matrix_Classes::Real fun_factor=1., FunctionTask fun_task=ObjectiveFunction, CBout *cbout=0, int cbinc=-1) | |
construct a model for the MatrixBoxOracle pointed to by fo | |
~BoxModel () | |
calls clear() and deletes the bundle parameters | |
implemented/overloaded routines of SumBlockModel | |
ModifiableOracleObject * | get_oracle_object () |
returns the oracle | |
CH_Matrix_Classes::Real | lb_function (CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y) |
see SumBlockModel::lb_function | |
BundleData * | get_data () |
see SumBlockModel::get_data | |
const BundleData * | get_data () const |
see SumBlockModel::get_data | |
int | set_data (BundleData *bd) |
see SumBlockModel::set_data | |
overloaded SumBlockModel messages for direct get/set requestss | |
const PrimalData * | get_approximate_primal () const |
see SumBlockModel::get_approximate_primal | |
const PrimalData * | get_center_primal () const |
see SumBlockModel::get_cneter_primal | |
const PrimalData * | get_candidate_primal () const |
see SumBlockModel::get_candidate_primal | |
int | call_primal_extender (PrimalExtender &prex) |
see SumBlockModel::call_primal_extender | |
int | set_bundle_parameters (const BundleParameters &bp) |
see SumBlockModel::set_bundle_parameters | |
virtual BundleParameters * | get_bundle_parameters () const |
see SumBlockModel::get_bundle_parameters | |
int | get_ret_code () const |
see SumBlockModel::get_ret_code() | |
overloaded routines of SumBlockModel for output and statistics on solution times | |
void | set_out (std::ostream *o=0, int pril=1) |
set output and outputlevel of warnings and errors recursively, see CBout | |
Public Member Functions inherited from ConicBundle::ConeModel | |
ConeModel (CBout *cb=0, int incr=-1) | |
construct a model for the MatrixFunctionOracle pointed to by fo | |
virtual | ~ConeModel () |
calls clear() and deletes the bundle parameters | |
int | eval_function (CH_Matrix_Classes::Integer &ub_fid, CH_Matrix_Classes::Real &ub, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real nullstep_bound, CH_Matrix_Classes::Real relprec) |
see BundleModel::eval_function | |
int | eval_model (CH_Matrix_Classes::Real &lb, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real relprec) |
see BundleModel::eval_model | |
int | update_model (ModelUpdate model_update, CH_Matrix_Classes::Integer center_id, const CH_Matrix_Classes::Matrix ¢er_y, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, CH_Matrix_Classes::Real model_maxviol, BundleProxObject &H) |
see BundleModel::update_model | |
int | recompute_center (CH_Matrix_Classes::Integer &new_center_fid, CH_Matrix_Classes::Real &new_center_ub, CH_Matrix_Classes::Integer center_id, const CH_Matrix_Classes::Matrix &y, bool accept_only_higher_values=false, CH_Matrix_Classes::Real relprec=-1.) |
see BundleModel::recompute_center | |
bool | model_aggregate_modified (CH_Matrix_Classes::Integer old_model_aggregate_id) |
see BundleModel::model_aggregate_modified | |
int | provide_model_aggregate (CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y) |
see BundleModel::provide_model_aggregate | |
int | check_center_validity_by_candidate (bool &cand_minorant_is_below, CH_Matrix_Classes::Integer center_id, const CH_Matrix_Classes::Matrix ¢er_y) |
see BundleModel::check_center_validity_by_candidate | |
int | make_model_aggregate (bool &penalty_parameter_increased, bool keep_penalty_fixed) |
see SumBlockModel::make_model_aggregate | |
int | get_function_minorant (MinorantPointer &minorant, const AffineFunctionTransformation *aft=0) |
see SumBlockModel::get_function_minorant() | |
int | get_center_minorant (MinorantPointer &minorant, const AffineFunctionTransformation *aft=0) |
see SumBlockModel::get_center_minorant() | |
int | adjust_multiplier (bool &values_may_have_changed) |
see SumBlockModel::adjust_multiplier() | |
int | sumbundle_mode (SumBundle::Mode &mode, SumBundleHandler *bh=0, AffineFunctionTransformation *aft=0) |
see SumBlockModel::sumbundle_mode | |
virtual int | start_sumaugmodel (QPModelDataPointer &blockp, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, const CH_Matrix_Classes::Indexmatrix *indices=0, SumBundleHandler *bh=0, SumBundle::Mode mode=SumBundle::inactive, AffineFunctionTransformation *aft=0) |
see BundleModel::start_augmodel() for the first four parameters; for the others see sumbundle_contribution() | |
virtual int | update_model (ModelUpdate model_update, CH_Matrix_Classes::Integer center_id, const CH_Matrix_Classes::Matrix ¢er_y, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, CH_Matrix_Classes::Real model_maxviol, BundleProxObject &H, CH_Matrix_Classes::Real &model_deviation, CH_Matrix_Classes::Real &model_curvature) |
see SumBlockModle::update_model(ModelUpdate,CH_Matrix_Classes::Integer,const CH_Matrix_Classes::Matrix&,CH_Matrix_Classes::Real,CH_Matrix_Classes::Real,CH_Matrix_Classes::Real&,CH_Matrix_Classes::Real&) | |
void | clear_model (bool discard_minorants_only) |
modifications of this specific problem were such that old subgradient data and function values have to be removed completely; do so. In the special case of some particular support functions it may be possile to regenerate some of the minorants and keep the core of the model of the support set; in this case set discard_minorants_only=true. | |
void | clear_aggregates () |
see SumBlockModel::clear_aggregates | |
Public Member Functions inherited from ConicBundle::SumBlockModel | |
virtual | ~SumBlockModel () |
destructor | |
int | initialize_aft (AffineFunctionTransformation *aft=0) |
first it discards an old affine function transformation if there is one, then it sets the new one, if there ins one. | |
virtual int | set_variable_metric_selection (VariableMetricSelection *vms=0) |
delete old selector and set a new one (0 is allowed resulting in no local selector) | |
virtual VariableMetricSelection * | get_variable_metric_selection () const |
delete old selector and set a new one (0 is allowed resulting in no local selector) | |
bool | call_aftmodel_first (const FunObjModMap &funmdfmap) |
in apply_modification this routine is needed to check whether the aftmodel is modified already More... | |
SumBlockModel (CBout *cb=0, int cbinc=-1) | |
calls clear | |
virtual const SumBlockModel * | model (const FunctionObject *) const |
returns the submodel for FunctionObject fo if it in this model, otherwise 0 | |
virtual CH_Matrix_Classes::Integer | nsubmodels () const |
returns the number of submodels in this model (direct ones, not all descendants; most have none, but see e.g. SumModel) | |
virtual int | add_model (SumBlockModel *) |
adds the model as submodel to this model (if this model may have submodels) | |
virtual SumBlockModel * | remove_model (const FunctionObject *) |
remove the submodel identified by fo from this model, this does NOT destruct the model. It returns the pointer to the model if there is one, otherwise 0 | |
virtual SumBlockModel * | remove_model (SumBlockModel *model) |
remove the submodel identified by the given models FunctionObject from this model, this does NOT destruct the model. It returns the pointer to the model if there is one, otherwise 0 | |
virtual int | start_augmodel (QPModelDataPointer &blockp, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, const CH_Matrix_Classes::Indexmatrix *indices=0) |
see BundleModel::start_augmodel, here it just moves on to start_sumaugmodel | |
virtual int | get_model_aggregate (CH_Matrix_Classes::Integer &model_aggregate_id, MinorantPointer &model_aggregate) |
see BundleModel::get_model_aggregate | |
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) |
see BundleModel::synchronize_ids | |
virtual bool | center_modified (CH_Matrix_Classes::Integer ¢er_fid, CH_Matrix_Classes::Integer center_id) |
see BundleModel::center_modified | |
virtual int | apply_modification (bool &no_changes, const GroundsetModification &gsmdf, const FunObjModMap &funmdfmap, CH_Matrix_Classes::Integer new_center_id, const CH_Matrix_Classes::Matrix &new_center, CH_Matrix_Classes::Integer old_center_id, const CH_Matrix_Classes::Matrix &old_center) |
passes on modification information about function and ground set changes More... | |
int | add_variable_metric (VariableMetric &H, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, bool descent_step, CH_Matrix_Classes::Real weightu, CH_Matrix_Classes::Real model_maxviol, const CH_Matrix_Classes::Indexmatrix *indices=0) |
see VariableMetricModel::add_variable_metric; this implements the non local option | |
int | get_function_minorant (CH_Matrix_Classes::Integer &function_modification_id, MinorantPointer &minorant) |
see BundleModel::get_function_minorant() | |
int | get_center_minorant (CH_Matrix_Classes::Integer &function_modification_id, MinorantPointer &minorant) |
see BundleModel::get_center_minorant() | |
BundleModel * | transform () |
if an affine function transformation is defined for this model, return it, otherwise use this | |
SumBlockModel * | sbm_transform () |
like BundleModel::transform() this allows SumBlockModel routines to use a given transformation automatically | |
virtual int | get_model_aggregate (CH_Matrix_Classes::Integer &model_aggregate_id, MinorantPointer &model_aggregate, bool all_parts, const AffineFunctionTransformation *aft=0) |
returns the model aggregate if available. More... | |
AFTModel * | get_aftmodel () |
returns aftmodel | |
const AFTModel * | get_aftmodel () const |
returns aftmodel (as a const variant) | |
virtual int | set_sumbundle_parameters (const BundleParameters &) |
set max_bundle_size and max_model_size (this may differ if the parameter is a derived class, in particular a SumBunldeParametersObject); model blocks without bundle return 1. | |
virtual const SumBundleParametersObject * | get_sumbundle_parameters () const |
returns the current parameter settings; model blocks without bundle parameters return NULL. | |
CH_Tools::Microseconds | get_evalmodel_time () const |
return time spent in total for evaluating the model in eval_model() | |
CH_Tools::Microseconds | get_updatemodel_time () const |
return time spent in total for updating the model in update_model() | |
virtual CH_Tools::Microseconds | get_preeval_time () const |
return time spent in total for the oracle in eval_function() | |
virtual CH_Tools::Microseconds | get_eval_time () const |
return time spent in total for the oracle in eval_function() | |
virtual CH_Tools::Microseconds | get_posteval_time () const |
return time spent in total for the oracle in eval_function() | |
CH_Tools::Microseconds | get_metric_time () const |
return time spent in total for the add_variable_metric routine | |
std::ostream & | print_statistics (std::ostream &out) const |
output the timing statistics | |
void | set_cbout (const CBout *cb, int incr) |
set output and outputlevel of warnings and errors recursively with CBout | |
Public Member Functions inherited from ConicBundle::BundleModel | |
BundleModel (CBout *cb=0, int cbinc=-1) | |
constructor (cb allows to set output options) | |
virtual | ~BundleModel () |
virtual destructor | |
VariableMetricModel * | variable_metric_transform () |
replaces variable_metric_transform by transform | |
Public Member Functions inherited from ConicBundle::VariableMetricModel | |
VariableMetricModel (CBout *cb=0, int cbincr=-1) | |
constructor for passing on ouptut information | |
virtual | ~VariableMetricModel () |
virtual destructor | |
Public Member Functions inherited from ConicBundle::CBout | |
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 | |
Private Member Functions | |
int | adapt_bundle_to_parameters (CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y) |
— support routines More... | |
virtual bool | clear_aggregates_clears_minorants () |
returns true if clear_aggregates() also clears all minorant information and this does not harm the rest of the model during modifications (i.e., not routine for extending/adapting minorants is required) | |
implemented methods required by ConeModel | |
virtual int | evaluate_oracle (CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real nullstep_bound, CH_Matrix_Classes::Real relprec) |
see SumBlockModel::eval_function() but ignore ub_fid and ub with function_factor and function_task, this is set outside. Set the data.cand* information and in particular data.cand_ub_mid to data.get_modification_id() if the evaluation results make some sense even in the presence of errors. Please measure the oracle's SumBlockModel::eval_time as well as SumBlockModel::preeval_time and SumBlockModel::posteval_time here if this information is of interest | |
virtual int | provide_local_aggregate (CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &iny) |
see SumBlockModel::provide_model_aggregate(), only called if local model is active | |
virtual int | evaluate_local_model (CH_Matrix_Classes::Real &lb, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real relprec) |
see SumBlockModel::eval_model() but ignore function_factor and function_task, this is set by ConeModel::eval_model(); note: evalmodel_time is already kept by ConeModel | |
virtual int | update_local_model (ModelUpdate model_update, CH_Matrix_Classes::Integer center_id, const CH_Matrix_Classes::Matrix ¢er_y, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real model_maxviol, BundleProxObject &H) |
see SumBlockModel::update_model(); it is called irrespective of whether the local model is active or not; in particular, data.do_step() has to be called here if model_update==descent_step (this has the purpose to allow the local model to use the data of the old center before it is overwritten by the current candidate); model_maxviol and H are as passed to ConeModel by SumBlockModel::update_model(); note: updatemodel_time is already kept by ConeModel | |
virtual int | switch_to_local (const MinorantBundle &sumbundle_model, const CH_Matrix_Classes::Matrix &sumbundle_coeff) |
the local model has to take over after sumbundle was active; current_model holds the final model and coefficients so that the local model can take over whatever it needs, in particualr the aggregate | |
virtual int | get_aggregate_and_coefficient (MinorantPointer &sumbundle_aggr, CH_Matrix_Classes::Real &aggr_coeff) |
the sumbundle is initialized (not necessarily switched on) and needs to know the normalized aggregate of the local model without the influence of the function_factor as well as the coefficient reflecting the influnce of the function_factor; this is called in alternative to start_local_augmodel, so some information has to be available | |
virtual int | start_local_augmodel (QPModelDataPointer &qpblockp, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, const CH_Matrix_Classes::Indexmatrix *needed_indexsubset) |
see SumBlockModel::start_augmodel(); the local QP block is exclusively organized here; the routine is only called, if the local modle is active | |
virtual int | make_local_aggregate (CH_Matrix_Classes::Real &new_function_factor, bool keep_penalty_fixed) |
see SumBlockModel::make_model_aggregate for the general rationale; the routine is only called, if the local modle is active; if the local model decides to increase the function factor, it reports back this value in new_function_factor (only allowed if keep_penalty_fixed==false); the new data.function_factor and the modification ids are the set in ConeModel | |
virtual int | local_adjust_multiplier (CH_Matrix_Classes::Real &new_function_factor) |
see SumBlockModel::adjust_multiplier(); the routine is only called for adaptive penalty functions and if the local model is active; if the local model decides to adapt the function factor (here it is typically decreased), it reports back this value in new_function_factor; the new data.function_factor and the modification ids are the set in ConeModel | |
virtual bool | candidate_available () |
returns true if candidate information (always the results of the most recent function evaulation) is available and up to date (no model changes in the meantime) | |
virtual MinorantPointer & | provide_cand_minorant () |
if it cannot be provided it returns a minorant with valid()==false | |
virtual MinorantPointer & | provide_center_minorant () |
if it cannot be provided it returns a minorant with valid()==false | |
Private Attributes | |
BoxOracle * | oracle |
points to the MatrixBoxOracle for which it implements the cutting plane model | |
BoxData | data |
the relevant data for running BundleSolver consistently | |
BoxModelParametersObject * | model_selection |
parameters for steering size and update strategy of the cutting plane model | |
int | ret_code |
return value of the last call to MatrixBoxOracle::evaluate() | |
CH_Matrix_Classes::Integer | nr_eval |
total number of oralce calls (to MatrixBoxOracle::evaluate()) | |
QPConeModelDataObject * | block |
describes the feasible convex combinations of the bundle vectors | |
Additional Inherited Members | |
Public Types inherited from ConicBundle::BundleModel | |
enum | ModelUpdate { new_subgradient, descent_step, null_step } |
for informing update_model() at what stage it is called to update the bundle so that the amount of information available is clear More... | |
abstract methods to be filled with oracle and cutting model specific content | |
Protected Attributes inherited from ConicBundle::SumBlockModel | |
CH_Tools::Clock | clock |
for collecting time statistics | |
CH_Tools::Microseconds | evalmodel_time |
total time spent in evaluating the model in eval_model() | |
CH_Tools::Microseconds | updatemodel_time |
total time spent in updating the bundle in update_model() | |
CH_Tools::Microseconds | eval_time |
total time spent in the oracle in eval_function() or calls to eval_function of children | |
CH_Tools::Microseconds | preeval_time |
total time spent in eval_function() before the oracle call | |
CH_Tools::Microseconds | posteval_time |
total time spent in eval_function() after the oracle call | |
CH_Tools::Microseconds | metric_time |
total time spent in add_variable_metric() | |
AFTModel * | aftmodel |
if not NULL this points to an AFTModel describing an AffineFunctionTransformation | |
VariableMetricSelection * | vm_selection |
if not NULL this points to the selection routine for computing the local contribution to the metric | |
SumBundleHandler * | bundlehandler |
if the sumbundle is used, this points to the handler that operates it | |
SumBundleParametersObject * | sumbundle_parameters |
this holds the default settings whether and how to start or contribute to a SumBundle | |
MinorantPointer | old_model_aggregate |
for testing purposes | |
implements (as a derived class of ConeModel) a standard cutting plane model for a MatrixBoxOracle
|
private |
— support routines
reorganizes the local bundle if supplied from outside, e.g. by a sumbundlehandler