ConicBundle
BundleDLRTrustRegionProx.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_DLRTRUSTREGIONPROX_HXX
4 #define CONICBUNDLE_DLRTRUSTREGIONPROX_HXX
5 
6 
15 #include "BundleProxObject.hxx"
16 
17 namespace ConicBundle {
18 
23 
30 {
31 private:
34 
37 
40 
43 
46 
49 
72 
75 
77  std::vector<const AffineFunctionTransformation*> aft_stack;
78 
81 
84 
86  void provide_inverse_data(bool skip_old_fixed_ind=false) const;
87 
89  void clear_inverse_data();
90 
92  void clean();
93 
95  void compute_corr()
96  //{ corr_val=sum(D)+CH_Matrix_Classes::sqr(norm2(vecH))-weightu*D.dim(); if (corr_val>D.dim()) corr_val=D.dim()/corr_val; else corr_val=1.;}
97  {corr_val=CH_Matrix_Classes::min(1.,D.rowdim()/(sum(D)+CH_Matrix_Classes::sqr(norm2(vecH))));}
98 
99 public:
103  bool local_metric=false,
104  CBout* cb=0,int inc=-1):
105  BundleProxObject(vp,local_metric,false,cb,inc),
106  weightu(1.),D(dim,1,weightu),vecH(dim,0,0.)
107  {assert(dim>=0);}
108 
111  const CH_Matrix_Classes::Matrix& in_vecH,
113  bool local_metric=false,
114  CBout* cb=0,int inc=-1):
115  BundleProxObject(vp,local_metric,false,cb,inc)
116  {weightu=1.;init(in_D,in_vecH);}
117 
119  virtual ~BundleDLRTrustRegionProx(){}
120 
122  void set_weightu(CH_Matrix_Classes::Real in_weightu);
123 
126  {return weightu;}
127 
130  {return corr_val;}
131 
133  void init(const CH_Matrix_Classes::Matrix& in_D,
134  const CH_Matrix_Classes::Matrix& in_vecH);
135 
138 
140  virtual CH_Matrix_Classes::Real dnorm_sqr(const MinorantPointer& B) const;
141 
143  virtual bool is_DLR() const
144  {return true;}
145 
147  virtual int add_H(CH_Matrix_Classes::Symmatrix& big_sym,CH_Matrix_Classes::Integer start_index=0) const;
148 
151  CH_Matrix_Classes::Matrix& outplusHx,
152  CH_Matrix_Classes::Real alpha=1.) const;
153 
156 
158  virtual void get_precond(CH_Matrix_Classes::Matrix& inD,const CH_Matrix_Classes::Matrix*& Vp) const;
159 
163  CH_Matrix_Classes::Real& offset,
164  const MinorantPointer& constant_minorant,
165  const MinorantBundle& bundle,
166  const CH_Matrix_Classes::Matrix& y,
167  const MinorantPointer& groundset_minorant,
169 
170 
172  virtual int update_QP_costs(CH_Matrix_Classes::Symmatrix& delta_Q,
173  CH_Matrix_Classes::Matrix& delta_d,
174  CH_Matrix_Classes::Real& delta_offset,
175  const MinorantPointer& constant_minorant,
176  const MinorantBundle& bundle,
177  const CH_Matrix_Classes::Matrix& center_y,
178  const MinorantPointer& groundset_minorant,
179  const MinorantPointer& delta_groundset_minorant,
180  const CH_Matrix_Classes::Indexmatrix& delta_index,
182 
183 
185  virtual int apply_modification(const GroundsetModification& gsmdf);
186 
187 
191 
195  virtual bool supports_diagonal_bounds_scaling() const {return false;}
196 
204  {
205  return 1;
206  }
207 
209  virtual bool supports_dense_variable_metric() const
210  {return false;}
211 
213  virtual bool supports_lowrank_variable_metric() const
214  {return true;}
215 
218  {return true;}
219 
221  virtual int apply_variable_metric(VariableMetricModel* groundset,
222  VariableMetricModel* model,
223  const CH_Matrix_Classes::Matrix& aggr,
225  const CH_Matrix_Classes::Matrix& y,
226  bool descent_step,
227  CH_Matrix_Classes::Real& current_weight,
228  CH_Matrix_Classes::Real model_maxviol,
229  const CH_Matrix_Classes::Indexmatrix* new_indices =0);
230 
234 
236  virtual int push_aft(const AffineFunctionTransformation* aft)
237  { aft_stack.push_back(aft); return 0;}
238 
240  virtual int pop_aft()
241  {
242  aft_stack.pop_back();
243  return 0;
244  }
245 
247  virtual int mfile_data(std::ostream& out) const;
248 
249 
250 };
251 
252 
254 }
255 
256 #endif
257 
virtual CH_Matrix_Classes::Real norm_sqr(const CH_Matrix_Classes::Matrix &B) const
returns $|B|^2_H$ (with weight included)
void compute_corr()
computes the correction value, here min(1,dim/trace(H))
Definition: BundleDLRTrustRegionProx.hxx:95
CH_Matrix_Classes::Symmatrix old_LinvQ
the old quadratic cost matrix dependent on the low rank part
Definition: BundleDLRTrustRegionProx.hxx:67
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
virtual int apply_modification(const GroundsetModification &gsmdf)
when BundleSolver is called to modify the groundset it also calls this
BundleDLRTrustRegionProx(CH_Matrix_Classes::Integer dim=0, VariableMetricSelection *vp=0, bool local_metric=false, CBout *cb=0, int inc=-1)
default constructor with empty H (equal to zero) and the dimension as argument
Definition: BundleDLRTrustRegionProx.hxx:101
abstract interface that allows to use different -norms with a positive definite matrix in the proxi...
Definition: BundleProxObject.hxx:88
virtual void get_precond(CH_Matrix_Classes::Matrix &inD, const CH_Matrix_Classes::Matrix *&Vp) const
returns a suitable approximation for preconditioning, see BundleProxObject::get_precond ...
Integer rowdim() const
returns the row dimension
Definition: matrix.hxx:215
virtual int apply_variable_metric(VariableMetricModel *groundset, VariableMetricModel *model, const CH_Matrix_Classes::Matrix &aggr, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, bool descent_step, CH_Matrix_Classes::Real &current_weight, CH_Matrix_Classes::Real model_maxviol, const CH_Matrix_Classes::Indexmatrix *new_indices=0)
see DynamicScaling
CH_Matrix_Classes::Real oldoffset
the old costant cost term;
Definition: BundleDLRTrustRegionProx.hxx:71
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
CH_Matrix_Classes::Real weightu
the current weight added to H in the form of weightu*I
Definition: BundleDLRTrustRegionProx.hxx:33
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
void provide_inverse_data(bool skip_old_fixed_ind=false) const
if not yet available this computes the low rank inverse data (possibly restricted to non fixed indice...
virtual bool is_DLR() const
return true if H is of the form diagonal matrix plus Gram matrix of a low rank matrix ...
Definition: BundleDLRTrustRegionProx.hxx:143
Real norm2(const Matrix &A)
returns the Frobenius norm of A, i.e., the square root of the sum of A(i,j)*A(i,j) over all i...
Definition: matrix.hxx:1235
CH_Matrix_Classes::Matrix _b
for compute_QP_costs() this holds the constant subgradient with zeroed fixed parts ...
Definition: BundleDLRTrustRegionProx.hxx:55
CH_Matrix_Classes::Matrix Dinv
the inverse diagonal
Definition: BundleDLRTrustRegionProx.hxx:42
virtual int compute_QP_costs(CH_Matrix_Classes::Symmatrix &Q, CH_Matrix_Classes::Matrix &d, CH_Matrix_Classes::Real &offset, const MinorantPointer &constant_minorant, const MinorantBundle &bundle, const CH_Matrix_Classes::Matrix &y, const MinorantPointer &groundset_minorant, CH_Matrix_Classes::Indexmatrix *yfixed)
computes the dual QP costs Q, d, and the constant offset to the bundle subproblem, see BundleProxObject::compute_QP_costs
virtual CH_Matrix_Classes::Matrix & add_Hx(const CH_Matrix_Classes::Matrix &x, CH_Matrix_Classes::Matrix &outplusHx, CH_Matrix_Classes::Real alpha=1.) const
adds to outplusHx and returns this
void set_weightu(CH_Matrix_Classes::Real in_weightu)
sets the next weight
Header declaring the class ConicBundle::BundleProxObject.
virtual int update_QP_costs(CH_Matrix_Classes::Symmatrix &delta_Q, CH_Matrix_Classes::Matrix &delta_d, CH_Matrix_Classes::Real &delta_offset, const MinorantPointer &constant_minorant, const MinorantBundle &bundle, const CH_Matrix_Classes::Matrix &center_y, const MinorantPointer &groundset_minorant, const MinorantPointer &delta_groundset_minorant, const CH_Matrix_Classes::Indexmatrix &delta_index, CH_Matrix_Classes::Indexmatrix *yfixed)
updates the dual QP costs Q, d, and the constant offset to the bundle subproblem, see BundleProxObjec...
virtual bool supports_diagonal_bounds_scaling() const
this implementation does not support a diagonal scaling heuristic, therefore the following routine ha...
Definition: BundleDLRTrustRegionProx.hxx:195
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
CH_Matrix_Classes::Matrix oldd
the old linear cost term;
Definition: BundleDLRTrustRegionProx.hxx:69
virtual int add_H(CH_Matrix_Classes::Symmatrix &big_sym, CH_Matrix_Classes::Integer start_index=0) const
add H to the dense symmetric matrix as a principal submatrix starting at position start_index ...
std::vector< const AffineFunctionTransformation * > aft_stack
in add_variable_metric() the stack serves to transform the given data
Definition: BundleDLRTrustRegionProx.hxx:77
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 int push_aft(const AffineFunctionTransformation *aft)
see BundleProxObject::push_aft();
Definition: BundleDLRTrustRegionProx.hxx:236
declares the interface that a BundelModel needs to provide for contributing to VariableMetric informa...
Definition: VariableMetric.hxx:111
CH_Matrix_Classes::Real get_term_corr() const
returns a correction factor for termination precision if the quadratic term is strong ...
Definition: BundleDLRTrustRegionProx.hxx:129
CH_Matrix_Classes::Real _delta
for compute_QP_costs() this holds the constant offset including fixed contributions ...
Definition: BundleDLRTrustRegionProx.hxx:59
CH_Matrix_Classes::Matrix _c
for compute_QP_costs() this holds the offset values including fixed contributions ...
Definition: BundleDLRTrustRegionProx.hxx:57
virtual int mfile_data(std::ostream &out) const
output the description of the scaling in mfile-suitable format
const CH_Matrix_Classes::Indexmatrix * new_indices
if values should be computed for a new subset indices, this is stored here
Definition: BundleDLRTrustRegionProx.hxx:74
CH_Matrix_Classes::Matrix indLinvHt
for compute_QP_costs() this holds L^{-1}* vecH^T for non fixed indices
Definition: BundleDLRTrustRegionProx.hxx:65
virtual int diagonal_bounds_scaling_update(const CH_Matrix_Classes::Matrix &)
if supported, D_update has to contain nonnegative numbers that are permanently added to the diagonal ...
Definition: BundleDLRTrustRegionProx.hxx:203
CH_Matrix_Classes::Matrix _y
for compute_QP_costs() this holds the non_fixed part of center_y
Definition: BundleDLRTrustRegionProx.hxx:61
bool needs_cleaning
flag for variable metric, whether columns have been orthogonalized and lam truncated ...
Definition: BundleDLRTrustRegionProx.hxx:80
CH_Matrix_Classes::Integer max_columns
for variable metric this gives an upper bound for collecting columns before cleaning ...
Definition: BundleDLRTrustRegionProx.hxx:83
virtual int pop_aft()
see BundleProxObject::pop_aft();
Definition: BundleDLRTrustRegionProx.hxx:240
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
CH_Matrix_Classes::Matrix vecH
orthogonal columns for the low rank representation (columns scaled by sqrts of eigenvalues) ...
Definition: BundleDLRTrustRegionProx.hxx:39
virtual CH_Matrix_Classes::Real dnorm_sqr(const MinorantPointer &B) const
returns $|B|^2_{H^{-1}}$ (with weight included)
CH_Matrix_Classes::Real corr_val
the correction value for correcting termination precision
Definition: BundleDLRTrustRegionProx.hxx:48
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
CH_Matrix_Classes::Real get_weightu() const
returns the current weight in use
Definition: BundleDLRTrustRegionProx.hxx:125
CH_Matrix_Classes::Matrix D
the diagonal with weightu in it
Definition: BundleDLRTrustRegionProx.hxx:36
CH_Matrix_Classes::Matrix indDinv
the inverse diagonal
Definition: BundleDLRTrustRegionProx.hxx:63
CH_Matrix_Classes::Indexmatrix old_fixed_ind
the fixed indices for which the QP_costs were computed
Definition: BundleDLRTrustRegionProx.hxx:51
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
int sqr(int a)
return a*a for int a
Definition: mymath.hxx:103
void init(const CH_Matrix_Classes::Matrix &in_D, const CH_Matrix_Classes::Matrix &in_vecH)
reset the prox information; the diagaonal part in_D must be a nonnegative column vector, the low rank part in_vecH must have the same number of rows as in_D
virtual int add_variable_metric(CH_Matrix_Classes::Matrix &diagH, CH_Matrix_Classes::Matrix &vecH)
see BundleProxObject::add_variable_metric()
void clean()
if not clean this orthogonalizes vecH and trucates lamH
CH_Matrix_Classes::Matrix LinvHt
this holds L^{-1}*vecH^T*D^{-1} whenever its column dimension equals the row dimension of vecH ...
Definition: BundleDLRTrustRegionProx.hxx:45
virtual BundleProxObject * projected_clone(const CH_Matrix_Classes::Indexmatrix &indices)
in order to allow for fixed variables, this generates a clone restricted to the given indices ...
virtual bool supports_lowrank_variable_metric() const
returns true if variable metric with low rank structure is supported
Definition: BundleDLRTrustRegionProx.hxx:213
CH_Matrix_Classes::Matrix _A
for compute_QP_costs() this holds the subgradients with zeroed fixed parts
Definition: BundleDLRTrustRegionProx.hxx:53
void clear_inverse_data()
if the metric or weightu changes, this resets the inverse data to "not provided"
double min(double a, double b)
minimum value of two double variables
Definition: mymath.hxx:49
Collects modifications for the unconstrained Groundset for appending, deleting or reassigning variabl...
Definition: GroundsetModification.hxx:32
Integer sum(const Indexmatrix &A)
returns the sum over all elements of A, i.e., (1 1 ... 1)*A*(1 1 ... 1)^T
transform a function f(z) to fun_coeff*f(arg_offset+arg_trafo*y)+linear_cost*y+fun_offset (scales the...
Definition: AffineFunctionTransformation.hxx:68
implements the abstract interface ConicBundle::BundleProxObject for with , i.e., a low rank represen...
Definition: BundleDLRTrustRegionProx.hxx:29
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
virtual bool supports_dense_variable_metric() const
returns true if variable metric with dense symmetric matrices is supported
Definition: BundleDLRTrustRegionProx.hxx:209
BundleDLRTrustRegionProx(const CH_Matrix_Classes::Matrix &in_D, const CH_Matrix_Classes::Matrix &in_vecH, VariableMetricSelection *vp=0, bool local_metric=false, CBout *cb=0, int inc=-1)
constructs H=(D+weightu)+vecH*transpose(vecH) with weightu=1., so in_D must be a column vector with s...
Definition: BundleDLRTrustRegionProx.hxx:110
virtual CH_Matrix_Classes::Matrix & apply_Hinv(CH_Matrix_Classes::Matrix &x) const
returns where
virtual bool supports_diagonal_variable_metric() const
returns true if variable metric with diagonal matrices is supported
Definition: BundleDLRTrustRegionProx.hxx:217