ConicBundle
PSCAffineFunction.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_PSCAFFINEFUNCTION_HXX
4 #define CONICBUNDLE_PSCAFFINEFUNCTION_HXX
5 
13 //------------------------------------------------------------
14 
15 #include <map>
16 #include "PSCOracle.hxx"
17 #include "PSCPrimal.hxx"
18 #include "Bigmatrix.hxx"
20 
21 //------------------------------------------------------------
22 
23 namespace ConicBundle {
24 
173 
174  class PSCAffineFunction;
175 
188  {
189  private:
192 
193  public:
196 
199 
200  /*@brief called by ConicBundle to update internal Minorant objects, has to return 0 on success
201 
202  @param[in,out] minorant (Minorant&)
203  it holds a (possibly aggregated) minorant that was generated
204  from minorants returned by oracle calls, e.g. as in
205  FunctionOracle::evaluate() If PrimalData was provided in these
206  minorants, this will be aggregated along and will also be
207  available in this minorant.
208 
209  @param[in] n_coords (int)
210  the number of coordinate positions that have to be filled in
211 
212  @param[out] new_subgradient_values (DVector &)
213  the indices of these coordinate positions (sorted in
214  strictly increasing order)
215 
216  @return
217  - 0 on success,
218  - 1 if extension/update is impossible
219 
220  */
221  int extend(Minorant& minorant,int n_coords,const int* indices);
222 
223  };
224 
225 
226 
228  class AMFMaxEigSolver;
229 
233  class PSCAffineFunction: public PSCOracle, public CBout
234  {
235  private:
237 
240 
243 
244  std::vector<AMFMaxEigSolver*> maxeigsolver;
245 
247 
249 
251 
253  int form_bigmatrix(const CH_Matrix_Classes::Matrix& current_point);
254 
256  int apply_modification(const PSCAffineModification& amfmod);
257 
259  void clear();
260 
261  public:
264  PSCAffineFunction(const CBout* cb=0,int incr=-1);
266 
282  const SparseCoeffmatMatrix& opAt,
283  PSCPrimal* generating_primal=0,
284  const CBout* cb=0,int incr=-1);
285 
288 
290 
292  void set_check_correctness(bool chk)
293  {check_correctness_flag=chk;}
294 
297  {maxvecs=(maxv>1)?maxv:5;}
298 
300 
301  //----------- Oracle Implementation of PSCOracle ----------
304 
306  Minorant* generate_minorant(const CH_Matrix_Classes::Matrix& P);
307 
309  int svec_projection(CH_Matrix_Classes::Matrix& svec_offset,
310  CH_Matrix_Classes::Matrix& svec_coeffs,
311  const CH_Matrix_Classes::Matrix& P,
312  const CH_Matrix_Classes::Indexmatrix* index_subset=0);
313 
314 
315 
317  int evaluate(const CH_Matrix_Classes::Matrix& current_point,
318  const CH_Matrix_Classes::Matrix& bundlevecs,
319  const double relprec,
320  const double Ritz_bound,
321  CH_Matrix_Classes::Matrix& Ritz_vectors,
322  CH_Matrix_Classes::Matrix& Ritz_values,
323  PSCPrimalExtender*& primal_extender);
324 
326  int evaluate_projection(const CH_Matrix_Classes::Matrix& current_point,
327  const CH_Matrix_Classes::Matrix& P,
328  const double relprec,
329  CH_Matrix_Classes::Matrix& projected_Ritz_vectors,
330  CH_Matrix_Classes::Matrix& projected_Ritz_values);
331 
333  int left_right_product(int i,
334  const CH_Matrix_Classes::Matrix& E,
335  const CH_Matrix_Classes::Matrix& F,
337 
338 
343  virtual
344  int
345  apply_modification
346  (
347  const OracleModification& oracle_modification ,
348  const CH_Matrix_Classes::Matrix* new_center,
349  const CH_Matrix_Classes::Matrix* old_center,
350  bool& discard_objective_in_center,
351  bool& discard_model,
352  bool& discard_aggregates,
353  MinorantExtender*& minorant_extender
354  );
355 
356 
358  virtual
359  bool
361  {return check_correctness_flag;}
363 
364 
365  //------------------ routines for querying the problem ----------------
368 
372  const SparseCoeffmatMatrix& get_opAt() { return opAt;}
373 
377  const SparseCoeffmatMatrix& get_C() {return C;}
378 
381  { return generating_primal;}
382 
384 
385 
386  //------------------ routines for IO ----------------
389 
391  void set_out(std::ostream* o=0,int pril=1);
393  void set_cbout(const CBout* cb,int incr=-1);
394 
396  std::ostream& print_problem_data(std::ostream& out) const;
397 
399  std::istream& read_problem_data(std::istream& in);
400 
402  std::ostream& print_problem_data_to_mfile(std::ostream& out, CH_Matrix_Classes::Integer blocknr) const;
403  //std::istream& read_problem_data_from_mfile(std::istream& in);
404 
405 
406  };
407 
408 
409 }
410 
412 
413 #endif
414 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
Base class for informing oracles (or the solver) about dynamic changes in the number and sorting of t...
Definition: CBSolver.hxx:544
SparseCoeffmatMatrix opAt
holds the coefficient matrices for the variables
Definition: PSCAffineFunction.hxx:239
PSCAffineMinorantExtender(PSCAffineFunction *amf)
the PSCAffineFunction pointed to has to be valid for the livetime of this object
CH_Matrix_Classes::Integer maxvecs
the maximum number of Ritz vectors to be retrurned
Definition: PSCAffineFunction.hxx:248
Interface for extending a Minorant, e.g., in Lagrangian Relaxation of cutting plane approaches...
Definition: CBSolver.hxx:490
class for collecting and organizing a sequence of changes to block diagonal symmetric affine matrix f...
Definition: PSCAffineModification.hxx:95
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
const PSCPrimal * get_generating_primal(void)
returns the current setting concerning the generation of an PSCPrimal (0 for none) ...
Definition: PSCAffineFunction.hxx:380
void set_check_correctness(bool chk)
set the maximum number of Ritz vectors returned in evaluate(), see implemention of a PSCOracle (PSCAf...
Definition: PSCAffineFunction.hxx:292
Header declaring the class ConicBundle::PSCAffineModification.
PSCAffineFunction * amf
the oracle this MinorantExtender was generated by, needed for retrieving problem data ...
Definition: PSCAffineFunction.hxx:191
std::vector< AMFMaxEigSolver * > maxeigsolver
the eigenvalue solver of each block
Definition: PSCAffineFunction.hxx:244
Header declaring the classes ConicBundle::PSCOracle and ConicBundle::PSCBundleParameters (needed for ...
this is used to describe affine minorants of convex functions that will be used for generating cuttin...
Definition: CBSolver.hxx:274
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
Oracle interface for minimization of the maximum eigenvalue of an affine matrix function or...
Definition: PSCOracle.hxx:233
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
stores/organizes the CoeffmatPointer pointers to Coeffmat matrices with the purpose of describing the...
Definition: SparseCoeffmatMatrix.hxx:50
virtual bool check_correctness() const
see PSCOracle::check_correctness()
Definition: PSCAffineFunction.hxx:360
const SparseCoeffmatMatrix & get_C()
Definition: PSCAffineFunction.hxx:377
bool check_correctness_flag
if true, ConicBundle employs some additional consistency checks
Definition: PSCAffineFunction.hxx:250
Interface for extending PrimalData, e.g., in Lagrangian relaxation of column generation approaches...
Definition: PSCOracle.hxx:187
int extend(Minorant &minorant, int n_coords, const int *indices)
called by ConicBundle to update internal Minorant objects, has to return 0 on success ...
virtual void set_out(std::ostream *out=0, int print_level=1)
Specifies the output level (out==NULL: no output at all, out!=NULL and level=0: errors and warnings...
Header declaring the classes ConicBundle::Bigmatrix (needed for ConicBundle::MatrixSDPfunction) ...
Matrix class for real values of type Real
Definition: matrix.hxx:74
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
SparseCoeffmatMatrix C
block diagonal representation of as in implemention of a PSCOracle (PSCAffineFunction) ...
Definition: PSCAffineFunction.hxx:236
Header declaring the classes ConicBundle::PSCPrimal, ConicBundle::DensePSCPrimal, ConicBundle::Sparse...
const SparseCoeffmatMatrix & get_opAt()
Definition: PSCAffineFunction.hxx:372
Implementation of MinorantExtender for PSCAffineFunction.
Definition: PSCAffineFunction.hxx:187
CH_Matrix_Classes::Matrix last_bigmat_y
the last y used in costructing the matrix of the affine matrix function
Definition: PSCAffineFunction.hxx:246
general purpose implementation of PSCOracle as explained in implemention of a PSCOracle (PSCAffineFun...
Definition: PSCAffineFunction.hxx:233
void set_max_Ritzvecs(CH_Matrix_Classes::Integer maxv)
set the maximum number of new Ritzvectors returned by evaluate(); values<1 default to 5 ...
Definition: PSCAffineFunction.hxx:296
PSCPrimal is the corresponding positive semidefinite object for PSCOracle like PrimalMatrix for a Mat...
Definition: PSCPrimal.hxx:46
PSCPrimal * generating_primal
This PSCPrimal can be set from outside and serves for generating further primals by cloning...
Definition: PSCAffineFunction.hxx:242
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.