ConicBundle
NNCIPBlock.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_NNCIPBLOCK_HXX
4 #define CONICBUNDLE_NNCIPBLOCK_HXX
5 
13 #include "InteriorPointBlock.hxx"
14 
15 namespace ConicBundle {
16 
21 
26 class NNCIPBlock: public virtual InteriorPointBlock
27 {
28 protected:
34 
37 
41 
43 
46 
49 
51  void point_changed();
52 
54  inline int compute_NTscaling(void)
55  {
56  xiz.init(z);
57  xiz/=x;
58 
59  //TEST
60  // CH_Matrix_Classes::Matrix tmpvec(x);
61  // tmpvec.concat_right(z);
62  // tmpvec.concat_right(xiz);
63  // tmpvec.concat_right(inv(xiz));
64  // std::cout<<" NNCIP "; tmpvec.display(std::cout);
65 
66  return 0;
67  }
68 
69 public:
71  virtual void clear(CH_Matrix_Classes::Integer dim=0);
72 
74  NNCIPBlock(CH_Matrix_Classes::Integer dim=0, CBout* cb=0,int cbinc=-1);
75 
77  ~NNCIPBlock();
78 
80  virtual CH_Matrix_Classes::Integer get_vecdim() const;
81 
83  virtual int center_x(CH_Matrix_Classes::Real val,bool add=false);
84 
86  virtual int center_z(CH_Matrix_Classes::Real val,bool add=false);
87 
89  virtual int set_x(const CH_Matrix_Classes::Matrix& vec,CH_Matrix_Classes::Integer startindex,CH_Matrix_Classes::Real& add_center_value);
90 
92  virtual int set_z(const CH_Matrix_Classes::Matrix& vec,CH_Matrix_Classes::Integer startindex,CH_Matrix_Classes::Real& add_center_value);
93 
95  virtual int vecgetsax(CH_Matrix_Classes::Matrix& vec,
96  CH_Matrix_Classes::Integer startindex,
98  bool add=false);
99 
101  virtual int vecgetsaz(CH_Matrix_Classes::Matrix& vec,
102  CH_Matrix_Classes::Integer startindex,
104  bool add=false);
105 
107  virtual int get_mu_info(CH_Matrix_Classes::Integer& mudim,
109  CH_Matrix_Classes::Real& tr_xdzpdxz,
110  CH_Matrix_Classes::Real& tr_dxdz,
111  CH_Matrix_Classes::Real& min_xz,
112  CH_Matrix_Classes::Real& max_xz) const;
113 
115  virtual int get_nbh_info(CH_Matrix_Classes::Integer mudim,
117  CH_Matrix_Classes::Real tr_xdzpdxz,
118  CH_Matrix_Classes::Real tr_dxdz,
119  CH_Matrix_Classes::Real nbh_ubnd,
121  CH_Matrix_Classes::Real& max_nbh,
122  CH_Matrix_Classes::Real& nrmsqr_xz,
123  CH_Matrix_Classes::Real& nrmsqr_xdzpdxz,
124  CH_Matrix_Classes::Real& nrmsqr_dxdz,
125  CH_Matrix_Classes::Real& ip_xz_xdzpdxz,
126  CH_Matrix_Classes::Real& ip_xz_dxdz,
127  CH_Matrix_Classes::Real& ip_dxdz_xdzpdxz) const;
128 
130  virtual int linesearch(CH_Matrix_Classes::Real& alpha) const;
131 
133  virtual int add_muxinv(CH_Matrix_Classes::Matrix& rhs,
134  CH_Matrix_Classes::Integer startindex,
136  CH_Matrix_Classes::Real rhscorr,
137  bool minus=false);
138 
139 
141  virtual int set_dx(const CH_Matrix_Classes::Matrix& rhs,CH_Matrix_Classes::Integer startindex);
142 
145 
147  virtual int apply_xizinv(CH_Matrix_Classes::Matrix& rhs,
148  CH_Matrix_Classes::Integer startindex,
149  bool minus=false);
150 
152  virtual int apply_xiz(CH_Matrix_Classes::Matrix& rhs,
153  CH_Matrix_Classes::Integer startindex,
154  bool minus=false);
155 
157  virtual int do_step(CH_Matrix_Classes::Real alpha);
158 
160  virtual int add_AxizinvAt(const CH_Matrix_Classes::Matrix& A,
161  CH_Matrix_Classes::Symmatrix& globalsys,
162  bool minus=false,
163  bool Atrans=false);
164 
166  virtual int add_xiz(CH_Matrix_Classes::Symmatrix& globalsys,CH_Matrix_Classes::Integer startindex,bool minus=false);
167 
168 
169 
170  //---------------------- mainly for testing
171 
174  { CH_Matrix_Classes::mat_xey(vecdim,vecx.get_store()+startindex,x.get_store());return 0; }
175 
178  { CH_Matrix_Classes::mat_xey(vecdim,vecz.get_store()+startindex,z.get_store());return 0; }
179 
182  {
183  if (dx.dim()!=vecdim)
184  return 1;
185  CH_Matrix_Classes::mat_xey(vecdim,vecdx.get_store()+startindex,dx.get_store());
186  return 0;
187  }
188 
189 
192  {
193  if (dz.dim()!=vecdim)
194  return 1;
195  CH_Matrix_Classes::mat_xey(vecdim,vecdz.get_store()+startindex,dz.get_store());
196  return 0;
197  }
198 
199 };
200 
201 
203 
204 }
205 
206 #endif
207 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
virtual int get_vecz(CH_Matrix_Classes::Matrix &vecz, CH_Matrix_Classes::Integer startindex)
return the vector form of z
Definition: NNCIPBlock.hxx:177
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);
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
NNCIPBlock(CH_Matrix_Classes::Integer dim=0, CBout *cb=0, int cbinc=-1)
default constructor, also allows to initialize the dimension
CH_Matrix_Classes::Matrix tmpvec
temporary vector to reduce reallocations
Definition: NNCIPBlock.hxx:47
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
Header declaring the class ConicBundle::InteriorPointBlock.
CH_Matrix_Classes::Matrix x
"primal" point x
Definition: NNCIPBlock.hxx:30
CH_Matrix_Classes::Matrix compl_rhs
rhs used in solving the complementarity line
Definition: NNCIPBlock.hxx:36
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
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
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 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); ...
abstract interface for interior point vector/matrix variables and routines specific to primal dual co...
Definition: InteriorPointBlock.hxx:30
CH_Matrix_Classes::Real mu
in a step mu gets the value of last_rhs_mu
Definition: NNCIPBlock.hxx:39
virtual int do_step(CH_Matrix_Classes::Real alpha)
move to (x+alpha*dx, z+alpha*dz)
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
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 ...
CH_Matrix_Classes::Real last_rhs_mu
the last mu used in rhs computations
Definition: NNCIPBlock.hxx:38
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 xiz
z(i)/x(i)
Definition: NNCIPBlock.hxx:35
virtual int get_vecx(CH_Matrix_Classes::Matrix &vecx, CH_Matrix_Classes::Integer startindex)
return the vector form of x
Definition: NNCIPBlock.hxx:173
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...
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
CH_Matrix_Classes::Integer vecdim
the dimension of the cone
Definition: NNCIPBlock.hxx:29
CH_Matrix_Classes::Matrix z
"dual" point z
Definition: NNCIPBlock.hxx:31
CH_Matrix_Classes::Matrix dz
current step for z
Definition: NNCIPBlock.hxx:33
virtual CH_Matrix_Classes::Integer get_vecdim() const
returns the dimension of the cone
int compute_NTscaling(void)
here this just computes xiz=z/x in a separate routine in order to have uniform appearance in the othe...
Definition: NNCIPBlock.hxx:54
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 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 ...
CH_Matrix_Classes::Matrix oldx
point before x
Definition: NNCIPBlock.hxx:44
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 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...
void point_changed()
clear variables that are no longer valid for the current point
Matrix class for real values of type Real
Definition: matrix.hxx:74
CH_Matrix_Classes::Real old_mu
in a step old_mu gets the value of mu before this gets last_rhs_mu
Definition: NNCIPBlock.hxx:40
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
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 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 void clear(CH_Matrix_Classes::Integer dim=0)
reset all point information to zero for dimension dim, the rest to zero
interface for the interior point variable vector and routines specific to the primal dual complementa...
Definition: NNCIPBlock.hxx:26
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::Real last_alpha
last alpha used in do_step()
Definition: NNCIPBlock.hxx:42
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...
CH_Matrix_Classes::Matrix dx
current step for x
Definition: NNCIPBlock.hxx:32
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
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: NNCIPBlock.hxx:181
CH_Matrix_Classes::Matrix tmpmat
temporary matrix to reduce reallocatoins
Definition: NNCIPBlock.hxx:48
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
~NNCIPBlock()
destructor
CH_Matrix_Classes::Matrix oldz
point before z
Definition: NNCIPBlock.hxx:45
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: NNCIPBlock.hxx:191