ConicBundle
SumBundleHandler.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_SUMBUNDLEHANDLER_HXX
4 #define CONICBUNDLE_SUMBUNDLEHANDLER_HXX
5 
6 
15 #include "SumBundle.hxx"
16 //#include "BundleModel.hxx"
18 
19 namespace ConicBundle {
20 
24 
42 class SumBundleHandler: public CBout
43 {
44 private:
47 
52 
55  {
56  public:
66 
69 
70  //the following avoid introducing further function argumetns in start_augmodel
74 
77 
80 
83  };
84 
85 
87  typedef std::vector<BundleInformation*> BundleInformationVector;
89  BundleInformationVector bundleinfo;
90 
92  int init(FunctionTask ft,CH_Matrix_Classes::Real funfactor,const BundleParameters* bp);
93 
96 
99 
109 
110 
113 
116 
131  int update_model(BundleModel::ModelUpdate model_update,
132  CH_Matrix_Classes::Integer center_id,
133  const CH_Matrix_Classes::Matrix& center_y,
135  const CH_Matrix_Classes::Matrix& cand_y,
136  CH_Matrix_Classes::Real model_maxviol,
137  BundleProxObject& H,
138  FunctionTask ft);
139 
142 
145 
148 
151 
154 
156  int align_bundle(bool use_parent_update,FunctionTask ft);
157 
159  int align_bundle(bool use_parent_update);
160 
162  void clear_model(FunctionTask ft);
163 
166 
167 
168 public:
169 
171  SumBundleHandler(SumBundle& sb,const std::map<FunctionTask,CH_Matrix_Classes::Real>& factor_map,const BundleParameters* bp=0);
173  ~SumBundleHandler();
174 
176  const SumBundle* get_sumbundle() const {return sumbundle;}
177 
180  {return (sumbundle->has_bundle_for(ft));}
181 
184  {const BundleInformation* bi=bundleinfo[ft]; return (bi==0)?-1:bi->new_index;}
185 
187  bool initialization_needed(FunctionTask ft) const;
188 
190  bool initialization_needed() const;
191 
217 
220 
223 
224 
227 
229  int update_model(BundleModel::ModelUpdate model_update,
230  CH_Matrix_Classes::Integer center_id,
231  const CH_Matrix_Classes::Matrix& center_y,
233  const CH_Matrix_Classes::Matrix& cand_y,
234  CH_Matrix_Classes::Real model_maxviol,
235  BundleProxObject& H);
236 
237 
240 
243 
244 
259  int normalize_sumbundle();
260 
263 
265  int remove_contributions();
266 
285  int add_contributions();
286 
290  const CH_Matrix_Classes::Matrix& cand_y,
291  const CH_Matrix_Classes::Indexmatrix* indices,
292  FunctionTask ft);
293 
296  QPSumModelDataObject& sumblock,
298  const CH_Matrix_Classes::Matrix& cand_y,
299  const CH_Matrix_Classes::Indexmatrix* indices=0);
300 
301 
303  int make_model_aggregate(bool& increased, bool fixed);
304 
307 
309  int adjust_multiplier(bool& values_may_have_changed);
310 
330  const MinorantBundle& bundle_minorants,
331  const CH_Matrix_Classes::Matrix& coeff);
332 
347  const MinorantPointer& aggr,
348  CH_Matrix_Classes::Real aggr_coeff);
349 
350 
361  const MinorantPointer& minorant);
362 
364  void clear_model();
365 
367  void clear_aggregates();
368 
370  void clear_cand_minorants();
371 
373  int append_vars(FunctionTask ft,const CH_Matrix_Classes::Matrix& append_mat);
374 
377 
380  VariableMetric& H,
382  const CH_Matrix_Classes::Matrix& y,
383  bool descent_step,
384  CH_Matrix_Classes::Real weightu,
385  CH_Matrix_Classes::Real model_maxviol,
386  const CH_Matrix_Classes::Indexmatrix* indices=0);
387 
391  const CH_Matrix_Classes::Matrix& center_y,
392  bool descent_step,
393  CH_Matrix_Classes::Real weightu,
394  CH_Matrix_Classes::Real model_maxviol,
395  const CH_Matrix_Classes::Indexmatrix* indices=0);
396 
397 
400  const CH_Matrix_Classes::Indexmatrix& selected_indices,
402  const CH_Matrix_Classes::Matrix& cand_y,
403  CH_Matrix_Classes::Real model_maxviol) const;
404 
405 };
406 
407 
408 
409 
411 
412 }
413 
414 #endif
415 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
std::vector< BundleInformation * > BundleInformationVector
for storing separate data for ObjectiveFunciton, ConstantPenaltyFunction, AdaptivePenaltyFunction ...
Definition: SumBundleHandler.hxx:87
class for use with SumBlockModel and BundlData for storing and managing a common bundle describing (p...
Definition: SumBundle.hxx:190
SumBundleHandler(SumBundle &sb, const std::map< FunctionTask, CH_Matrix_Classes::Real > &factor_map, const BundleParameters *bp=0)
initialize the handler to handle sb and therein the parts for which factor_map sets the (initial) fun...
QPConeModelDataObject * block
the feasible set of the local quadratic model
Definition: SumBundleHandler.hxx:67
abstract interface that allows to use different -norms with a positive definite matrix in the proxi...
Definition: BundleProxObject.hxx:88
int remove_contributions()
remove own contributions to the parent and set the states correspondingly
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
SumBundleHandler * parent_handler
if there is a parent sumbundle (that this might contribute to or not), this is its handler ...
Definition: SumBundleHandler.hxx:49
int provide_model_aggregate()
see SumBlockModel::provide_model_aggregate
abstract interface for automatically generating and retrieving the qp blocks with the model data that...
Definition: QPModelDataObject.hxx:298
BundleModel::ModelUpdate tmodel_update
the ModelUpdate parameter in the latest call to updated_model
Definition: SumBundleHandler.hxx:73
int start_augmodel(QPModelDataPointer &bp, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, const CH_Matrix_Classes::Indexmatrix *indices, FunctionTask ft)
start the augmented model block for FunctionTask ft if to be handled here and increase xdim correspon...
bool initialization_needed() const
returns true if one of the parts is root with contributions but has bundle_size 0 ...
int install_external_aggregate(FunctionTask ft, const MinorantPointer &aggr, CH_Matrix_Classes::Real aggr_coeff)
replace the aggregate by one from outside
int store_aggregate(FunctionTask ft)
store the (normalized) aggregate for FunctionTask ft in its position in the bundle, potentially with forming its primal and update coeff to reflect this (the aggregate is assumed to be available in sumbundle->get_aggregate(ft), but not its primal)
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
int reassign_vars(FunctionTask ft, const CH_Matrix_Classes::Indexmatrix &map_to_old)
first calls remove_contributions(), then reassigns the rows of the bundle of minorants according to m...
int set_cand_minorant(FunctionTask ft, const MinorantPointer &minorant)
set the new minorant information of the candidate
Header declaring the class ConicBundle::SumBundleParametersObject.
SumBundle * sumbundle
this is the bundle this handler works on
Definition: SumBundleHandler.hxx:46
const AffineFunctionTransformation * aft
use this transformation when writing back to the parent bundle
Definition: SumBundleHandler.hxx:51
abstract interface extension of QPModelDataObject to allow uniform generation of tuned quadratic solv...
Definition: QPModelDataObject.hxx:144
int add_contributions()
add root parts of this sumbundle to the parent&#39;s sumbundle and set the states correspondingly ...
BundleInformationVector bundleinfo
stores separate BundleInformation for ObjectiveFunciton, ConstantPenaltyFunction, AdaptivePenaltyFunc...
Definition: SumBundleHandler.hxx:89
CH_Matrix_Classes::Real guess_curvature(const MinorantBundle &mnrts, const CH_Matrix_Classes::Indexmatrix &selected_indices, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, CH_Matrix_Classes::Real model_maxviol) const
computes an estimate of the current curvature to support SumModel in the selection of submodles ...
CH_Matrix_Classes::Integer get_new_index(FunctionTask ft) const
returns the index of the newest subgradient in the bundle
Definition: SumBundleHandler.hxx:183
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
allows to store organizational information for each FunctionTask type of bundle
Definition: SumBundleHandler.hxx:54
bool handles(FunctionTask ft)
returns true if this FunctionTask is handled
Definition: SumBundleHandler.hxx:179
abstract interface for SumBundleHandler for the model selection and variable metric seletcion routine...
Definition: SumBundleParametersObject.hxx:50
int add_variable_metric(FunctionTask ft, VariableMetric &H, CH_Matrix_Classes::Integer yid, 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
Mode
specifies for different parts of the sumbundle whether it is active and who is responsible for handli...
Definition: SumBundle.hxx:194
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
CH_Matrix_Classes::Real lb_model(CH_Matrix_Classes::Integer yid, const CH_Matrix_Classes::Matrix &y, FunctionTask ft) const
returns a quick lower bound for the model value for this FunctionTask
int set_parent_information(SumBundleHandler *parent_sbh, const AffineFunctionTransformation *aft, SumBundle::Mode in_mode)
sets a parent handler, an aft and prepares for the next in_mode. If the respective pointers are null ...
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
CH_Matrix_Classes::Integer bundle_size
current size of the bundle
Definition: SumBundleHandler.hxx:58
ModelUpdate
for informing update_model() at what stage it is called to update the bundle so that the amount of in...
Definition: BundleModel.hxx:149
CH_Matrix_Classes::Matrix old_diagonal
in dynamic scaling the previous diagonal scaling matrix
Definition: SumBundleHandler.hxx:64
CH_Matrix_Classes::Matrix old_lowrank
in dynamic scaling the previous low rank scaling matrix
Definition: SumBundleHandler.hxx:63
CH_Matrix_Classes::Indexmatrix map_to_old
if not empty, map_to_old(i) holds the minorant index of i before the most recent update (like in reas...
Definition: SumBundleHandler.hxx:61
CH_Matrix_Classes::Real increase_factor
the factor by which function_factor was increased
Definition: SumBundleHandler.hxx:68
CH_Matrix_Classes::Integer new_index
index where to write the new subgradient to
Definition: SumBundleHandler.hxx:60
CH_Matrix_Classes::Integer aggr_index
index of the aggregate
Definition: SumBundleHandler.hxx:59
int init(FunctionTask ft, CH_Matrix_Classes::Real funfactor, const BundleParameters *bp)
called by the constructor; initializes the bundleinfo depending on whether as sumbundle part exists a...
Serves for specifying parameters regarding the construction of cutting models.
Definition: CBSolver.hxx:891
BundleInformation & operator=(const BundleInformation &bi)
copies/clones only the information regarding the bundle selection; initializes other members ...
void clear_cand_minorants()
before contributing the new evaluation results, the candidates have to be cleared ...
int contribute_initial_bundle(FunctionTask ft, const MinorantBundle &bundle_minorants, const CH_Matrix_Classes::Matrix &coeff)
(re)initialize the bundle of the respective part
interface class that allows a VariableMetricModel to contribute information to a VariableMetric objec...
Definition: VariableMetric.hxx:309
CH_Matrix_Classes::Symmatrix old_sym
in dynamic scaling the previous symmetric scaling matrix
Definition: SumBundleHandler.hxx:65
CH_Matrix_Classes::Real get_increase_factor() const
returns the increase factor for the unbounded part of sumbundle, otherwise 1.
bool has_bundle_for(FunctionTask ft) const
returns true if BData exists for this mode
CH_Matrix_Classes::Real tweightu
the weight used in the latest call to update_model
Definition: SumBundleHandler.hxx:72
Header declaring the class ConicBundle::SumBundle (see ConicBundle::SumBlockModel) ...
int align_bundle(bool use_parent_update, FunctionTask ft)
align the bundle to the parent handler bh for this FunctionTask so that contributing to it is possibl...
Matrix class for real values of type Real
Definition: matrix.hxx:74
SumBundleParametersObject * sbp
holds bundle and model sizes and the model selection routine
Definition: SumBundleHandler.hxx:57
routines for updating and handling SumBundle components, possibly by cooperating over several recursi...
Definition: SumBundleHandler.hxx:42
int reassign_minorants(const CH_Matrix_Classes::Indexmatrix &map_to_old, FunctionTask ft)
afterwars position i is held by the minorant the had position map_to_old(i) before; the current bundl...
FunctionTask
Each function represented by a FunctionModel is equipped with a function_factor (it defaults to 1...
Definition: CBSolver.hxx:221
void clear_model()
first calls remove_contributions(), then discards all current models
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
int append_vars(FunctionTask ft, const CH_Matrix_Classes::Matrix &append_mat)
first calls remove_contributions(), then appends the data to the bundle of minorants ...
int adjust_multiplier(bool &values_may_have_changed)
see SumBlockModel::adjust_multiplier
CH_Matrix_Classes::Indexmatrix model_indices
the indices of the bundle minorants employed in the model, only needed at a root, not propagated recu...
Definition: SumBundleHandler.hxx:62
int update_model(BundleModel::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, FunctionTask ft)
updates the sumbundle even if not active for that FunctionTask; in this it tries to do the same as th...
abstract interface extension of QPModelDataObject for use in SumModel where several blocks are concat...
Definition: QPModelDataObject.hxx:105
int eval_model(CH_Matrix_Classes::Real &lb, CH_Matrix_Classes::Integer yid, const CH_Matrix_Classes::Matrix &y, FunctionTask ft) const
evaluate the model value for this FunctionTask
void clear_aggregates()
first calls remove_contributions(), then discards all aggregate minorants in the current model ...
int make_model_aggregate(FunctionTask ft)
the only change to SumBlockModel::make_model_aggregate() is that FunctionTask refers to the part for ...
transform a function f(z) to fun_coeff*f(arg_offset+arg_trafo*y)+linear_cost*y+fun_offset (scales the...
Definition: AffineFunctionTransformation.hxx:68
int set_bundle_parameters(FunctionTask ft, const BundleParameters &bp)
sets max_bundle_size and max_model_size for this FunctionTask; this may be increased internally if th...
int contribute_new_minorants()
once all new minorants have been collected at this level, they are passed to the next if required ...
CH_Matrix_Classes::Real tmodel_maxviol
the violation parameter used in the latest call to update_model
Definition: SumBundleHandler.hxx:71
const SumBundle * get_sumbundle() const
returns the sumbundle
Definition: SumBundleHandler.hxx:176
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
int reset_function_factor(FunctionTask ft, CH_Matrix_Classes::Real factor)
resets the value of the function factor for this part of sumbundle