ConicBundle
BoxModel.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_BOXMODEL_HXX
4 #define CONICBUNDLE_BOXMODEL_HXX
5 
13 #include "ConeModel.hxx"
15 #include "BoxData.hxx"
16 
17 
18 namespace ConicBundle {
19 
23 
28 class BoxModel: public ConeModel
29 {
30 private:
31 
32  //--- problem description
35  //--- data describing the model
40 
41  //--- data of last oracle evaluation
43  int ret_code;
46 
47  //--- augmented model solver
50 
52 
55  const CH_Matrix_Classes::Matrix& cand_y);
56 
57 
60  {return true;}
61 
62  //----------------------------------------------------------------------
65 
66 
70  CH_Matrix_Classes::Real nullstep_bound,
71  CH_Matrix_Classes::Real relprec);
72 
75  const CH_Matrix_Classes::Matrix& iny);
76 
81  CH_Matrix_Classes::Real relprec);
82 
84  virtual int update_local_model(ModelUpdate model_update,
86  const CH_Matrix_Classes::Matrix& center_y,
89  CH_Matrix_Classes::Real model_maxviol,
90  BundleProxObject& H);
91 
92 
94  virtual int switch_to_local( const MinorantBundle& sumbundle_model,
95  const CH_Matrix_Classes::Matrix& sumbundle_coeff);
96 
98  virtual int get_aggregate_and_coefficient(MinorantPointer& sumbundle_aggr,
99  CH_Matrix_Classes::Real& aggr_coeff);
100 
101 
103  virtual int start_local_augmodel(QPModelDataPointer& qpblockp,
105  const CH_Matrix_Classes::Matrix& cand_y,
106  const CH_Matrix_Classes::Indexmatrix* needed_indexsubset);
107 
109  virtual int make_local_aggregate(CH_Matrix_Classes::Real& new_function_factor,
110  bool keep_penalty_fixed);
111 
113  virtual int local_adjust_multiplier(CH_Matrix_Classes::Real& new_function_factor);
114 
116  virtual bool candidate_available()
117  {return (data.cand_ub_mid==data.get_modification_id())&&(data.cand_minorant.valid()); }
118 
121 
124 
125 
127 
128 public:
130  virtual void clear();
131 
133  BoxModel(BoxOracle* fo,CH_Matrix_Classes::Real fun_factor=1.,FunctionTask fun_task=ObjectiveFunction,CBout* cbout=0,int cbinc=-1);
134 
136  ~BoxModel();
137 
138 
139  //----------------------------------------------------------------------
142 
143 
144  //eval_function //as in ConeModel
145 
146  //eval_model //as in ConeModel
147 
148  //eval_augmodel //as in SumBlockModel
149 
150  //reeval_augmodel //as in SumBlockModel
151 
152  //get_model_aggregate(three parameters) //as in SumBlockModel
153 
154  //update_model //as in ConeModel
155 
156  //synchronize_ids //as in SumBlockModel
157 
158  //center_modified //as in SumBlockModel
159 
160  //recompute center //as in ConeModel
161 
162  //model_aggregate_modified //as in ConeModel
163 
164  //provide_model_aggregate //as in ConeModel
165 
166  //apply_modification //as in SumBlockModel
167 
168  //add_variable_metric //as in SumBlockModel
169 
170  //check_center_validity_by_candidate //as in ConeModel
171 
173 
174  //----------------------------------------------------------------------
177 
180 
181  //start_augmodel //as in ConeModel
182 
183  // make_model_aggregate //as in ConeModel
184 
185  //get_model_aggregate(... aft=0) //as in SumBlockModel
186 
189  const CH_Matrix_Classes::Matrix& y);
190 
191  // get_function_minorant //as in ConeModel
192 
193  // get_center_minorant //as in ConeModel
194 
195  // adjust_multiplier //as in ConeModel
196 
197  // sumbundle_contribution //as in ConeModel
198 
199 
200  // as in 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&)
201 
203  BundleData* get_data() {return &data;}
204 
206  const BundleData* get_data() const {return &data;}
207 
209  int set_data(BundleData* bd){return data.init(bd);}
210 
212 
213  //----------------------------------------------------------------------
214 
217 
218 
221  { return data.get_approximate_primal(); }
222 
225  { return data.get_center_primal();}
226 
229  { return data.get_candidate_primal();}
230 
233  { return data.call_primal_extender(prex); }
234 
237 
240  {return model_selection;}
241 
242  // clear_model() //as in ConeModel
243 
244  // clear_aggregates() //as in ConeModel
245 
247  int get_ret_code() const {return ret_code;}
248 
249 
251 
252  //----------------------------------------------------------------------
255 
256  //get_QPcoeff_time() // as in SumBlockModel
257 
258  //get_QPsolve_time() // as in SumBlockModel
259 
260  //get_evalaugmodel_time() // as in SumBlockModel
261 
262  //get_evalmodel_time() // as in SumBlockModel
263 
264  //get_updatemodel_time() // as in SumBlockModel
265 
266  //get_eval_time() // as in SumBlockModel
267 
269  void set_out(std::ostream* o=0,int pril=1)
270  {
271  SumBlockModel::set_out(o,pril);
272  if (block)
273  block->set_cbout(this,-1);
274  if (model_selection)
275  model_selection->set_cbout(this,0);
276  }
277 
278  //set_cbout() // calls set_out in SumBlockModel
279 
281 
282 
283 };
284 
286 
287 }
288 
289 #endif
290 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
virtual BundleParameters * get_bundle_parameters() const
see SumBlockModel::get_bundle_parameters
Definition: BoxModel.hxx:239
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...
CH_Matrix_Classes::Integer cand_ub_mid
modification id for which cand_ub was computed, <0 if not initialized
Definition: BundleData.hxx:120
abstract interface that allows to use different -norms with a positive definite matrix in the proxi...
Definition: BundleProxObject.hxx:88
BoxModelParametersObject * model_selection
parameters for steering size and update strategy of the cutting plane model
Definition: BoxModel.hxx:39
virtual bool clear_aggregates_clears_minorants()
returns true if clear_aggregates() also clears all minorant information and this does not harm the re...
Definition: BoxModel.hxx:59
int set_bundle_parameters(const BundleParameters &bp)
see SumBlockModel::set_bundle_parameters
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
const PrimalData * get_center_primal() const
see SumBlockModel::get_cneter_primal
Definition: BoxModel.hxx:224
abstract interface for automatically generating and retrieving the qp blocks with the model data that...
Definition: QPModelDataObject.hxx:298
int adapt_bundle_to_parameters(CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y)
— support routines
virtual void clear()
resets all data to initial status of this class, also the bundle parameters
const PrimalData * get_approximate_primal() const
return the PrimalData corresponding to the aggregate
bool valid() const
returns true if the pointer is not empty and the data is valid
Definition: MinorantPointer.hxx:100
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
BoxOracle * oracle
points to the MatrixBoxOracle for which it implements the cutting plane model
Definition: BoxModel.hxx:34
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...
int call_primal_extender(PrimalExtender &prex)
see SumBlockModel::call_primal_extender
Definition: BoxModel.hxx:232
abstract interface extension of QPModelDataObject to allow uniform generation of tuned quadratic solv...
Definition: QPModelDataObject.hxx:144
void set_out(std::ostream *o=0, int pril=1)
set output and outputlevel of warnings and errors recursively, see CBout
Definition: BoxModel.hxx:269
const BundleData * get_data() const
see SumBlockModel::get_data
Definition: BoxModel.hxx:206
const PrimalData * get_center_primal() const
return the PrimalData corresponding to the aggregate
const PrimalData * get_candidate_primal() const
see SumBlockModel::get_candidate_primal
Definition: BoxModel.hxx:228
abstract interface for BoxModel for the model selection routine select_model()
Definition: BoxModelParametersObject.hxx:61
ModifiableOracleObject * get_oracle_object()
returns the oracle
Definition: BoxModel.hxx:179
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
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 ...
virtual CH_Matrix_Classes::Integer get_modification_id() const
the value is negative if not initialized and otherwise gives the number of modifications applied to t...
Definition: BundleData.hxx:194
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
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
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...
implements (as a derived class of ConeModel) a standard cutting plane model for a MatrixBoxOracle ...
Definition: BoxModel.hxx:28
Oracle interface providing the lower and upper bounds for the internally implemented support function...
Definition: BoxOracle.hxx:72
Serves for specifying parameters regarding the construction of cutting models.
Definition: CBSolver.hxx:891
int init(const BundleData *bd)
if bd is of type BoxData, initialize to this data
virtual bool candidate_available()
returns true if candidate information (always the results of the most recent function evaulation) is ...
Definition: BoxModel.hxx:116
void set_out(std::ostream *o=0, int pril=1)
set output and outputlevel of warnings and errors recursively, see CBout
Definition: SumBlockModel.hxx:680
int get_ret_code() const
see SumBlockModel::get_ret_code()
Definition: BoxModel.hxx:247
MinorantPointer cand_minorant
the (eps)sugradient linear minorant returned by eval_function for the candidate (available if valid a...
Definition: BoxData.hxx:53
extends BundleData for use with BoxModel by adding information on subgradients and the cutting plane ...
Definition: BoxData.hxx:29
BoxData data
the relevant data for running BundleSolver consistently
Definition: BoxModel.hxx:37
CH_Matrix_Classes::Integer nr_eval
total number of oralce calls (to MatrixBoxOracle::evaluate())
Definition: BoxModel.hxx:45
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 ...
ModifiableOracle provides all oracles with a uniform interface for a modification routine and an on/o...
Definition: MatrixCBSolver.hxx:309
Matrix class for real values of type Real
Definition: matrix.hxx:74
Header declaring the class ConicBundle::BoxData (needed for ConicBundle::BoxModel) ...
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)
see SumBlockModel::update_model(); it is called irrespective of whether the local model is active or ...
FunctionTask
Each function represented by a FunctionModel is equipped with a function_factor (it defaults to 1...
Definition: CBSolver.hxx:221
QPConeModelDataObject * block
describes the feasible convex combinations of the bundle vectors
Definition: BoxModel.hxx:49
int ret_code
return value of the last call to MatrixBoxOracle::evaluate()
Definition: BoxModel.hxx:43
const PrimalData * get_approximate_primal() const
see SumBlockModel::get_approximate_primal
Definition: BoxModel.hxx:220
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
int call_primal_extender(PrimalExtender &prex, bool include_candidates=true)
see the last argument of BoxOracle::evaluate()
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
Header declaring the class ConicBundle::BoxModelParametersObject.
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 ConeMode...
provides a general abstract base class for conic cutting models with SumBundle capabilities (as a der...
Definition: ConeModel.hxx:52
int set_data(BundleData *bd)
see SumBlockModel::set_data
Definition: BoxModel.hxx:209
In Lagrangean relaxation an approximate primal solution can be generated by supplying primal informat...
Definition: CBSolver.hxx:151
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...
BundleData * get_data()
see SumBlockModel::get_data
Definition: BoxModel.hxx:203
Interface for extending PrimalData, e.g., in Lagrangian relaxation of column generation approaches...
Definition: CBSolver.hxx:180
virtual MinorantPointer & provide_center_minorant()
if it cannot be provided it returns a minorant with valid()==false
CH_Matrix_Classes::Real lb_function(CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y)
see SumBlockModel::lb_function
~BoxModel()
calls clear() and deletes the bundle parameters
base class for use with SumBlockModel for storing and managing essential data of evaluations and the ...
Definition: BundleData.hxx:77
const PrimalData * get_candidate_primal() const
return the PrimalData delivered by the last call of BoxOracle::evaluate()
Header declaring the class ConicBundle::ConeModel.
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
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...
virtual MinorantPointer & provide_cand_minorant()
if it cannot be provided it returns a minorant with valid()==false
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.