ConicBundle
SOCIPBlock.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_SOCIPBLOCK_HXX
4 #define CONICBUNDLE_SOCIPBLOCK_HXX
5 
13 #include "InteriorPointBlock.hxx"
14 
15 namespace ConicBundle {
16 
21 
27 class SOCIPBlock: public virtual InteriorPointBlock
28 {
29 protected:
35 
42 
46 
48 
51 
55 
57  void point_changed();
58 
61 
64 
67 
70 
73 
75  int apply_Fsqr(CH_Matrix_Classes::Real* vp,bool minus=false) const;
76 
79 
81  int apply_Finvsqr(CH_Matrix_Classes::Real *vp,bool minus=false) const;
82 
84  int compute_NTscaling(void);
85 
86 public:
88  virtual void clear(CH_Matrix_Classes::Integer dim=0);
89 
91  SOCIPBlock(CH_Matrix_Classes::Integer dim=0, CBout* cb=0,int cbinc=-1);
92 
94  ~SOCIPBlock();
95 
97  virtual CH_Matrix_Classes::Integer get_vecdim() const;
98 
100  virtual int center_x(CH_Matrix_Classes::Real val,bool add=false);
101 
103  virtual int center_z(CH_Matrix_Classes::Real val,bool add=false);
104 
106  virtual int set_x(const CH_Matrix_Classes::Matrix& vec,CH_Matrix_Classes::Integer startindex,CH_Matrix_Classes::Real& add_center_value);
107 
109  virtual int set_z(const CH_Matrix_Classes::Matrix& vec,CH_Matrix_Classes::Integer startindex,CH_Matrix_Classes::Real& add_center_value);
110 
112  virtual int vecgetsax(CH_Matrix_Classes::Matrix& vec,
113  CH_Matrix_Classes::Integer startindex,
115  bool add=false);
116 
118  virtual int vecgetsaz(CH_Matrix_Classes::Matrix& vec,
119  CH_Matrix_Classes::Integer startindex,
121  bool add=false);
122 
124  virtual int get_mu_info(CH_Matrix_Classes::Integer& mudim,
126  CH_Matrix_Classes::Real& tr_xdzpdxz,
127  CH_Matrix_Classes::Real& tr_dxdz,
128  CH_Matrix_Classes::Real& min_xz,
129  CH_Matrix_Classes::Real& max_xz) const;
130 
132  virtual int get_nbh_info(CH_Matrix_Classes::Integer mudim,
134  CH_Matrix_Classes::Real tr_xdzpdxz,
135  CH_Matrix_Classes::Real tr_dxdz,
136  CH_Matrix_Classes::Real nbh_ubnd,
138  CH_Matrix_Classes::Real& max_nbh,
139  CH_Matrix_Classes::Real& nrmsqr_xz,
140  CH_Matrix_Classes::Real& nrmsqr_xdzpdxz,
141  CH_Matrix_Classes::Real& nrmsqr_dxdz,
142  CH_Matrix_Classes::Real& ip_xz_xdzpdxz,
143  CH_Matrix_Classes::Real& ip_xz_dxdz,
144  CH_Matrix_Classes::Real& ip_dxdz_xdzpdxz) const;
145 
147  virtual int linesearch(CH_Matrix_Classes::Real& alpha) const;
148 
150  virtual int add_muxinv(CH_Matrix_Classes::Matrix& rhs,
151  CH_Matrix_Classes::Integer startindex,
153  CH_Matrix_Classes::Real rhscorr,
154  bool minus=false);
155 
156 
158  virtual int set_dx(const CH_Matrix_Classes::Matrix& rhs,CH_Matrix_Classes::Integer startindex);
159 
162 
163 
165  virtual int apply_xizinv(CH_Matrix_Classes::Matrix& rhs,
166  CH_Matrix_Classes::Integer startindex,
167  bool minus=false);
168 
170  virtual int apply_xiz(CH_Matrix_Classes::Matrix& rhs,
171  CH_Matrix_Classes::Integer startindex,
172  bool minus=false);
173 
175  virtual int do_step(CH_Matrix_Classes::Real alpha);
176 
178  virtual int add_AxizinvAt(const CH_Matrix_Classes::Matrix& A,
179  CH_Matrix_Classes::Symmatrix& globalsys,
180  bool minus=false,
181  bool Atrans=false);
182 
184  virtual int add_xiz(CH_Matrix_Classes::Symmatrix& globalsys,CH_Matrix_Classes::Integer startindex,bool minus=false);
185 
186 
187 
188  //---------------------- mainly for testing
189 
192  { CH_Matrix_Classes::mat_xey(vecdim,vecx.get_store()+startindex,x.get_store());return 0; }
193 
196  { CH_Matrix_Classes::mat_xey(vecdim,vecz.get_store()+startindex,z.get_store());return 0; }
197 
200  {
201  if (dx.dim()!=vecdim)
202  return 1;
203  CH_Matrix_Classes::mat_xey(vecdim,vecdx.get_store()+startindex,dx.get_store());
204  return 0;
205  }
206 
207 
210  {
211  if (dz.dim()!=vecdim)
212  return 1;
213  CH_Matrix_Classes::mat_xey(vecdim,vecdz.get_store()+startindex,dz.get_store());
214  return 0;
215  }
216 
217 };
218 
219 
221 
222 }
223 
224 #endif
225 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
virtual CH_Matrix_Classes::Integer get_vecdim() const
returns the dimension of the cone
CH_Matrix_Classes::Real last_rhs_mu
the last mu used in rhs computations
Definition: SOCIPBlock.hxx:43
virtual int set_dx(const CH_Matrix_Classes::Matrix &rhs, CH_Matrix_Classes::Integer startindex)
extract dx from rhs at startindex and compute at the same time dz (=-sys dx -z +complentarity_rhs); ...
interface for interior point variable and routines specific to primal dual complementarity conditions...
Definition: SOCIPBlock.hxx:27
CH_Matrix_Classes::Matrix & apply_Arw(const CH_Matrix_Classes::Matrix &x, CH_Matrix_Classes::Matrix &v) const
apply Arw(x)=[ x0, barx'; barx, x0*I ] to matrix v overwriting and returning it
virtual int set_x(const CH_Matrix_Classes::Matrix &vec, CH_Matrix_Classes::Integer startindex, CH_Matrix_Classes::Real &add_center_value)
set x to the values of vec[startindex+0,+1 ...,+(vecdim-1)] and return in add_center_value a value>=0...
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
virtual void clear(CH_Matrix_Classes::Integer dim=0)
reset all point information to zero for dimension dim, the rest to zero
Header declaring the class ConicBundle::InteriorPointBlock.
void point_changed()
clear variables that are no longer valid for the current point
void dim(Integer &_nr, Integer &_nc) const
returns the number of rows in _nr and the number of columns in _nc
Definition: matrix.hxx:209
CH_Matrix_Classes::Matrix dz
current step for z
Definition: SOCIPBlock.hxx:34
CH_Matrix_Classes::Matrix & apply_Finvsqr(CH_Matrix_Classes::Matrix &v, bool minus=false) const
apply Finvsqr(f)= (1/omega^2)*[2*f0^2-1, -2*f0*barf'; -2*f0*barf, I+2*barf*barf']; to v overwriting a...
~SOCIPBlock()
destructor
CH_Matrix_Classes::Real gammazsqr
gamma(z)^2=z0*z0-barz'*barz
Definition: SOCIPBlock.hxx:37
abstract interface for interior point vector/matrix variables and routines specific to primal dual co...
Definition: InteriorPointBlock.hxx:30
CH_Matrix_Classes::Real gammaxsqr
gamma(x)^2=x0*x0-barx'*barx
Definition: SOCIPBlock.hxx:36
Real * get_store()
returns the current address of the internal value array; use cautiously, do not use delete! ...
Definition: matrix.hxx:326
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
CH_Matrix_Classes::Real old_mu
in a step old_mu gets the value of mu before this gets last_rhs_mu
Definition: SOCIPBlock.hxx:45
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 oldx
point before x
Definition: SOCIPBlock.hxx:49
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 int add_xiz(CH_Matrix_Classes::Symmatrix &globalsys, CH_Matrix_Classes::Integer startindex, bool minus=false)
add (or subract if minus==true) the system matrix to a big system matrix starting at startindex ...
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
virtual int apply_xiz(CH_Matrix_Classes::Matrix &rhs, CH_Matrix_Classes::Integer startindex, bool minus=false)
compute sys*rhs into rhs, possibly with a negative sign
CH_Matrix_Classes::Matrix oldz
point before z
Definition: SOCIPBlock.hxx:50
virtual int add_muxinv(CH_Matrix_Classes::Matrix &rhs, CH_Matrix_Classes::Integer startindex, CH_Matrix_Classes::Real rhsmu, CH_Matrix_Classes::Real rhscorr, bool minus=false)
compute the complementarity_rhs=rhsmu*xi-rhscorr*xi*dx*dz (wihtout "-z") for mu=rhsmu and for correct...
virtual int set_dx_xizsolverhs(const CH_Matrix_Classes::Matrix &rhs, CH_Matrix_Classes::Integer startindex)
compute dx=sysinv*rhs and at the same time dz (=-rhs -z +complentarity_rhs);
virtual int get_vecdz(CH_Matrix_Classes::Matrix &vecdz, CH_Matrix_Classes::Integer startindex)
return the vector form of dz, 1 if not available
Definition: SOCIPBlock.hxx:209
virtual int set_z(const CH_Matrix_Classes::Matrix &vec, CH_Matrix_Classes::Integer startindex, CH_Matrix_Classes::Real &add_center_value)
set z to the values of vec[startindex+0,+1 ...,+(vecdim-1)] and add sufficient center to make z feasi...
void mat_xey(Integer len, Val *x, const Val *y)
Copy an array of length len to destination x from source y.
Definition: matop.hxx:117
virtual int center_z(CH_Matrix_Classes::Real val, bool add=false)
set z to value*"one" to z, or if add==true, add value*"one" to z
CH_Matrix_Classes::Matrix tmpmat
temporary matrix to reduce reallocations
Definition: SOCIPBlock.hxx:53
int compute_NTscaling(void)
compute omega and f for NT scaling
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...
CH_Matrix_Classes::Integer vecdim
dimension of the cone
Definition: SOCIPBlock.hxx:30
CH_Matrix_Classes::Real omega
omega=sqrt(gamma(z)/gamma(x))
Definition: SOCIPBlock.hxx:38
CH_Matrix_Classes::Matrix tmpvec
temporary vector to reduce reallocations
Definition: SOCIPBlock.hxx:52
virtual int get_vecx(CH_Matrix_Classes::Matrix &vecx, CH_Matrix_Classes::Integer startindex)
return the vector form of x
Definition: SOCIPBlock.hxx:191
Matrix class for real values of type Real
Definition: matrix.hxx:74
SOCIPBlock(CH_Matrix_Classes::Integer dim=0, CBout *cb=0, int cbinc=-1)
default constructor, also allows to initialize the dimension
CH_Matrix_Classes::Matrix dx
current step for x
Definition: SOCIPBlock.hxx:33
CH_Matrix_Classes::Matrix & apply_Finv(CH_Matrix_Classes::Matrix &v) const
apply Finv(f)= (1/omega)*[f0, -barf'; -barf, I+barf*barf'/(1+f0)]; to v overwriting and returning it...
virtual int center_x(CH_Matrix_Classes::Real val, bool add=false)
set x to value*"one" to x, or if add==true, add value*"one" to x
CH_Matrix_Classes::Matrix x
"primal" point x consisting of x0>0 and barx = x(1..n-1) of norm at most x0
Definition: SOCIPBlock.hxx:31
CH_Matrix_Classes::Matrix & apply_Arwinv(const CH_Matrix_Classes::Matrix &x, CH_Matrix_Classes::Matrix &v) const
apply Arwinv(x) = (1/gamma^2)*[ x0, -barx'; -barx', (barx*barx'+gamma^2*I)/x0] to vector v overwritin...
CH_Matrix_Classes::Matrix f
scaling vector with gamma(f)= sqrt(f0*f0 - barf'*barf)=1
Definition: SOCIPBlock.hxx:39
virtual int get_vecz(CH_Matrix_Classes::Matrix &vecz, CH_Matrix_Classes::Integer startindex)
return the vector form of z
Definition: SOCIPBlock.hxx:195
CH_Matrix_Classes::Matrix tmp_xdzpdxz
temporary vector to reduce reallocations
Definition: SOCIPBlock.hxx:54
virtual int add_AxizinvAt(const CH_Matrix_Classes::Matrix &A, CH_Matrix_Classes::Symmatrix &globalsys, bool minus=false, bool Atrans=false)
add the Schur complement to a big system matrix
CH_Matrix_Classes::Matrix scaled_point
== F(x) == Finv(z)
Definition: SOCIPBlock.hxx:40
virtual int vecgetsax(CH_Matrix_Classes::Matrix &vec, CH_Matrix_Classes::Integer startindex, CH_Matrix_Classes::Real a=1., bool add=false)
on vec[startindex+0,+1 ...,+(vecdim-1)] put or add a * x into vec for a real number a ...
virtual int get_vecdx(CH_Matrix_Classes::Matrix &vecdx, CH_Matrix_Classes::Integer startindex)
return the vector form of dx, 1 if not available
Definition: SOCIPBlock.hxx:199
virtual int do_step(CH_Matrix_Classes::Real alpha)
move to (x+alpha*dx, z+alpha*dz)
CH_Matrix_Classes::Real mu
in a step mu gets the value of last_rhs_mu
Definition: SOCIPBlock.hxx:44
CH_Matrix_Classes::Matrix compl_rhs
rhs used in solving the complementarity line
Definition: SOCIPBlock.hxx:41
CH_Matrix_Classes::Real last_alpha
last alpha used in do_step()
Definition: SOCIPBlock.hxx:47
virtual int apply_xizinv(CH_Matrix_Classes::Matrix &rhs, CH_Matrix_Classes::Integer startindex, bool minus=false)
compute sysinv*rhs into rhs, possibly with a negative sign
CH_Matrix_Classes::Matrix & apply_Fsqr(CH_Matrix_Classes::Matrix &v, bool minus=false) const
apply Fsqr(f)= omega^2*[2*f0-1, 2*f0*barf'; 2*f0*barf, I+2*barf*barf']; to v overwriting and returnin...
virtual int vecgetsaz(CH_Matrix_Classes::Matrix &vec, CH_Matrix_Classes::Integer startindex, CH_Matrix_Classes::Real a=1., bool add=false)
on vec[startindex+0,+1 ...,+(vecdim-1)] put or add a * z into vec for a real number a ...
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...
CH_Matrix_Classes::Matrix z
"dual" point z consisting of z0>0 and barz = z(1..n-1) of norm at most z0
Definition: SOCIPBlock.hxx:32
CH_Matrix_Classes::Matrix & apply_F(CH_Matrix_Classes::Matrix &v) const
apply F(f)= omega*[f0, barf'; barf, I+barf*barf'/(1+f0)] to v overwriting and returning it...