ConicBundle
Public Member Functions | Private Member Functions | Private Attributes | List of all members

mimicks the model of a function with an AffineFunctionTransformation (AFT) applied to it. It does so by the chain rule and calling the original model of the function. More...

#include <AFTModel.hxx>

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

Public Member Functions

void clear (AffineFunctionTransformation *inaft, CH_Matrix_Classes::Integer start_modification_id=0)
 resets all data to the inital state, except for aft which is unchanged unless inaft ist not NULL, which then replaces aft
 
virtual void clear ()
 overloads the SumBlockModel::clear calling the other clear with parameter 0
 
 AFTModel (SumBlockModel *in_model, AffineFunctionTransformation *inaft=0, CH_Matrix_Classes::Integer start_modification_id=0, bool in_model_is_owner=false, CBout *cb=0)
 sets model to in_model and model_is_owner to in_model_is_owner (or false if in_model==0) and calls clear with parameters (inaft,start_modification_id)
 
 ~AFTModel ()
 delets aft
 
const AffineFunctionTransformationget_aft () const
 allows to inspect the current AffineFunctionTransformation
 
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 &center_ub_fid, 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(CH_Matrix_Classes::Integer,const CH_Matrix_Classes::Matrix&,CH_Matrix_Classes::Integer,const CH_Matrix_Classes::Matrix&,const FunObjModMap&,const GroundsetModification&)
 
int add_variable_metric (VariableMetric &H, CH_Matrix_Classes::Integer center_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 DynamicScaling
 
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
 
int get_model_aggregate (CH_Matrix_Classes::Integer &model_aggregate_id, MinorantPointer &model_aggregate, bool all_parts=true, const AffineFunctionTransformation *aft=0)
 see SumBlockModle::get_modle_aggregate(CH_Matrix_Classes::Integer&,CH_Matrix_Classes::Real&,CH_Matrix_Classes::Matrix&,bool,bool,const AffineFunctionTransformation*)
 
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)
 
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 requestss
const PrimalDataget_approximate_primal () const
 an AFT has no primals, so it returns 1, see SumBlockModel::get_approximate_primal
 
const PrimalDataget_center_primal () const
 an AFT has no primals, so it returns 1, see SumBlockModel::get_center_primal
 
const PrimalDataget_candidate_primal () const
 an AFT has no primals, so it returns 1, see SumBlockModel::get_candidate_primal
 
virtual int call_primal_extender (PrimalExtender &)
 an AFT has no primals, so it returns 1, see SumBlockModel::call_primal_extender
 
int set_bundle_parameters (const BundleParameters &)
 an AFT has no bundle, so it returns 1, see SumBlockModel::set_bundle_parameters
 
BundleParametersget_bundle_parameters () const
 an AFT has no bundle, so it returns 1, 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 BundleQPData
std::ostream & output_bundle_data (std::ostream &out) const
 this outputs the qp model data recursively for testing purposes
 
overloaded routines of SumBlockModel for output and statistics on solution times
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()
 
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::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 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
 
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
 
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 Member Functions

SumBlockModelcond_model_trafo ()
 returns model if model_is_owner, and model->sbm_transform() otherwise
 
const SumBlockModelcond_model_trafo () const
 const version of cond_model_trafo
 
const CH_Matrix_Classes::Matrixgenerate_aft_cand (CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y)
 computes and returns a reference to the transformed point (maybe the input point itself, if identity) and assigns a new aftpoint_id if necessary More...
 
int check_function_id_change (CH_Matrix_Classes::Integer function_id)
 if a call to some function evaluation returned an increased function_id, this increases data.modification_id More...
 
int compute_qp_data (const CH_Matrix_Classes::Indexmatrix *indices=0) const
 checks whether it is necessary to precompute the qp_data and does so if required
 

Private Attributes

SumBlockModelmodel
 points to the model which this AFT works on
 
bool model_is_owner
 the following is true if the model above is the owner of this AFTModel
 
ModifiableOracleObject dummy_oracle
 the oracle object of this model
 
AffineFunctionTransformationaft
 the affine function transformation in use, must always be != NULL
 
AFTData data
 the relevant data for running BundleSolver consistently
 
CH_Matrix_Classes::Integer ncalls
 number of calls to model->eval_function or model->recompute_center
 
MinorantPointer cand_minorant
 the (lazy) transformed minorant in the candidate
 
MinorantPointer center_minorant
 the (lazy) transformed minorant in the center
 
QPConeModelDataObjectblock
 usually not used, but if aft->get_fun_coeff()==0 an empty block may have to be returned
 
std::map< MinorantPointer, MinorantPointerprecomputed
 if a MinorantPointer has already been transformed, this is stored here
 
CH_Matrix_Classes::Indexmatrix qp_indices
 if its dimension is >0 it gives the (ordered) subset of indices for which subgradient entries are needed, otherwise all indices will be needed. If compute_qp_data_now==true, these also map the row index of qp_ycost and qp_matrix to the index of y.
 
CH_Matrix_Classes::Indexmatrix old_indices
 for checking whether the old results can be reused
 

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

mimicks the model of a function with an AffineFunctionTransformation (AFT) applied to it. It does so by the chain rule and calling the original model of the function.

The AFT may be modified without necessarily invalidating the function model if the AFT results in unchanged parameters. Ususally, on intialization, the AFTModel is assigned some SumBlockModel whose transformation it represents, this is SumBlockModel is pointed to by the variable model. If model is not NULL, AFTModel first transforms the input parameters, then calls model with these, and then transforms the ouptput parameters as its output. If model is NULL, then AFTModel simply represents an affine function and its own model.

The AFTModel may be a separate model component introduced by the user or a transformation directly generated by any SumBlockModel *model as the model's own affine function transformation. In the latter case the AFTModel will be initialized by model with the parameter model_is_owner set to true, the latter is false by default. If model_is_owner is true, the AFTModel will call the model routines directly without the intermediate smb_transform(). If model_is_owner is false the model routines will be called with the intermediate smb_transform(), because this function might then have its own AFT that has to be carried out first. Similar distinctions occur in the treatment of modifications, etc.

Member Function Documentation

◆ check_function_id_change()

int ConicBundle::AFTModel::check_function_id_change ( CH_Matrix_Classes::Integer  function_id)
private

if a call to some function evaluation returned an increased function_id, this increases data.modification_id

A change in the function_id signals a modification of the function for which this is the affine fucntion transformations (AFT). As the AFT itself is not changed, the transformed evaluation points do not change, but from outside the function still looks different. This is reflected in increasing data.modification_id, but it also sets the id marks of the point and function values to the appropriate values.

Referenced by cond_model_trafo().

◆ generate_aft_cand()

const CH_Matrix_Classes::Matrix& ConicBundle::AFTModel::generate_aft_cand ( CH_Matrix_Classes::Integer  cand_id,
const CH_Matrix_Classes::Matrix cand_y 
)
private

computes and returns a reference to the transformed point (maybe the input point itself, if identity) and assigns a new aftpoint_id if necessary

If cand_id matches data.center_id or data.cand_id and the transformation has already been stored in data for the respective point and the current aft version, nothing needs to be computed, the old data is only copied to the candidate (if needed).

If cand_id is unknown or the transformation is no longer up to date (if aft was modified), an new aftpoint_id is assigned to this and the transformatoin is computed into data.aft_cand if necessary. It is not necessary if the transformation is the identity, in this case data.aft_cand is initialized to dimension zero and a reference is returned to the input point cand_y itself.

Referenced by cond_model_trafo().


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