ConicBundle
QPSumModelBlock.hxx
Go to the documentation of this file.
1 
2 #ifndef CONICBUNDLE_QPSUMMODELBLOCK_HXX
3 #define CONICBUNDLE_QPSUMMODELBLOCK_HXX
4 
13 #include "QPModelBlock.hxx"
14 
15 namespace ConicBundle {
16 
17 
22 
35 class QPSumModelBlock: public virtual QPModelBlock, public virtual QPSumModelDataObject
36 {
37 private:
39  std::vector<QPModelBlock*> blocks;
40 
43 
44 
45 public:
47  void clear();
48 
50  QPSumModelBlock(CBout* cb=0,int cbincr=-1);
51 
53  virtual ~QPSumModelBlock();
54 
56  virtual QPModelBlockObject* clone();
57 
59  virtual void recursive_delete_and_clear();
60 
63 
65  int append(QPModelDataObject* inblock);
66 
73  int Btrans,
74  int Atrans,
75  CH_Matrix_Classes::Integer startindex_model,
76  MinorantBundle& globalbundle,
77  CH_Matrix_Classes::Integer startindex_bundle);
78 
85  int Atrans,
86  int Btrans,
87  CH_Matrix_Classes::Integer startindex_model,
88  MinorantBundle& globalbundle,
89  CH_Matrix_Classes::Integer startindex_bundle);
90 
93  add_BDBt(const CH_Matrix_Classes::Matrix& diagvec,
95  bool minus,
96  CH_Matrix_Classes::Integer startindex,
98  CH_Matrix_Classes::Integer startindex_model,
99  MinorantBundle& globalbundle,
100  CH_Matrix_Classes::Integer startindex_bundle);
101 
105  CH_Matrix_Classes::Integer startindex_model,
106  MinorantBundle& global_bundle,
107  CH_Matrix_Classes::Integer startindex_bundle);
108 
111  CH_Matrix_Classes::Integer startindex_model);
112 
115  CH_Matrix_Classes::Integer startindex_model);
116 
119  CH_Matrix_Classes::Integer startindex_constraints);
120 
124  MinorantBundle& global_bundle,
125  CH_Matrix_Classes::Integer startindex_bundle);
126 
128  virtual int get_sysviol_model(CH_Matrix_Classes::Matrix& modelvec,
129  CH_Matrix_Classes::Integer startindex_model,
130  const CH_Matrix_Classes::Matrix& dy,
131  MinorantBundle& global_bundle,
132  CH_Matrix_Classes::Integer startindex_bundle);
133 
135  virtual int get_sysviol_constraints(CH_Matrix_Classes::Matrix& constrvec,
136  CH_Matrix_Classes::Integer startindex_constr);
137 
139  virtual void display_model_values(const CH_Matrix_Classes::Matrix& y,
140  MinorantBundle& global_bundle,
141  CH_Matrix_Classes::Integer startindex_bundle,
142  std::ostream& out);
143 
145  virtual int reset_starting_point(const CH_Matrix_Classes::Matrix& y,
147  MinorantBundle& global_bundle,
148  CH_Matrix_Classes::Integer startindex_bundle);
149 
151  virtual int compute_step(const CH_Matrix_Classes::Matrix& ystep,
152  MinorantBundle& global_bundle,
153  CH_Matrix_Classes::Integer startindex_bundle);
154 
156  virtual int computed_step(const CH_Matrix_Classes::Matrix& modelxstep,
157  CH_Matrix_Classes::Integer startindex_model,
158  const CH_Matrix_Classes::Matrix& modelconstrstep,
159  CH_Matrix_Classes::Integer startindex_constr);
160 
162  virtual int do_step(CH_Matrix_Classes::Real alpha,
163  const CH_Matrix_Classes::Matrix& y,
164  MinorantBundle& global_bundle,
165  CH_Matrix_Classes::Integer startindex_bundle);
166 
168  virtual int add_localrhs(CH_Matrix_Classes::Matrix& globalrhs,
170  CH_Matrix_Classes::Real rhscorr,
171  CH_Matrix_Classes::Integer startindex_model,
172  CH_Matrix_Classes::Integer startindex_constraints,
173  bool append,
175  CH_Matrix_Classes::Integer startindex_bundel);
176 
178  virtual int add_BtinvsysB(CH_Matrix_Classes::Symmatrix& globalsys,
180  CH_Matrix_Classes::Integer startindex_bundle);
181 
184  virtual int solve_constrsys(const CH_Matrix_Classes::Symmatrix& ABchol,
185  const CH_Matrix_Classes::Matrix& LinvABrhs,
186  CH_Matrix_Classes::Matrix& LinvABsol,
187  CH_Matrix_Classes::Integer startindex_model,
188  CH_Matrix_Classes::Matrix& Crhs_and_sol,
189  CH_Matrix_Classes::Integer startindex_constraints);
190 
193  virtual int add_BCSchur_diagonal(CH_Matrix_Classes::Matrix& diagonal,
194  MinorantBundle& globalbundle,
195  CH_Matrix_Classes::Integer startindex_bundle);
196 
203  CH_Matrix_Classes::Matrix& sigma_guess,
204  const CH_Matrix_Classes::Matrix& Diag_inv,
206  CH_Matrix_Classes::Real diaginvval,
207  MinorantBundle& globalbundle,
208  CH_Matrix_Classes::Integer startindex_bundle);
209 
210 
214  virtual int prepare_BCSchur_JLprecond(CH_Matrix_Classes::Matrix& glob_lowrank,
215  CH_Matrix_Classes::Matrix& subspace,
216  bool append_globtransp_times_mat_to_subspace,
217  MinorantBundle& globalbundle,
218  CH_Matrix_Classes::Integer startindex_bundle);
219 
220 
222  virtual int add_Schur_rhs(CH_Matrix_Classes::Matrix& glob_rhs,
223  CH_Matrix_Classes::Matrix* local_rhs,
225  CH_Matrix_Classes::Real rhscorr,
226  CH_Matrix_Classes::Integer startindex_constraints,
227  MinorantBundle& globalbundle,
228  CH_Matrix_Classes::Integer startindex_bundle);
229 
230 
232  virtual int add_Schur_mult(const CH_Matrix_Classes::Matrix& in_vec,
233  CH_Matrix_Classes::Matrix& out_vec,
234  const CH_Matrix_Classes::Matrix* in_cvec,
235  CH_Matrix_Classes::Matrix* out_cvec,
236  CH_Matrix_Classes::Integer startindex_constraints,
237  MinorantBundle& globalbundle,
238  CH_Matrix_Classes::Integer startindex_bundle);
239 
241  virtual int computed_Schur_step(const CH_Matrix_Classes::Matrix& xstep,
242  const CH_Matrix_Classes::Matrix& local_step,
243  CH_Matrix_Classes::Integer startindex_model,
244  MinorantBundle& globalbundle,
245  CH_Matrix_Classes::Integer startindex_bundle);
246 
247 
248 
249  //----------- QPBlock routines
250 
253 
256 
259 
262 
265 
267  virtual int get_mu_info(CH_Matrix_Classes::Integer& mudim,
269  CH_Matrix_Classes::Real& tr_xdzpdxz,
270  CH_Matrix_Classes::Real& tr_dxdz,
271  CH_Matrix_Classes::Real& min_xz,
272  CH_Matrix_Classes::Real& max_xz) const;
273 
275  virtual int get_nbh_info(CH_Matrix_Classes::Integer mudim,
277  CH_Matrix_Classes::Real tr_xdzpdxz,
278  CH_Matrix_Classes::Real tr_dxdz,
279  CH_Matrix_Classes::Real nbh_ubnd,
281  CH_Matrix_Classes::Real& max_nbh,
282  CH_Matrix_Classes::Real& nrmsqr_xz,
283  CH_Matrix_Classes::Real& nrmsqr_xdzpdxz,
284  CH_Matrix_Classes::Real& nrmsqr_dxdz,
285  CH_Matrix_Classes::Real& ip_xz_xdzpdxz,
286  CH_Matrix_Classes::Real& ip_xz_dxdz,
287  CH_Matrix_Classes::Real& ip_dxdz_xdzpdxz) const;
288 
290  virtual int linesearch(CH_Matrix_Classes::Real& alpha) const;
291 
292 
294  // virtual int add_BtinvsysB(CH_Matrix_Classes::Symmatrix& globalsys);
295 
296  virtual int add_localsys(CH_Matrix_Classes::Symmatrix& globalsys,
297  CH_Matrix_Classes::Integer startindex_model,
298  CH_Matrix_Classes::Integer startindex_constraints);
299 
301  virtual int localsys_mult(const CH_Matrix_Classes::Matrix& in_vec,
302  CH_Matrix_Classes::Matrix& out_vec,
303  CH_Matrix_Classes::Integer startindex_model,
304  CH_Matrix_Classes::Integer startindex_constraints);
305 
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
virtual CH_Matrix_Classes::Real dualviol_2normsqr()
return the squared Euclidean norm of the dual model violation
virtual int localsys_mult(const CH_Matrix_Classes::Matrix &in_vec, CH_Matrix_Classes::Matrix &out_vec, CH_Matrix_Classes::Integer startindex_model, CH_Matrix_Classes::Integer startindex_constraints)
multiply the local system diagonal block consisting of the model and local contraints rows and column...
virtual CH_Matrix_Classes::Matrix & times_B(const CH_Matrix_Classes::Matrix &A, CH_Matrix_Classes::Matrix &C, CH_Matrix_Classes::Real alpha, CH_Matrix_Classes::Real beta, int Atrans, int Btrans, CH_Matrix_Classes::Integer startindex_model, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
C=beta*C+alpha*A*B where A and B may be transposed; carry out the model part of this beginning at sta...
virtual int add_Schur_mult(const CH_Matrix_Classes::Matrix &in_vec, CH_Matrix_Classes::Matrix &out_vec, const CH_Matrix_Classes::Matrix *in_cvec, CH_Matrix_Classes::Matrix *out_cvec, CH_Matrix_Classes::Integer startindex_constraints, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
multiply in_vec with the local contribution to the global main block and add it to out_vec; the other...
virtual int get_modeldcstr(CH_Matrix_Classes::Matrix &modeldcstr, CH_Matrix_Classes::Integer startindex_constraints)
set the local modeldcstr value in modeldcstr beginning with startindex (initialize it...
virtual void recursive_delete_and_clear()
usually the objects of the recursive block structure and not deleted in a clear. If needed...
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
virtual int add_BtinvsysB(CH_Matrix_Classes::Symmatrix &globalsys, MinorantBundle &bundle, CH_Matrix_Classes::Integer startindex_bundle)
add the "scaled" minorant outer products to globalsys, where the correct minroants start at the given...
virtual int add_modelx_aggregate(CH_Matrix_Classes::Real &val, CH_Matrix_Classes::Matrix &vec, MinorantBundle &global_bundle, CH_Matrix_Classes::Integer startindex_bundle)
adds opB transposed times modelx (without constant affine term) to the arguments
virtual CH_Matrix_Classes::Matrix & get_Bt(CH_Matrix_Classes::Matrix &Bt, CH_Matrix_Classes::Integer startindex_model, MinorantBundle &global_bundle, CH_Matrix_Classes::Integer startindex_bundle)
get the current matrix for the coupling matrix Bt in the first row of blocks
CH_Matrix_Classes::Matrix modeldcstr
only for testing
Definition: QPModelBlock.hxx:58
void clear()
reset to "empty/no" model
CH_Matrix_Classes::Integer modeldim
the joint dimension of the modle, may change after any change of the point
Definition: QPSumModelBlock.hxx:41
virtual int do_step(CH_Matrix_Classes::Real alpha, const CH_Matrix_Classes::Matrix &y, MinorantBundle &global_bundle, CH_Matrix_Classes::Integer startindex_bundle)
move in the last computed step direction by a step of length alpha and compute and store the violatio...
virtual int solve_constrsys(const CH_Matrix_Classes::Symmatrix &ABchol, const CH_Matrix_Classes::Matrix &LinvABrhs, CH_Matrix_Classes::Matrix &LinvABsol, CH_Matrix_Classes::Integer startindex_model, CH_Matrix_Classes::Matrix &Crhs_and_sol, CH_Matrix_Classes::Integer startindex_constraints)
given the Cholesky factorization LL&#39; of minus the blocks A and B (contraints on design variables and ...
virtual int compute_step(const CH_Matrix_Classes::Matrix &ystep, MinorantBundle &global_bundle, CH_Matrix_Classes::Integer startindex_bundle)
compute the step in the model space given the step in the design space
virtual int get_modeldx(CH_Matrix_Classes::Matrix &modeldx, CH_Matrix_Classes::Integer startindex_model)
set the local modeldx value in modeldx beginning with startindex (initialize it, do not add) ...
combines and provides basic functionalities of QPModelDataObject and QPModelBlockObject, but is still abstract
Definition: QPModelBlock.hxx:47
virtual int prepare_BCSchur_JLprecond(CH_Matrix_Classes::Matrix &glob_lowrank, CH_Matrix_Classes::Matrix &subspace, bool append_globtransp_times_mat_to_subspace, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
compute the preconditioning low-rank representation of the Schur complementd blocks belonging to bund...
std::vector< QPModelBlock * > blocks
the container pointing to the QPModelBlock instances comprised in the sum
Definition: QPSumModelBlock.hxx:39
virtual void display_model_values(const CH_Matrix_Classes::Matrix &y, MinorantBundle &global_bundle, CH_Matrix_Classes::Integer startindex_bundle, std::ostream &out)
output for debbuging purposes
virtual int add_BCSchur_diagonal(CH_Matrix_Classes::Matrix &diagonal, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
add the diagonal of the Schur complemented blocks belonging to bundle and local constraints (used for...
abstract interface declaring the uniform outer appearance of general cutting models produced by the v...
Definition: QPModelDataObject.hxx:44
virtual int computed_Schur_step(const CH_Matrix_Classes::Matrix &xstep, const CH_Matrix_Classes::Matrix &local_step, CH_Matrix_Classes::Integer startindex_model, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
for passing on the solution information after solvin the system
CH_Matrix_Classes::Matrix modeldx
only for testing
Definition: QPModelBlock.hxx:57
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
virtual int reset_starting_point(const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real mu, MinorantBundle &global_bundle, CH_Matrix_Classes::Integer startindex_bundle)
reset the starting point for this value of the design variables y
virtual CH_Matrix_Classes::Real primalviol_2normsqr()
return the squared Euclidean norm of constraint violation of modelx
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
virtual CH_Matrix_Classes::Matrix & B_times(const CH_Matrix_Classes::Matrix &A, CH_Matrix_Classes::Matrix &C, CH_Matrix_Classes::Real alpha, CH_Matrix_Classes::Real beta, int Btrans, int Atrans, CH_Matrix_Classes::Integer startindex_model, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
C=beta*C+alpha*B*A where B and A may be transposed; carry out the model part of this beginning at sta...
virtual ~QPSumModelBlock()
virtual destructor
CH_Matrix_Classes::Matrix Bt
if the matrix of the bundle information has to be formed at least once, it is then stored here for la...
Definition: QPModelBlock.hxx:56
virtual int add_Schur_rhs(CH_Matrix_Classes::Matrix &glob_rhs, CH_Matrix_Classes::Matrix *local_rhs, CH_Matrix_Classes::Real rhsmu, CH_Matrix_Classes::Real rhscorr, CH_Matrix_Classes::Integer startindex_constraints, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
add the contributions to glob_rhs of the Schur complemented model block, and return local_rhs of the ...
virtual int recursive_copy_data_of(QPModelBlockObject *)
sofar this is only needed for some comparative evaluations
virtual int get_mu_info(CH_Matrix_Classes::Integer &mudim, CH_Matrix_Classes::Real &tr_xz, CH_Matrix_Classes::Real &tr_xdzpdxz, CH_Matrix_Classes::Real &tr_dxdz, CH_Matrix_Classes::Real &min_xz, CH_Matrix_Classes::Real &max_xz) const
add dimensions of the primal-dual pairs to mudim and add the "trace" (the inner product with center) ...
virtual CH_Matrix_Classes::Integer dim_constraints()
returns the dimension of the system describing the model set (may contain further constraints) ...
virtual int linesearch(CH_Matrix_Classes::Real &alpha) const
if necessary, reduce alpha to the biggest value so that feasibility is maintained with this step size...
virtual CH_Matrix_Classes::Real constraints_cost(void)
returns the dual upper bound to the model value (the trace weighted sum of the dual trace variables);...
virtual int get_nbh_info(CH_Matrix_Classes::Integer mudim, CH_Matrix_Classes::Real tr_xz, CH_Matrix_Classes::Real tr_xdzpdxz, CH_Matrix_Classes::Real tr_dxdz, CH_Matrix_Classes::Real nbh_ubnd, CH_Matrix_Classes::Real &alpha, CH_Matrix_Classes::Real &max_nbh, CH_Matrix_Classes::Real &nrmsqr_xz, CH_Matrix_Classes::Real &nrmsqr_xdzpdxz, CH_Matrix_Classes::Real &nrmsqr_dxdz, CH_Matrix_Classes::Real &ip_xz_xdzpdxz, CH_Matrix_Classes::Real &ip_xz_dxdz, CH_Matrix_Classes::Real &ip_dxdz_xdzpdxz) const
for limiting the stepsize with respect to the neighborhood this information about norms and inner pro...
Matrix class for real values of type Real
Definition: matrix.hxx:74
virtual CH_Matrix_Classes::Integer dim_model()
returns the dimension of the model set (here the same as the bundle size)
virtual QPModelBlockObject * clone()
return a cloned object on the heap
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
virtual int get_modelx(CH_Matrix_Classes::Matrix &modelx, CH_Matrix_Classes::Integer startindex_model)
set the local modelx value in modelx beginning with startindex (initialize it, do not add) ...
virtual CH_Matrix_Classes::Symmatrix & add_BDBt(const CH_Matrix_Classes::Matrix &diagvec, CH_Matrix_Classes::Symmatrix &bigS, bool minus, CH_Matrix_Classes::Integer startindex, CH_Matrix_Classes::Matrix &Bt, CH_Matrix_Classes::Integer startindex_model, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
add the main diagonal block tranpose(projection)*diagvec*projection to bigS starting at startindex ...
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
abstract interface for model blocks in the constrained QPSolver
Definition: QPModelBlockObject.hxx:89
virtual int computed_step(const CH_Matrix_Classes::Matrix &modelxstep, CH_Matrix_Classes::Integer startindex_model, const CH_Matrix_Classes::Matrix &modelconstrstep, CH_Matrix_Classes::Integer startindex_constr)
store this computed step locally and compute the missing local dual step information ...
QPSumModelBlock(CBout *cb=0, int cbincr=-1)
default constructor
abstract interface extension of QPModelDataObject for use in SumModel where several blocks are concat...
Definition: QPModelDataObject.hxx:105
Header declaring the classes ConicBundle::QPModelBlock, ConicBundle::QPModelPointer.
virtual CH_Matrix_Classes::Matrix & get_sysviol_constraints()
get the constraint violation for the current system solution
virtual int propose_BCSchur_pcsubspace(CH_Matrix_Classes::Matrix &lowrank, CH_Matrix_Classes::Matrix &sigma_guess, const CH_Matrix_Classes::Matrix &Diag_inv, CH_Matrix_Classes::Real minval, CH_Matrix_Classes::Real diaginvval, MinorantBundle &globalbundle, CH_Matrix_Classes::Integer startindex_bundle)
append to lowrank "large" columns that should serve well for generating a low rank projection of the ...
CH_Matrix_Classes::Integer constrdim
the joint number of constraints within the models, this may change after any change of the point ...
Definition: QPSumModelBlock.hxx:42
virtual int get_sysviol_model(CH_Matrix_Classes::Matrix &modelvec, CH_Matrix_Classes::Integer startindex_model, const CH_Matrix_Classes::Matrix &dy, MinorantBundle &global_bundle, CH_Matrix_Classes::Integer startindex_bundle)
set the model violation for the current system solution
virtual int add_localsys(CH_Matrix_Classes::Symmatrix &globalsys, CH_Matrix_Classes::Integer startindex_model, CH_Matrix_Classes::Integer startindex_constraints)
add the "scaled" minorant outer products to globalsys,
std::vector< MinorantBundle > bundle
the minorants forming the cutting model(s); how to combine them within the model(s) comprised in *thi...
Definition: QPModelBlock.hxx:53
implements a (virtual) cutting model being built of a (possibly recursive) sum of QPModelBlock cuttin...
Definition: QPSumModelBlock.hxx:35
int append(QPModelDataObject *inblock)
add another model at the end of the list
CH_Matrix_Classes::Matrix modelx
the current vector of model variables of all models comprised in *this
Definition: QPModelBlock.hxx:55
virtual int add_localrhs(CH_Matrix_Classes::Matrix &globalrhs, CH_Matrix_Classes::Real rhsmu, CH_Matrix_Classes::Real rhscorr, CH_Matrix_Classes::Integer startindex_model, CH_Matrix_Classes::Integer startindex_constraints, bool append, MinorantBundle &bundle, CH_Matrix_Classes::Integer startindex_bundel)
If mu is not zero, always add the centering term for this mu as well, if append is false...