ConicBundle
Public Member Functions | List of all members

provides a general abstract base class for conic cutting models with SumBundle capabilities (as a derived class of SumBlockModel) More...

#include <ConeModel.hxx>

Inheritance diagram for ConicBundle::ConeModel:
ConicBundle::SumBlockModel ConicBundle::BundleModel ConicBundle::VariableMetricModel ConicBundle::CBout ConicBundle::BoxModel ConicBundle::NNCModel ConicBundle::PSCModel ConicBundle::SOCModel

Public Member Functions

virtual void clear ()
 resets all data to initial status of this class, also the bundle parameters
 
 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
 
implementations of abstract class BundleModel (maybe overloading some of SumBlockModel)
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 &center_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 &center_y)
 see BundleModel::check_center_validity_by_candidate
 
implemented/overloaded routines of SumBlockModel
int make_model_aggregate (bool &penalty_parameter_increased, bool keep_penalty_fixed)
 see SumBlockModel::make_model_aggregate
 
CH_Matrix_Classes::Real lb_function (CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y)
 see SumBlockModel::lb_function
 
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 &center_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&)
 
messages for direct get/set requestss
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 VariableMetricSelectionget_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 ModifiableOracleObjectget_oracle_object ()=0
 return the function oracle this provides a model for, or some dummy oracle
 
virtual const SumBlockModelmodel (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 SumBlockModelremove_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 SumBlockModelremove_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 &center_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()
 
BundleModeltransform ()
 if an affine function transformation is defined for this model, return it, otherwise use this
 
SumBlockModelsbm_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...
 
AFTModelget_aftmodel ()
 returns aftmodel
 
const AFTModelget_aftmodel () const
 returns aftmodel (as a const variant)
 
virtual BundleDataget_data ()=0
 returns the essential information on the bundle date for continuing from the same point lateron, see BundleData
 
virtual const BundleDataget_data () const =0
 const version returning the essential information on the bundle date for continuing from the same point lateron, see BundleData
 
virtual int set_data (BundleData *)
 reinstalls the bundle date from get_data() for continuing from this previous point, see BundleData
 
virtual const PrimalDataget_approximate_primal () const
 if primal data is provided by the oracle then the primal corresponding to the current aggregate is formed in primal (this may differ if primal is a recognized derived class)
 
virtual const PrimalDataget_center_primal () const
 if primal data is provided by the oracle then the primal corresponding to the best eps-subgradient of the evaluation in the current center is returned (this may differ if primal is a recognized derived class)
 
virtual const PrimalDataget_candidate_primal () const
 if primal data is provided by the oracle then the primal corresponding to the best eps-subgradient of the evaluation in the current center is returned (this may differ if primal is a recognized derived class)
 
virtual int call_primal_extender (PrimalExtender &pext)
 if the function is the Lagrangian dual and primal_data of previous calls has now to be updated due to changes in the primal problem – e.g., this may happen in column generation – the problem updates all its internally stored primal_data objects by calling PrimalExtender::extend on each of these. returns 0 on success, 1 if not applicable to this function, 2 if it would be applicable but there is no primal data.
 
virtual int set_bundle_parameters (const BundleParameters &)
 set max_bundle_size and max_model_size (this may differ if the parameter is a recognized derived class); model blocks without bundle return 1.
 
virtual const BundleParametersget_bundle_parameters () const
 returns the current parameter settings; model blocks without bundle parameters return NULL.
 
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 SumBundleParametersObjectget_sumbundle_parameters () const
 returns the current parameter settings; model blocks without bundle parameters return NULL.
 
virtual int get_ret_code () const
 for functions given by an oracle: return the return value that was produced by the last call to the function evaluation routine; model blocks without oracle return 0.
 
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_out (std::ostream *o=0, int pril=1)
 set output and outputlevel of warnings and errors recursively, see CBout
 
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
 
VariableMetricModelvariable_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
 

Protected Member Functions

abstract methods to be filled with oracle and cutting model specific content
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)=0
 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 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)=0
 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 &center_y, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real model_maxviol, BundleProxObject &H)=0
 see BundleModel::update_model() for the general setting; More...
 
virtual int switch_to_local (const MinorantBundle &sumbundle_model, const CH_Matrix_Classes::Matrix &sumbundle_coeff)=0
 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)=0
 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)=0
 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 provide_local_aggregate (CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &iny)=0
 see SumBlockModel::provide_model_aggregate(), only called if local model is active
 
virtual int make_local_aggregate (CH_Matrix_Classes::Real &new_function_factor, bool keep_penalty_fixed)=0
 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)=0
 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 ()=0
 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 MinorantPointerprovide_cand_minorant ()=0
 if it cannot be provided it returns a minorant with valid()==false
 
virtual MinorantPointerprovide_center_minorant ()=0
 if it cannot be provided it returns a minorant with valid()==false
 

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...
 
- 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()
 
AFTModelaftmodel
 if not NULL this points to an AFTModel describing an AffineFunctionTransformation
 
VariableMetricSelectionvm_selection
 if not NULL this points to the selection routine for computing the local contribution to the metric
 
SumBundleHandlerbundlehandler
 if the sumbundle is used, this points to the handler that operates it
 
SumBundleParametersObjectsumbundle_parameters
 this holds the default settings whether and how to start or contribute to a SumBundle
 
MinorantPointer old_model_aggregate
 for testing purposes
 

Detailed Description

provides a general abstract base class for conic cutting models with SumBundle capabilities (as a derived class of SumBlockModel)

the rountines deal with all administrative aspects of SumBundle and SumBundleHandler and call local versions for the oracle and cutting model specific parts.

Note, this base class only allows for either having or contributing to an active SumBundle model or for having an active local model, but not both can be active at the same time. Before initialization it may happen that both are inactive, but once the model is initialized, exactly one of data.sumbundle.active() and data.local_model_active will be true (the correct value will be ensured by ConeModel). This still allows that both models are updated simultaneously, sumbundle by ConeModel and the full cutting model by the derived class, if this is so desired. Usually this is difficult because the QP solution is missing for one of them.

The local model is under full control of the derived class; the derived class also has to manage its own QPModelDataObject. In terms of the aggregate the derived class has to use and manipulate data.local_model_aggregate exclusively and only if it is active. If the sumbundle is active, also the data.local_model_aggregate will be handled ConeModel. The full aggregate data.model_aggregate is always and exclusively handled by ConeModel.

For the data.sumbundle the only point of contact for the derived class is sumbundle_mode(); see the explanations given there.

Member Function Documentation

◆ update_local_model()

virtual int ConicBundle::ConeModel::update_local_model ( ModelUpdate  model_update,
CH_Matrix_Classes::Integer  center_id,
const CH_Matrix_Classes::Matrix center_y,
CH_Matrix_Classes::Integer  y_id,
const CH_Matrix_Classes::Matrix y,
CH_Matrix_Classes::Real  model_maxviol,
BundleProxObject H 
)
protectedpure virtual

see BundleModel::update_model() for the general setting;

The routine 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 BundleModel::update_model();

note: updatemodel_time is already kept by ConeModel

Implemented in ConicBundle::PSCModel, ConicBundle::SOCModel, ConicBundle::BoxModel, and ConicBundle::NNCModel.


The documentation for this class was generated from the following file: