ConicBundle
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
ConicBundle::SumModel Class Reference

gives a SumBlockModel interface to a sum of (possibly AffineFunctionTransformation transformed) SumBlockModels. This allows e.g. to optimize over a nonnegative combination of convex functions, possibly each with its own cutting model. More...

#include <SumModel.hxx>

Inheritance diagram for ConicBundle::SumModel:
ConicBundle::SumBlockModel ConicBundle::BundleModel ConicBundle::VariableMetricModel ConicBundle::CBout

Classes

class  ModelData
 For each model added to the sum, there is an object ModelData that stores required information. More...
 

Public Types

typedef std::map< const FunctionObject *, ModelData * > ModelMap
 a ModelMap maps FunctionObject pointers (these must be unique) to their ModelData
 
- 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...
 

Public Member Functions

void clear ()
 resets the SumModel to its initial state, in particular it removes but does not delete any Models added in add_model() (their AFTs are deleted if not explicitly denied)
 
 SumModel (CBout *cb=0)
 constructor
 
 ~SumModel ()
 calls clear()
 
const SumBlockModelmodel (const FunctionObject *fo) const
 returns the submodel for FunctionObject fo if it in this model, otherwise 0
 
CH_Matrix_Classes::Integer nsubmodels () const
 returns the number of submodels in this model
 
int add_model (SumBlockModel *model)
 adds the model as submodel to this model (if this model may have submodels); if any error occurs the model is not added
 
SumBlockModelremove_model (const FunctionObject *fo)
 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
 
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 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
 
bool center_modified (CH_Matrix_Classes::Integer &function_modification_id, CH_Matrix_Classes::Integer center_id)
 see BundleModel::center_modified
 
int recompute_center (CH_Matrix_Classes::Integer &new_center_ub_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 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)
 see BundleModel::apply_modfication()
 
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 BundleModel::add_dynamic_scaling
 
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
ModifiableOracleObjectget_oracle_object ()
 as AFTModel has no oracle of its own, this returns the dummy oracle
 
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()
 
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 null_step_factor, 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::Integer,const CH_Matrix_Classes::Matrix&,BundleProxObject&,CH_Matrix_Classes::Real&,CH_Matrix_Classes::Real&)
 
BundleDataget_data ()
 see SumBlockModel::get_data()
 
const BundleDataget_data () const
 see SumBlockModel::get_data()
 
int set_data (BundleData *bd)
 see SumBlockModel::set_data()
 
overloaded SumBlockModel messages for direct get/set requests
const PrimalDataget_approximate_primal () const
 this has no primals, so it returns 1, see SumBlockModel::get_approximate_primal
 
const PrimalDataget_center_primal () const
 this has no primals, so it returns 1, see SumBlockModel::get_center_primal
 
const PrimalDataget_candidate_primal () const
 this has no primals, so it returns 1, see SumBlockModel::get_candidate_primal
 
virtual int call_primal_extender (PrimalExtender &)
 this has no primals, so it returns 1, see SumBlockModel::call_primal_extender
 
int set_bundle_parameters (const BundleParameters &bp)
 if bp is a SumBundleParametersObject, it is cloned, otherwise the paraemters are copied
 
const BundleParametersget_bundle_parameters () const
 see SumBlockModel::get_bundle_parameters()
 
void clear_model (bool discard_minorants_only=false)
 see SumBlockModel::clear_model
 
void clear_aggregates ()
 see SumBlockModel::clear_aggregates
 
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
 
virtual CH_Tools::Microseconds get_preeval_time () const
 see SumBlockModel::get_preeval_time()
 
virtual CH_Tools::Microseconds get_eval_time () const
 see SumBlockModel::get_eval_time()
 
virtual CH_Tools::Microseconds get_posteval_time () const
 see SumBlockModel::get_posteval_time()
 
- 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 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
 
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 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()
 
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
 
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
 

Private Attributes

ModifiableOracleObject dummy_oracle
 the oracle object of this model
 
BundleData data
 the relevant data for running BundleSolver consistently
 
ModelMap modelmap
 this holds the ModelData indexed by the (unique) FunctionObject pointer
 
std::list< const ModelData * > local_augmodel
 if the sumbundle is active, this collects all models that have a separate augmented model part and need to be called there
 
CH_Matrix_Classes::Integer ncalls
 number of (recursive) calls to eval_function or recompute_center
 
MinorantPointer cand_minorant
 the minorant in the candidate (if collected explicitly)
 
MinorantPointer center_minorant
 the minorant in the center (if collected explicitly)
 
QPSumModelDataObjectblock
 collects the blocks of the submodels
 
SumModelParametersObjectmodel_selection
 parameters and routines for choosing the models for SumBundle
 

Additional Inherited Members

- 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

gives a SumBlockModel interface to a sum of (possibly AffineFunctionTransformation transformed) SumBlockModels. This allows e.g. to optimize over a nonnegative combination of convex functions, possibly each with its own cutting model.

Here the modification_id of BundleData is increased whenever a model is added or deleted from the sum.

If SumModel contains many separate functions, having a separate model for each of the functions may be unnecessary and inefficient. Thus SumModel contains a heuristic (may be disabled) that decides which of the functions may keep its separate model and which is simply providing its subgradient information to feed a common polyhedral model for the remaining functions. The heuristic decides on the fly, whether it is worth to switch for a certain function to a local model or to the common polyhedral model. Thus each function needs to keep track of the subgradients and the aggregate in the global polyhedral model once it is told do so, so that switching back and forth does not endanger convergence. This requires some communication and SumBlockModel provides the interface for this, see the routines

Due to the different types of functions (cost and penalty) SumModle has to use of a different global model for each type appearing. For keeping consistent with the recursive structure it also needs to assume that each of its functions has these three different types of models. This makes the whole business a bit clumsy ...


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