ConicBundle
SOCModel.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_SOCMODEL_HXX
4 #define CONICBUNDLE_SOCMODEL_HXX
5 
13 #include "ConeModel.hxx"
14 #include "SOCData.hxx"
16 
17 namespace ConicBundle {
18 
22 
44 class SOCModel: public ConeModel
45 {
46 private:
47 
48  //--- problem description
51  //--- data describing the model
56 
57  //--- data of last oracle evaluation
59  int ret_code;
62 
63  //--- augmented modle solver
66 
67 
68  //--- for debugging
69  //CH_Matrix_Classes::Matrix debug_cand_y;
70  //CH_Matrix_Classes::Matrix debug_center_y;
71 
72  //----------------------------------------------------------------------
75 
78  const CH_Matrix_Classes::Matrix& socvec);
79 
81 
82 
83  //----------------------------------------------------------------------
86 
87 
91  CH_Matrix_Classes::Real nullstep_bound,
92  CH_Matrix_Classes::Real relprec);
93 
96  const CH_Matrix_Classes::Matrix& iny);
97 
101  const CH_Matrix_Classes::Matrix& y,
102  CH_Matrix_Classes::Real relprec);
103 
105  virtual int update_local_model(ModelUpdate model_update,
106  CH_Matrix_Classes::Integer center_id,
107  const CH_Matrix_Classes::Matrix& center_y,
109  const CH_Matrix_Classes::Matrix& y,
110  CH_Matrix_Classes::Real model_maxviol,
111  BundleProxObject& H);
112 
114  virtual int switch_to_local( const MinorantBundle& sumbundle_model,
115  const CH_Matrix_Classes::Matrix& sumbundle_coeff);
116 
118  virtual int get_aggregate_and_coefficient(MinorantPointer& sumbundle_aggr,
119  CH_Matrix_Classes::Real& aggr_coeff);
120 
121 
122 
124  virtual int start_local_augmodel(QPModelDataPointer& qpblockp,
126  const CH_Matrix_Classes::Matrix& cand_y,
127  const CH_Matrix_Classes::Indexmatrix* needed_indexsubset);
128 
130  virtual int make_local_aggregate(CH_Matrix_Classes::Real& new_function_factor,
131  bool keep_penalty_fixed);
132 
134  virtual int local_adjust_multiplier(CH_Matrix_Classes::Real& new_function_factor);
135 
137  virtual bool candidate_available()
138  {return (data.cand_ub_mid==data.get_modification_id())&&(data.cand_SOCvec.coldim()>0); }
139 
142 
145 
146 
148 
149 public:
151  virtual void clear();
152 
154  SOCModel(SOCOracle* fo,CH_Matrix_Classes::Real fun_factor=1.,FunctionTask fun_task=ObjectiveFunction,CBout* cb=0,int cbinc=-1);
155 
157  ~SOCModel();
158 
159 
160  //----------------------------------------------------------------------
163 
164 
165  //eval_function //as in ConeModel
166 
167  //eval_model //as in ConeModel
168 
169  //get_model_aggregate(three parameters) //as in SumBlockModel
170 
171  //update_model //as in ConeModel
172 
173  //synchronize_ids //as in SumBlockModel
174 
175  //center_modified //as in SumBlockModel
176 
177  //recompute center //as in ConeModel
178 
179  //model_aggregate_modified //as in ConeModel
180 
181  //provide_model_aggregate //as in ConeModel
182 
183  // apply_modfication // as in SumBlockModel
184 
185  // add_variable_metric //as in SumBlockModel
186 
187  //check_center_validity_by_candidate //as in ConeModel
188 
190 
191  //----------------------------------------------------------------------
194 
197 
198  //start_augmodel //as in ConeModel
199 
200  // make_model_aggregate //as in ConeModel
201 
202  //get_model_aggregate(... aft=0) //as in SumBlockModel
203 
206  const CH_Matrix_Classes::Matrix& y);
207 
208  // get_function_minorant //as in ConeModel
209 
210  // get_center_minorant //as in ConeModel
211 
212  // adjust_multiplier //as in ConeModel
213 
214  // sumbundle_contribution //as in ConeModel
215 
216 
217  // as in see ConeModel::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&)
218 
220  BundleData* get_data() {return &data;}
221 
223  const BundleData* get_data() const {return &data;}
224 
226  int set_data(BundleData* bd){return data.init(bd);}
227 
229 
230  //----------------------------------------------------------------------
233 
234 
237  { return data.get_approximate_primal(); }
238 
241  { if (!(const_cast<SOCModel*>(this))->provide_center_minorant().valid()) return 0; return data.get_center_primal();}
242 
245  { if (!(const_cast<SOCModel*>(this))->provide_cand_minorant().valid()) return 0; return data.get_candidate_primal();}
246 
249  { return data.call_primal_extender(prex); }
250 
253 
256  {return model_selection;}
257 
258  // clear_model() //as in ConeModel
259 
260  // clear_aggregates() //as in ConeModel
261 
263  int get_ret_code() const {return ret_code;}
264 
265 
267 
268  //----------------------------------------------------------------------
271 
273  std::ostream& output_bundle_data(std::ostream& out) const;
274 
276  //----------------------------------------------------------------------
279 
280  //get_QPcoeff_time() // as in SumBlockModel
281 
282  //get_QPsolve_time() // as in SumBlockModel
283 
284  //get_evalaugmodel_time() // as in SumBlockModel
285 
286  //get_evalmodel_time() // as in SumBlockModel
287 
288  //get_updatemodel_time() // as in SumBlockModel
289 
290  //get_eval_time() // as in SumBlockModel
291 
293  void set_out(std::ostream* o=0,int pril=1)
294  {
295  SumBlockModel::set_out(o,pril);
296  if (block)
297  block->set_cbout(this,-1);
298  if (model_selection)
299  model_selection->set_cbout(this,0);
300  }
301 
302  //set_cbout() // calls set_out in SumBlockModel
303 
304 
306 
307 
308 };
309 
311 
312 }
313 
314 #endif
315 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
int get_minorant(MinorantPointer &mp, const CH_Matrix_Classes::Matrix &socvec)
Compute the aggregate minornat corresponding to the matrix P*Diag(d)*P&#39;/sum(d) and aggregate it to (o...
int get_ret_code() const
see SumBlockModel::get_ret_code()
Definition: SOCModel.hxx:263
abstract interface for SOCModel for the model selection routine select_model()
Definition: SOCModelParametersObject.hxx:49
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...
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
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...
virtual MinorantPointer & provide_cand_minorant()
if it cannot be provided it returns a minorant with valid()==false
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
virtual MinorantPointer & provide_center_minorant()
if it cannot be provided it returns a minorant with valid()==false
SOCOracle * oracle
points to the SOCOracle for which it implements the cutting model
Definition: SOCModel.hxx:50
BundleData * get_data()
see SumBlockModel::get_data
Definition: SOCModel.hxx:220
abstract interface for automatically generating and retrieving the qp blocks with the model data that...
Definition: QPModelDataObject.hxx:298
virtual void clear()
resets all data to initial status of this class, also the bundle parameters
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...
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
CH_Matrix_Classes::Real lb_function(CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y)
see SumBlockModel::lb_function
Oracle interface for minimization of the support function over the seoncd order cone with for an aff...
Definition: SOCOracle.hxx:186
implements (as a derived class of ConeModel) a cutting model for a SOCOracle
Definition: SOCModel.hxx:44
const BundleData * get_data() const
see SumBlockModel::get_data
Definition: SOCModel.hxx:223
const PrimalData * get_candidate_primal() const
see SumBlockModel::get_candidate_primal
Definition: SOCModel.hxx:244
abstract interface extension of QPModelDataObject to allow uniform generation of tuned quadratic solv...
Definition: QPModelDataObject.hxx:144
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...
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 ...
int set_data(BundleData *bd)
see SumBlockModel::set_data
Definition: SOCModel.hxx:226
int init(const BundleData *bd)
if bd is of type SOCData, initialize to this data
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...
CH_Matrix_Classes::Integer nr_eval
total number of oralce calls (to MatrixFunctionOracle::evaluate())
Definition: SOCModel.hxx:61
SOCData data
the relevant data for running BundleSolver consistently
Definition: SOCModel.hxx:53
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 ...
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
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
~SOCModel()
calls clear() and deletes the bundle parameters
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
SOCModelParametersObject * model_selection
parameters for steering size and update strategy of the cutting plane model
Definition: SOCModel.hxx:55
void set_out(std::ostream *o=0, int pril=1)
set output and outputlevel of warnings and errors recursively, see CBout
Definition: SOCModel.hxx:293
const PrimalData * get_approximate_primal() const
return the PrimalData corresponding to the aggregate
Serves for specifying parameters regarding the construction of cutting models.
Definition: CBSolver.hxx:891
virtual const BundleParameters * get_bundle_parameters() const
see SumBlockModel::get_bundle_parameters
Definition: SOCModel.hxx:255
int call_primal_extender(PrimalExtender &, bool include_candidates=true)
see the last argument of FunctionOracle::evaluate()
Header declaring the class ConicBundle::SOCData (needed for ConicBundle::FunctionModel) ...
CH_Matrix_Classes::Matrix cand_SOCvec
the SOCvector generating cand_SOCval
Definition: SOCData.hxx:69
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
Integer coldim() const
returns the column dimension
Definition: matrix.hxx:218
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
int ret_code
return value of the last call to MatrixFunctionOracle::evaluate()
Definition: SOCModel.hxx:59
Header declaring the class ConicBundle::SOCModelParametersObject.
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
FunctionTask
Each function represented by a FunctionModel is equipped with a function_factor (it defaults to 1...
Definition: CBSolver.hxx:221
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
const PrimalData * get_center_primal() const
return the PrimalData corresponding to the aggregate
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 ...
SOCModel(SOCOracle *fo, CH_Matrix_Classes::Real fun_factor=1., FunctionTask fun_task=ObjectiveFunction, CBout *cb=0, int cbinc=-1)
construct a model for the MatrixFunctionOracle pointed to by fo
ModifiableOracleObject * get_oracle_object()
returns the oracle
Definition: SOCModel.hxx:196
int call_primal_extender(PrimalExtender &prex)
see SumBlockModel::call_primal_extender
Definition: SOCModel.hxx:248
provides a general abstract base class for conic cutting models with SumBundle capabilities (as a der...
Definition: ConeModel.hxx:52
In Lagrangean relaxation an approximate primal solution can be generated by supplying primal informat...
Definition: CBSolver.hxx:151
std::ostream & output_bundle_data(std::ostream &out) const
this outputs the qp model data recursively for testing purposes
extends BundleData for use with SOCModel (see there for the description of the function) by adding in...
Definition: SOCData.hxx:43
Interface for extending PrimalData, e.g., in Lagrangian relaxation of column generation approaches...
Definition: CBSolver.hxx:180
const PrimalData * get_candidate_primal() const
return the PrimalData delivered by the last call of FunctionOracle::evaluate()
QPConeModelDataObject * block
describes the feasible convex combinations of the bundle vectors for the bundle subproblem ...
Definition: SOCModel.hxx:65
base class for use with SumBlockModel for storing and managing essential data of evaluations and the ...
Definition: BundleData.hxx:77
virtual bool candidate_available()
returns true if candidate information (always the results of the most recent function evaulation) is ...
Definition: SOCModel.hxx:137
Header declaring the class ConicBundle::ConeModel.
const PrimalData * get_center_primal() const
see SumBlockModel::get_center_primal
Definition: SOCModel.hxx:240
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...
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.
int set_bundle_parameters(const BundleParameters &bp)
see SumBlockModel::set_bundle_parameters
const PrimalData * get_approximate_primal() const
see SumBlockModel::get_approximate_primal
Definition: SOCModel.hxx:236