ConicBundle
BundleLowRankTrustRegionProx.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_LOWRANKTRUSTREGIONPROX_HXX
4 #define CONICBUNDLE_LOWRANKTRUSTREGIONPROX_HXX
5 
6 
15 #include "BundleProxObject.hxx"
16 
17 namespace ConicBundle {
18 
23 
40 {
41 private:
44 
47 
50 
53 
56 
59 
62 
83 
86 
88  std::vector<const AffineFunctionTransformation*> aft_stack;
89 
92 
95 
97  void clean();
98 
101  //{ corr_val=sum(lamH); if ((vecH.rowdim()>0)&&(corr_val>vecH.rowdim())) corr_val=vecH.rowdim()/corr_val; else corr_val=1.;}
102  { corr_val=CH_Matrix_Classes::min(1.,vecH.rowdim()/(weightu*vecH.rowdim()+sum(lamH)));}
103 
104 public:
108  bool local_metric=false,
109  CBout* cb=0,int inc=-1):
110  BundleProxObject(vp,local_metric,false,cb,inc),
111  weightu(1.),vecH(dim,0,0.),lamH(0,1,0.)
112  {
113  assert(dim>=0);
114  }
115 
118  const CH_Matrix_Classes::Matrix& in_lamH,
120  bool local_metric=false,
121  CBout* cb=0,int inc=-1):
122  BundleProxObject(vp,local_metric,false,cb,inc)
123  {
124  weightu=1.;
125  init(in_vecH,in_lamH);
126  }
127 
130 
132  void set_weightu(CH_Matrix_Classes::Real in_weightu);
133 
136  {return weightu;}
137 
140  {return corr_val;}
141 
143  void init(const CH_Matrix_Classes::Matrix& in_vecH,
144  const CH_Matrix_Classes::Matrix& in_lamH);
145 
148 
150  virtual CH_Matrix_Classes::Real dnorm_sqr(const MinorantPointer& B) const;
151 
153  virtual bool is_DLR() const
154  {return true;}
155 
157  virtual int add_H(CH_Matrix_Classes::Symmatrix& big_sym,CH_Matrix_Classes::Integer start_index=0) const;
158 
161  CH_Matrix_Classes::Matrix& outplusHx,
162  CH_Matrix_Classes::Real alpha=1.) const;
163 
166 
168  virtual void get_precond(CH_Matrix_Classes::Matrix& inD,const CH_Matrix_Classes::Matrix*& Vp) const;
169 
173  CH_Matrix_Classes::Real& offset,
174  const MinorantPointer& constant_minorant,
175  const MinorantBundle& bundle,
176  const CH_Matrix_Classes::Matrix& y,
177  const MinorantPointer& groundset_minorant,
179 
180 
182  virtual int update_QP_costs(CH_Matrix_Classes::Symmatrix& delta_Q,
183  CH_Matrix_Classes::Matrix& delta_d,
184  CH_Matrix_Classes::Real& delta_offset,
185  const MinorantPointer& constant_minorant,
186  const MinorantBundle& bundle,
187  const CH_Matrix_Classes::Matrix& center_y,
188  const MinorantPointer& groundset_minorant,
189  const MinorantPointer& delta_groundset_minorant,
190  const CH_Matrix_Classes::Indexmatrix& delta_index,
192 
193 
195  virtual int apply_modification(const GroundsetModification& gsmdf);
196 
197 
201 
205  virtual bool supports_diagonal_bounds_scaling() const {return false;}
206 
214  {
215  return 1;
216  }
217 
219  virtual bool supports_dense_variable_metric() const
220  {return false;}
221 
223  virtual bool supports_lowrank_variable_metric() const
224  {return true;}
225 
228  {return false;}
229 
231  virtual int apply_variable_metric(VariableMetricModel* groundset,
232  VariableMetricModel* model,
233  const CH_Matrix_Classes::Matrix& aggr,
235  const CH_Matrix_Classes::Matrix& y,
236  bool descent_step,
237  CH_Matrix_Classes::Real& current_weight,
238  CH_Matrix_Classes::Real model_maxviol,
239  const CH_Matrix_Classes::Indexmatrix* new_indices =0);
240 
244 
246  virtual int push_aft(const AffineFunctionTransformation* aft)
247  { aft_stack.push_back(aft); return 0;}
248 
250  virtual int pop_aft()
251  {
252  aft_stack.pop_back();
253  return 0;
254  }
255 
257  virtual int mfile_data(std::ostream& out) const;
258 
259 
260 };
261 
262 
264 }
265 
266 #endif
267 
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
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
CH_Matrix_Classes::Matrix lamH
positive definite scalars for the diagonal vecH*Diag(lamH)*transpose(vecH)
Definition: BundleLowRankTrustRegionProx.hxx:49
CH_Matrix_Classes::Matrix vecH
orthonormal columns for the low rank representation
Definition: BundleLowRankTrustRegionProx.hxx:46
abstract interface that allows to use different -norms with a positive definite matrix in the proxi...
Definition: BundleProxObject.hxx:88
CH_Matrix_Classes::Matrix oldd
the old linear cost term;
Definition: BundleLowRankTrustRegionProx.hxx:80
void set_weightu(CH_Matrix_Classes::Real in_weightu)
sets the next weight
Integer rowdim() const
returns the row dimension
Definition: matrix.hxx:215
CH_Matrix_Classes::Matrix sqrtlamHi
the square root of the diagonal weights adapted for the low rank inverse
Definition: BundleLowRankTrustRegionProx.hxx:58
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...
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
virtual int mfile_data(std::ostream &out) const
output the description of the prox term in mfile-suitable format
virtual int pop_aft()
see BundleProxObject::pop_aft();
Definition: BundleLowRankTrustRegionProx.hxx:250
CH_Matrix_Classes::Matrix _b
for compute_QP_costs() this holds the constant subgradient with zeroed fixed parts ...
Definition: BundleLowRankTrustRegionProx.hxx:68
CH_Matrix_Classes::Real weightu
the current weight added to H in the form of weightu*I
Definition: BundleLowRankTrustRegionProx.hxx:43
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
virtual bool supports_dense_variable_metric() const
returns true if dynamic scaling with dense symmetric matrices is supported
Definition: BundleLowRankTrustRegionProx.hxx:219
std::vector< const AffineFunctionTransformation * > aft_stack
in add_variable_metric() the stack serves to transform the given data
Definition: BundleLowRankTrustRegionProx.hxx:88
virtual bool is_DLR() const
return true if H is of the form diagonal matrix plus Gram matrix of a low rank matrix ...
Definition: BundleLowRankTrustRegionProx.hxx:153
virtual ~BundleLowRankTrustRegionProx()
destructor
Definition: BundleLowRankTrustRegionProx.hxx:129
void init(const CH_Matrix_Classes::Matrix &in_vecH, const CH_Matrix_Classes::Matrix &in_lamH)
reset the prox information; in_vecH must be an orthogonal matrix with in_vecH.rowdim() matching the d...
virtual int diagonal_scaling_heuristic_update(const CH_Matrix_Classes::Matrix &)
if supported, D_update has to contain nonnegative numbers that are permanently added to the diagonal ...
Definition: BundleLowRankTrustRegionProx.hxx:213
virtual CH_Matrix_Classes::Real norm_sqr(const CH_Matrix_Classes::Matrix &B) const
returns $|B|^2_H$ (with weight included)
virtual int push_aft(const AffineFunctionTransformation *aft)
see BundleProxObject::push_aft();
Definition: BundleLowRankTrustRegionProx.hxx:246
bool needs_cleaning
flag for variable metric, whether columns have been orthogonalized and lam truncated ...
Definition: BundleLowRankTrustRegionProx.hxx:91
Header declaring the class ConicBundle::BundleProxObject.
CH_Matrix_Classes::Matrix LinvindHt
for compute_QP_costs() this holds L^{-1}* vecH^T for non fixed indices
Definition: BundleLowRankTrustRegionProx.hxx:76
CH_Matrix_Classes::Matrix _A
for compute_QP_costs() this holds the subgradients with zeroed fixed parts
Definition: BundleLowRankTrustRegionProx.hxx:66
implements the abstract interface BundleProxObject for with , i.e., a low rank representation of a s...
Definition: BundleLowRankTrustRegionProx.hxx:39
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
virtual CH_Matrix_Classes::Matrix & apply_Hinv(CH_Matrix_Classes::Matrix &x) const
returns where
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 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 DynamicProx
CH_Matrix_Classes::Real get_term_corr() const
returns a correction factor for termination precision if the quadratic term is strong ...
Definition: BundleLowRankTrustRegionProx.hxx:139
declares the interface that a BundelModel needs to provide for contributing to VariableMetric informa...
Definition: VariableMetric.hxx:111
BundleLowRankTrustRegionProx(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: BundleLowRankTrustRegionProx.hxx:106
CH_Matrix_Classes::Matrix _c
for compute_QP_costs() this holds the offset values including fixed contributions ...
Definition: BundleLowRankTrustRegionProx.hxx:70
CH_Matrix_Classes::Matrix _y
for compute_QP_costs() this holds the non_fixed part of center_y
Definition: BundleLowRankTrustRegionProx.hxx:74
CH_Matrix_Classes::Indexmatrix old_fixed_ind
the fixed indices for which the QP_costs were computed
Definition: BundleLowRankTrustRegionProx.hxx:64
CH_Matrix_Classes::Real get_weightu() const
returns the current weight in use
Definition: BundleLowRankTrustRegionProx.hxx:135
virtual bool supports_diagonal_variable_metric() const
returns true if dynamic scaling with diagonal matrices is supported
Definition: BundleLowRankTrustRegionProx.hxx:227
CH_Matrix_Classes::Real _delta
for compute_QP_costs() this holds the constant offset including fixed contributions ...
Definition: BundleLowRankTrustRegionProx.hxx:72
CH_Matrix_Classes::Integer max_columns
for variable metric this gives an upper bound for collecting columns before cleaning ...
Definition: BundleLowRankTrustRegionProx.hxx:94
virtual bool supports_diagonal_bounds_scaling() const
this implementation does not support a diagonal scaling heuristic, therefore the following routine ha...
Definition: BundleLowRankTrustRegionProx.hxx:205
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::Real oldoffset
the old costant cost term;
Definition: BundleLowRankTrustRegionProx.hxx:82
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
virtual CH_Matrix_Classes::Real dnorm_sqr(const MinorantPointer &B) const
returns $|B|^2_{H^{-1}}$ (with weight included)
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
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
CH_Matrix_Classes::Matrix lamHi
the diagonal weights adapted for the low rank inverse
Definition: BundleLowRankTrustRegionProx.hxx:55
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 ...
const CH_Matrix_Classes::Indexmatrix * new_indices
if values should be computed for a new subset indices, this is stored here
Definition: BundleLowRankTrustRegionProx.hxx:85
void compute_corr()
computes the correction value, here min(1,dim/trace(H))
Definition: BundleLowRankTrustRegionProx.hxx:100
CH_Matrix_Classes::Real corr_val
the correction value for correcting termination precision
Definition: BundleLowRankTrustRegionProx.hxx:61
CH_Matrix_Classes::Symmatrix old_LinvQ
the old quadratic cost matrix dependent on the low rank part
Definition: BundleLowRankTrustRegionProx.hxx:78
CH_Matrix_Classes::Matrix scaled_vecH
vecH*Diag(sqrt(lamH)) for use in preconditioning
Definition: BundleLowRankTrustRegionProx.hxx:52
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
BundleLowRankTrustRegionProx(const CH_Matrix_Classes::Matrix &in_vecH, const CH_Matrix_Classes::Matrix &in_lamH, VariableMetricSelection *vp=0, bool local_metric=false, CBout *cb=0, int inc=-1)
constructs H=vecH*Diag(lamH)*transpose(vecH), so in_lamH must be a column vector with same dimension ...
Definition: BundleLowRankTrustRegionProx.hxx:117
virtual bool supports_lowrank_variable_metric() const
returns true if dynamic scaling with low rank structure is supported
Definition: BundleLowRankTrustRegionProx.hxx:223
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 ...
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
virtual int apply_modification(const GroundsetModification &gsmdf)
when BundleSolver is called to modify the groundset it also calls this
void clean()
if not clean this orthogonalizes vecH and trucates lamH
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
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 int add_variable_metric(CH_Matrix_Classes::Matrix &diagH, CH_Matrix_Classes::Matrix &vecH)
see BundleProxObject::add_dynamic_scaling()