ConicBundle
BundleIdProx.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_BUNDLEIDPROX_HXX
4 #define CONICBUNDLE_BUNDLEIDPROX_HXX
5 
6 
15 #include "BundleProxObject.hxx"
16 
17 namespace ConicBundle {
18 
23 
29 {
30 private:
35 
37  typedef std::map<MinorantPointer,CH_Matrix_Classes::Integer> MinorantPointerMap;
39  MinorantPointerMap oldmap;
54 
55  // CH_Matrix_Classes::Symmatrix last_Q; ///< for testing updates
56  //CH_Matrix_Classes::Matrix last_d; ///< for testing updates
57  // CH_Matrix_Classes::Real last_offset; ///< for testing updates
58 
59 public:
62  BundleProxObject(0,false,false,cb,cbinc)
63  {dim=d;weightu=CH_Matrix_Classes::max(CH_Matrix_Classes::eps_Real,w);oldweightu=1.;}
65  virtual ~BundleIdProx(){}
66 
68  virtual void set_weightu(CH_Matrix_Classes::Real in_weightu)
70 
73  {return weightu;}
74 
75 
76 
78  virtual CH_Matrix_Classes::Real get_term_corr(void) const {return CH_Matrix_Classes::min(1.,1/weightu);}
79 
82  {return weightu*CH_Matrix_Classes::ip(B,B);}
83 
86  {return B.dual_norm_squared()/weightu;}
87 
89  virtual bool is_DLR() const
90  {return true;}
91 
93  virtual int add_H(CH_Matrix_Classes::Symmatrix& big_sym,CH_Matrix_Classes::Integer start_index=0) const;
94 
97  CH_Matrix_Classes::Matrix& outplusHx,
98  CH_Matrix_Classes::Real alpha=1.) const
99  {return outplusHx.xpeya(x,weightu*alpha);}
100 
103  {return x/=weightu;}
104 
107  {D.init(dim,1,weightu);Vp=0;}
108 
109 
113  CH_Matrix_Classes::Real& offset,
114  const MinorantPointer& constant_minorant,
115  const MinorantBundle& bundle,
116  const CH_Matrix_Classes::Matrix& y,
117  const MinorantPointer& groundset_minorant,
119 
120 
122  virtual int update_QP_costs(CH_Matrix_Classes::Symmatrix& delta_Q,
123  CH_Matrix_Classes::Matrix& delta_d,
124  CH_Matrix_Classes::Real& delta_offset,
125  const MinorantPointer& constant_minorant,
126  const MinorantBundle& bundle,
127  const CH_Matrix_Classes::Matrix& center_y,
128  const MinorantPointer& groundset_minorant,
129  const MinorantPointer& delta_groundset_minorant,
130  const CH_Matrix_Classes::Indexmatrix& delta_index,
132 
134  virtual int apply_modification(const GroundsetModification& gsmdf);
135 
139  { return new BundleIdProx(indices.dim(),weightu,this,0); }
140 
142  virtual int mfile_data(std::ostream& out) const;
143 
144 };
145 
146 
148 }
149 
150 #endif
151 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
CH_Matrix_Classes::Real _delta
for storing the offset of the constant minorant
Definition: BundleIdProx.hxx:53
std::map< MinorantPointer, CH_Matrix_Classes::Integer > MinorantPointerMap
The MinorantPointerMap serves to locate an identical MinorantPointer in a previous bundle in order to...
Definition: BundleIdProx.hxx:37
Matrix & xpeya(const Matrix &A, Real d=1.)
sets *this+=d*A and returns *this
abstract interface that allows to use different -norms with a positive definite matrix in the proxi...
Definition: BundleProxObject.hxx:88
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
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 CH_Matrix_Classes::Real get_weightu() const
returns the current weight of the proximal term
Definition: BundleIdProx.hxx:72
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 ...
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
Matrix & init(const Matrix &A, Real d=1., int atrans=0)
initialize to *this=A*d where A may be transposed
Definition: matrix.hxx:1035
CH_Matrix_Classes::Indexmatrix old_fixed_ind
the old fixed indices for which oldmap and oldQ were computed
Definition: BundleIdProx.hxx:45
virtual CH_Matrix_Classes::Real get_term_corr(void) const
returns the correction factor for the termination criterion, here min(1,1/weight) ...
Definition: BundleIdProx.hxx:78
const Real eps_Real
machine epsilon for type Real
Definition: matop.hxx:59
Header declaring the class ConicBundle::BundleProxObject.
virtual CH_Matrix_Classes::Matrix & apply_Hinv(CH_Matrix_Classes::Matrix &x) const
returns
Definition: BundleIdProx.hxx:102
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
virtual CH_Matrix_Classes::Real dnorm_sqr(const MinorantPointer &B) const
returns
Definition: BundleIdProx.hxx:85
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
CH_Matrix_Classes::Matrix _c
for storing the offsets of the minorants
Definition: BundleIdProx.hxx:51
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
virtual int apply_modification(const GroundsetModification &gsmdf)
when BundleSolver is called to modify the groundset it also calls this
CH_Matrix_Classes::Symmatrix oldQ
the old quadratic cost matrix; this is where oldmap points into
Definition: BundleIdProx.hxx:41
MinorantPointerMap oldmap
identifies which MinorantPointer was used last time in which position
Definition: BundleIdProx.hxx:39
CH_Matrix_Classes::Real oldweightu
the weight value used for computing the old quadratic cost matrix
Definition: BundleIdProx.hxx:43
CH_Matrix_Classes::Matrix _b
for storing the relevant linear parts of the constant minorant
Definition: BundleIdProx.hxx:49
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 ...
Definition: BundleIdProx.hxx:138
CH_Matrix_Classes::Matrix _A
for storing the relevant linear parts of the minorants
Definition: BundleIdProx.hxx:47
virtual void set_weightu(CH_Matrix_Classes::Real in_weightu)
set the weight of the proximal term
Definition: BundleIdProx.hxx:68
CH_Matrix_Classes::Integer dim
the dimension of the identity
Definition: BundleIdProx.hxx:34
CH_Matrix_Classes::Real weightu
the weight for the proximal term
Definition: BundleIdProx.hxx:32
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
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
implements the abstract interface ConicBundle::BundleProxObject for with H=weight*I, giving rise to a pure augmented model without scaling
Definition: BundleIdProx.hxx:28
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
double max(double a, double b)
maximum value of two double variables
Definition: mymath.hxx:43
CH_Matrix_Classes::Real dual_norm_squared(const CH_Matrix_Classes::Matrix *D=0) const
Compute the dual norm squared of this for the given diagonal matrix D (identity if not given)...
double min(double a, double b)
minimum value of two double variables
Definition: mymath.hxx:49
virtual bool is_DLR() const
return true if H is of the form diagonal matrix plus Gram matrix of a low rank matrix ...
Definition: BundleIdProx.hxx:89
Collects modifications for the unconstrained Groundset for appending, deleting or reassigning variabl...
Definition: GroundsetModification.hxx:32
virtual int mfile_data(std::ostream &out) const
output the description of the prox term in mfile-suitable format
BundleIdProx(CH_Matrix_Classes::Integer d=0, CH_Matrix_Classes::Real w=1., CBout *cb=0, int cbinc=-1)
initialize with dimension and weight
Definition: BundleIdProx.hxx:61
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
Definition: BundleIdProx.hxx:96
void dim(Integer &_nr, Integer &_nc) const
returns the number of rows in _nr and the number of columns in _nc
Definition: indexmat.hxx:315
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
Real ip(const Matrix &A, const Matrix &B)
returns the usual inner product of A and B, i.e., the sum of A(i,j)*B(i,j) over all i...
Definition: matrix.hxx:1165
virtual CH_Matrix_Classes::Real norm_sqr(const CH_Matrix_Classes::Matrix &B) const
returns
Definition: BundleIdProx.hxx:81
virtual void get_precond(CH_Matrix_Classes::Matrix &D, const CH_Matrix_Classes::Matrix *&Vp) const
returns a suitable approximation for preconditioning, see BundleProxObject::get_precond ...
Definition: BundleIdProx.hxx:106