ConicBundle
PSCModel.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_PSCMODEL_HXX
4 #define CONICBUNDLE_PSCMODEL_HXX
5 
13 #include "ConeModel.hxx"
14 #include "PSCData.hxx"
16 #include "PSCAffineFunction.hxx"
17 #include "PSCIPBundleBlock.hxx"
18 
19 namespace ConicBundle {
20 
24 
46 class PSCModel: public ConeModel
47 {
48 private:
49 
50  //--- problem description
53  //--- data describing the model
58 
59  //--- data of last oracle evaluation
61  int ret_code;
64 
65  //--- augmented modle solver
68 
69 
70  //--- for debugging
71  //CH_Matrix_Classes::Matrix debug_cand_y;
72  //CH_Matrix_Classes::Matrix debug_center_y;
73 
74  //--- for passing oracle information to the QP Solver
77  {
78  private:
81 
82  public:
84  QPPSCOracleData():oracle(0),data(0){}
87 
89  int init(PSCOracle* op,PSCData *dp)
90  {
91  oracle=dynamic_cast<PSCAffineFunction*>(op);
92  data=dp;
93  return ((oracle==0)||(data==0));
94  }
95 
99  virtual const SparseCoeffmatMatrix& get_opAt()
100  { assert(oracle); return oracle->get_opAt(); }
101 
105  virtual const SparseCoeffmatMatrix& get_C()
106  { assert(oracle); return oracle->get_C(); }
107 
111  { assert(data); return data->bundlevecs; }
112 
113  };
114 
117 
118  //----------------------------------------------------------------------
121 
122 
125  const CH_Matrix_Classes::Matrix& y,
126  CH_Matrix_Classes::Real nullstep_bound,
127  CH_Matrix_Classes::Real relprec);
128 
131  const CH_Matrix_Classes::Matrix& iny);
132 
136  const CH_Matrix_Classes::Matrix& y,
137  CH_Matrix_Classes::Real relprec);
138 
140  virtual int update_local_model(ModelUpdate model_update,
141  CH_Matrix_Classes::Integer center_id,
142  const CH_Matrix_Classes::Matrix& center_y,
144  const CH_Matrix_Classes::Matrix& y,
145  CH_Matrix_Classes::Real model_maxviol,
146  BundleProxObject& H);
147 
148 
150  virtual int switch_to_local( const MinorantBundle& sumbundle_model,
151  const CH_Matrix_Classes::Matrix& sumbundle_coeff);
152 
154  virtual int get_aggregate_and_coefficient(MinorantPointer& sumbundle_aggr,
155  CH_Matrix_Classes::Real& aggr_coeff);
156 
157 
159  virtual int start_local_augmodel(QPModelDataPointer& qpblockp,
161  const CH_Matrix_Classes::Matrix& cand_y,
162  const CH_Matrix_Classes::Indexmatrix* needed_indexsubset);
163 
165  virtual int make_local_aggregate(CH_Matrix_Classes::Real& new_function_factor,
166  bool keep_penalty_fixed);
167 
169  virtual int local_adjust_multiplier(CH_Matrix_Classes::Real& new_function_factor);
170 
172  virtual bool candidate_available()
173  {return (data.cand_ub_mid==data.get_modification_id())&&(data.cand_Ritzval.rowdim()>0); }
174 
177 
180 
181 
183 
184 
185 public:
187  virtual void clear();
188 
191 
193  PSCModel(PSCOracle* fo,CH_Matrix_Classes::Real fun_factor=1.,FunctionTask fun_task=ObjectiveFunction,CBout* cb=0,int cbinc=-1);
194 
196  ~PSCModel();
197 
198 
199  //----------------------------------------------------------------------
202 
203 
204  //eval_function //as in ConeModel
205 
206  //eval_model //as in ConeModel
207 
208  //get_model_aggregate(three parameters) //as in SumBlockModel
209 
210  //update_model //as in ConeModel
211 
212  //synchronize_ids //as in SumBlockModel
213 
214  //center_modified //as in SumBlockModel
215 
216  //recompute center //as in ConeModel
217 
218  //model_aggregate_modified //as in ConeModel
219 
220  //provide_model_aggregate //as in ConeModel
221 
222  // apply_modfication // as in SumBlockModel
223 
224  // add_variable_metric //as in SumBlockModel
225 
226  //check_center_validity_by_candidate //as in ConeModel
227 
228 
230 
231  //----------------------------------------------------------------------
234 
237 
238  //start_augmodel //as in ConeModel
239 
240  // make_model_aggregate //as in ConeModel
241 
242  //get_model_aggregate(... aft=0) //as in SumBlockModel
243 
246  const CH_Matrix_Classes::Matrix& y);
247 
248  // get_function_minorant //as in ConeModel
249 
250  // get_center_minorant //as in ConeModel
251 
252  // adjust_multiplier //as in ConeModel
253 
254  // sumbundle_contribution //as in ConeModel
255 
256  // as in 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&)
257 
259  BundleData* get_data() {return &data;}
260 
262  const BundleData* get_data() const {return &data;}
263 
265  int set_data(BundleData* bd){return data.init(bd);}
266 
268 
269  //----------------------------------------------------------------------
272 
273 
276  { return data.get_approximate_primal(); }
277 
280  { if (!(const_cast<PSCModel*>(this))->provide_center_minorant().valid()) return 0; return data.get_center_primal();}
281 
284  { if (!(const_cast<PSCModel*>(this))->provide_cand_minorant().valid()) return 0; return data.get_candidate_primal();}
285 
288  { return data.call_primal_extender(prex); }
289 
292 
295  {return model_selection;}
296 
297  // clear_model() //as in ConeModel
298 
299  // clear_aggregates() //as in ConeModel
300 
302  int get_ret_code() const {return ret_code;}
303 
304 
306 
307  //----------------------------------------------------------------------
310 
312  std::ostream& output_bundle_data(std::ostream& out) const;
313 
315  //----------------------------------------------------------------------
318 
319  //get_QPcoeff_time() // as in SumBlockModel
320 
321  //get_QPsolve_time() // as in SumBlockModel
322 
323  //get_evalaugmodel_time() // as in SumBlockModel
324 
325  //get_evalmodel_time() // as in SumBlockModel
326 
327  //get_updatemodel_time() // as in SumBlockModel
328 
329  //get_eval_time() // as in SumBlockModel
330 
332  void set_out(std::ostream* o=0,int pril=1)
333  {
334  SumBlockModel::set_out(o,pril);
335  if (block)
336  block->set_cbout(this,-1);
337  if (model_selection)
338  model_selection->set_cbout(this,0);
339  }
340 
341  //set_cbout() // calls set_out in SumBlockModel
342 
343 
345 
346 
347 };
348 
350 
351 }
352 
353 #endif
354 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
implements (as a derived class of ConeModel) a cutting model for a PSCOracle
Definition: PSCModel.hxx:46
virtual const SparseCoeffmatMatrix & get_opAt()
Definition: PSCModel.hxx:99
const PrimalData * get_approximate_primal() const
return the PrimalData corresponding to the aggregate
CH_Matrix_Classes::Real lb_function(CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y)
see SumBlockModel::lb_function
BundleData * get_data()
see SumBlockModel::get_data
Definition: PSCModel.hxx:259
int call_primal_extender(PrimalExtender &prex)
see SumBlockModel::call_primal_extender
Definition: PSCModel.hxx:287
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
Header declaring the class ConicBundle::PSCIPBundleBlock.
PSCAffineFunction * oracle
in init this will be set to the PSCOralce of this PSCModel if compatible
Definition: PSCModel.hxx:79
Integer rowdim() const
returns the row dimension
Definition: matrix.hxx:215
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 ...
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
virtual const SparseCoeffmatMatrix & get_C()
Definition: PSCModel.hxx:105
int get_ret_code() const
see SumBlockModel::get_ret_code()
Definition: PSCModel.hxx:302
int set_data(BundleData *bd)
see SumBlockModel::set_data
Definition: PSCModel.hxx:265
abstract interface for automatically generating and retrieving the qp blocks with the model data that...
Definition: QPModelDataObject.hxx:298
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...
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...
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
CH_Matrix_Classes::Matrix cand_Ritzval
Ritz values returned by the oracle.
Definition: PSCData.hxx:71
virtual MinorantPointer & provide_cand_minorant()
if it cannot be provided it returns a minorant with valid()==false
abstract interface extension of QPModelDataObject to allow uniform generation of tuned quadratic solv...
Definition: QPModelDataObject.hxx:144
Header declaring the class ConicBundle::PSCModelParametersObject.
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 ...
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 bool candidate_available()
returns true if candidate information (always the results of the most recent function evaulation) is ...
Definition: PSCModel.hxx:172
virtual const CH_Matrix_Classes::Matrix & get_bundlevecs()
Definition: PSCModel.hxx:110
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
QPConeModelDataObject * block
describes the feasible convex combinations of the bundle vectors for the bundle subproblem ...
Definition: PSCModel.hxx:67
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
Oracle interface for minimization of the maximum eigenvalue of an affine matrix function or...
Definition: PSCOracle.hxx:233
void set_out(std::ostream *o=0, int pril=1)
set output and outputlevel of warnings and errors recursively, see CBout
Definition: PSCModel.hxx:332
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
abstract interface for PSCModel for the model selection routine select_model()
Definition: PSCModelParametersObject.hxx:93
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
extends BundleData for use with PSCModel (see there for the description of the function) by adding in...
Definition: PSCData.hxx:45
stores/organizes the CoeffmatPointer pointers to Coeffmat matrices with the purpose of describing the...
Definition: SparseCoeffmatMatrix.hxx:50
int call_primal_extender(PrimalExtender &, bool include_candidates=true)
see the last argument of FunctionOracle::evaluate()
const BundleData * get_data() const
see SumBlockModel::get_data
Definition: PSCModel.hxx:262
int init(PSCOracle *op, PSCData *dp)
make this oracle and model data available via the members
Definition: PSCModel.hxx:89
CH_Matrix_Classes::Matrix bundlevecs
the columns span the subspace of the semidefinte face (the bundle is initialized if bundlevecs...
Definition: PSCData.hxx:89
const SparseCoeffmatMatrix & get_C()
Definition: PSCAffineFunction.hxx:377
PSCOracle * oracle
points to the PSCOracle for which it implements the cutting model
Definition: PSCModel.hxx:52
QPPSCOracleData()
generator
Definition: PSCModel.hxx:84
PSCData data
the relevant data for running BundleSolver consistently
Definition: PSCModel.hxx:55
Serves for specifying parameters regarding the construction of cutting models.
Definition: CBSolver.hxx:891
defines an interface for passing on oracle information to PSCIPBundleBlock
Definition: PSCIPBundleBlock.hxx:29
const PrimalData * get_candidate_primal() const
return the PrimalData delivered by the last call of FunctionOracle::evaluate()
const PrimalData * get_center_primal() const
see SumBlockModel::get_center_primal
Definition: PSCModel.hxx:279
const PrimalData * get_candidate_primal() const
see SumBlockModel::get_candidate_primal
Definition: PSCModel.hxx:283
QPPSCOracleData qp_oracle_data
this will set in start_local_augmodel() and then maybe used by the QP Solver
Definition: PSCModel.hxx:116
PSCModelParametersObject * model_selection
parameters for steering size and update strategy of the cutting plane model
Definition: PSCModel.hxx:57
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 ...
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
PSCModel(PSCOracle *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
CH_Matrix_Classes::Integer nr_eval
total number of oralce calls (to MatrixFunctionOracle::evaluate())
Definition: PSCModel.hxx:63
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
abstract interface, that allows to specify a routine for providing or computing a suitable variable m...
Definition: VariableMetric.hxx:237
Header declaring the classes ConicBundle::PSCAffineFunction, ConicBundle::PSCAffineMinorantExtender (...
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
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...
FunctionTask
Each function represented by a FunctionModel is equipped with a function_factor (it defaults to 1...
Definition: CBSolver.hxx:221
int init(const BundleData *bd)
if bd is of type PSCData, initialize to this data
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
virtual void clear()
resets all data to initial status of this class, also the bundle parameters
const PrimalData * get_approximate_primal() const
see SumBlockModel::get_approximate_primal
Definition: PSCModel.hxx:275
~QPPSCOracleData()
destructor
Definition: PSCModel.hxx:86
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...
std::ostream & output_bundle_data(std::ostream &out) const
this outputs the qp model data recursively for testing purposes
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
const SparseCoeffmatMatrix & get_opAt()
Definition: PSCAffineFunction.hxx:372
Interface for extending PrimalData, e.g., in Lagrangian relaxation of column generation approaches...
Definition: CBSolver.hxx:180
ModifiableOracleObject * get_oracle_object()
returns the oracle
Definition: PSCModel.hxx:236
for passing oracle information to the QP Solver, which might be used there or not ...
Definition: PSCModel.hxx:76
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...
base class for use with SumBlockModel for storing and managing essential data of evaluations and the ...
Definition: BundleData.hxx:77
~PSCModel()
calls clear() and deletes the bundle parameters
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); if vms casts to ...
Header declaring the class ConicBundle::ConeModel.
PSCData * data
will be set to the PSCData of this PSCModel
Definition: PSCModel.hxx:80
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
Header declaring the class ConicBundle::PSCData (needed for ConicBundle::FunctionModel) ...
general purpose implementation of PSCOracle as explained in implemention of a PSCOracle (PSCAffineFun...
Definition: PSCAffineFunction.hxx:233
int ret_code
return value of the last call to MatrixFunctionOracle::evaluate()
Definition: PSCModel.hxx:61
int set_bundle_parameters(const BundleParameters &bp)
see SumBlockModel::set_bundle_parameters
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.
const PrimalData * get_center_primal() const
return the PrimalData corresponding to the aggregate
virtual const BundleParameters * get_bundle_parameters() const
see SumBlockModel::get_bundle_parameters
Definition: PSCModel.hxx:294
virtual MinorantPointer & provide_center_minorant()
if it cannot be provided it returns a minorant with valid()==false