Logo ROOT  
Reference Guide
TQpResidual.h
Go to the documentation of this file.
1 // @(#)root/quadp:$Id$
2 // Author: Eddy Offermann May 2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /*************************************************************************
13  * Parts of this file are copied from the OOQP distribution and *
14  * are subject to the following license: *
15  * *
16  * COPYRIGHT 2001 UNIVERSITY OF CHICAGO *
17  * *
18  * The copyright holder hereby grants you royalty-free rights to use, *
19  * reproduce, prepare derivative works, and to redistribute this software*
20  * to others, provided that any changes are clearly documented. This *
21  * software was authored by: *
22  * *
23  * E. MICHAEL GERTZ gertz@mcs.anl.gov *
24  * Mathematics and Computer Science Division *
25  * Argonne National Laboratory *
26  * 9700 S. Cass Avenue *
27  * Argonne, IL 60439-4844 *
28  * *
29  * STEPHEN J. WRIGHT swright@cs.wisc.edu *
30  * Computer Sciences Department *
31  * University of Wisconsin *
32  * 1210 West Dayton Street *
33  * Madison, WI 53706 FAX: (608)262-9777 *
34  * *
35  * Any questions or comments may be directed to one of the authors. *
36  * *
37  * ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES OF *
38  * ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT, AND *
39  * OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A CONTRACT *
40  * WITH THE DEPARTMENT OF ENERGY. *
41  *************************************************************************/
42 
43 #ifndef ROOT_TQpResidual
44 #define ROOT_TQpResidual
45 
46 #include "TError.h"
47 
48 #include "TQpVar.h"
49 #include "TQpDataDens.h"
50 
51 #include "TMatrixD.h"
52 
53 ///////////////////////////////////////////////////////////////////////////
54 // //
55 // Class containing the residuals of a QP when solved by an interior //
56 // point QP solver. In terms of our abstract QP formulation, these //
57 // residuals are rQ, rA, rC and r3. //
58 // //
59 ///////////////////////////////////////////////////////////////////////////
60 
61 class TQpResidual : public TObject
62 {
63 
64 protected:
65  Double_t fResidualNorm; // The norm of the residuals, ommiting the complementariy conditions
66  Double_t fDualityGap; // A quantity that measures progress toward feasibility. In terms
67  // of the abstract problem formulation, this quantity is defined as
68  // x' * Q * x - b' * y + c' * x - d' * z
69 
70  Int_t fNx;
71  Int_t fMy;
72  Int_t fMz;
73 
78 
79  // these variables will be "Used" not copied
84 
85  static void GondzioProjection(TVectorD &v,Double_t rmin,Double_t rmax);
86 
87 public:
88  TVectorD fRQ;
89  TVectorD fRA;
90  TVectorD fRC;
91  TVectorD fRz;
92  TVectorD fRv;
93  TVectorD fRw;
94  TVectorD fRt;
95  TVectorD fRu;
99  TVectorD fRpi;
100 
102  TQpResidual(Int_t nx,Int_t my,Int_t mz,
103  TVectorD &ixlow,TVectorD &ixupp,TVectorD &iclow,TVectorD &icupp);
104  TQpResidual(const TQpResidual &another);
105 
106  virtual ~TQpResidual() {}
107 
110 
111  void CalcResids (TQpDataBase *problem,TQpVar *vars);
112  // calculate residuals, their norms, and duality/
113  // complementarity gap, given a problem and variable set.
114  void Add_r3_xz_alpha (TQpVar *vars,Double_t alpha);
115  // Modify the "complementarity" component of the
116  // residuals, by adding the pairwise products of the
117  // complementary variables plus a constant alpha to this
118  // term.
119  void Set_r3_xz_alpha (TQpVar *vars,Double_t alpha);
120  // Set the "complementarity" component of the residuals
121  // to the pairwise products of the complementary variables
122  // plus a constant alpha
123  void Clear_r3 (); // set the complementarity component of the residuals
124  // to 0.
125  void Clear_r1r2 (); // set the noncomplementarity components of the residual
126  // (the terms arising from the linear equalities in the
127  // KKT conditions) to 0.
128  void Project_r3 (Double_t rmin,Double_t rmax);
129  // perform the projection operation required by Gondzio
130  // algorithm: replace each component r3_i of the
131  // complementarity component of the residuals by
132  // r3p_i-r3_i, where r3p_i is the projection of r3_i onto
133  // the box [rmin, rmax]. Then if the resulting value is
134  // less than -rmax, replace it by -rmax.
136 
137  TQpResidual &operator= (const TQpResidual &source);
138 
139  ClassDef(TQpResidual,1) // Qp Residual class
140 };
141 #endif
TQpResidual::fRC
TVectorD fRC
Definition: TQpResidual.h:125
TQpResidual::fRpi
TVectorD fRpi
Definition: TQpResidual.h:134
TQpResidual::fRt
TVectorD fRt
Definition: TQpResidual.h:129
TQpResidual::GondzioProjection
static void GondzioProjection(TVectorD &v, Double_t rmin, Double_t rmax)
Replace each component r3_i of the complementarity component of the residuals by r3p_i-r3_i,...
Definition: TQpResidual.cxx:357
TQpResidual::fResidualNorm
Double_t fResidualNorm
Definition: TQpResidual.h:100
TQpResidual::~TQpResidual
virtual ~TQpResidual()
Definition: TQpResidual.h:141
TQpResidual::fMclo
Double_t fMclo
Definition: TQpResidual.h:112
TQpResidual::fDualityGap
Double_t fDualityGap
Definition: TQpResidual.h:101
TQpResidual::fRgamma
TVectorD fRgamma
Definition: TQpResidual.h:131
TQpResidual::Project_r3
void Project_r3(Double_t rmin, Double_t rmax)
Perform the projection operation required by Gondzio algorithm: replace each component r3_i of the co...
Definition: TQpResidual.cxx:299
TQpResidual::fXupIndex
TVectorD fXupIndex
Definition: TQpResidual.h:115
TQpDataBase
Definition: TQpDataBase.h:60
TQpResidual::fRlambda
TVectorD fRlambda
Definition: TQpResidual.h:133
v
@ v
Definition: rootcling_impl.cxx:3635
TQpResidual::fMy
Int_t fMy
Definition: TQpResidual.h:106
TQpResidual::fRv
TVectorD fRv
Definition: TQpResidual.h:127
bool
TQpResidual::fMz
Int_t fMz
Definition: TQpResidual.h:107
TQpResidual::operator=
TQpResidual & operator=(const TQpResidual &source)
Assignment operator.
Definition: TQpResidual.cxx:378
TQpResidual::fRz
TVectorD fRz
Definition: TQpResidual.h:126
TQpResidual::fCloIndex
TVectorD fCloIndex
Definition: TQpResidual.h:118
TQpResidual::fRA
TVectorD fRA
Definition: TQpResidual.h:124
TQpResidual::fXloIndex
TVectorD fXloIndex
Definition: TQpResidual.h:116
TQpResidual::Clear_r3
void Clear_r3()
set the complementarity component of the residuals to 0.
Definition: TQpResidual.cxx:267
TQpResidual::fNx
Int_t fNx
Definition: TQpResidual.h:105
TQpResidual::GetDualityGap
Double_t GetDualityGap()
Definition: TQpResidual.h:144
TQpResidual
Definition: TQpResidual.h:61
TQpResidual::GetResidualNorm
Double_t GetResidualNorm()
Definition: TQpResidual.h:143
TQpResidual::Add_r3_xz_alpha
void Add_r3_xz_alpha(TQpVar *vars, Double_t alpha)
Modify the "complementarity" component of the residuals, by adding the pairwise products of the compl...
Definition: TQpResidual.cxx:237
TQpVar
Definition: TQpVar.h:59
TQpResidual::fMcup
Double_t fMcup
Definition: TQpResidual.h:111
TVectorT
Definition: TMatrixTBase.h:78
TQpResidual::fRu
TVectorD fRu
Definition: TQpResidual.h:130
Double_t
double Double_t
Definition: RtypesCore.h:59
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TQpResidual::Clear_r1r2
void Clear_r1r2()
set the noncomplementarity components of the residual (the terms arising from the linear equalities i...
Definition: TQpResidual.cxx:280
TQpResidual::fRw
TVectorD fRw
Definition: TQpResidual.h:128
TQpResidual::Set_r3_xz_alpha
void Set_r3_xz_alpha(TQpVar *vars, Double_t alpha)
Set the "complementarity" component of the residuals to the pairwise products of the complementary va...
Definition: TQpResidual.cxx:257
TQpResidual::fCupIndex
TVectorD fCupIndex
Definition: TQpResidual.h:117
TQpResidual::fRQ
TVectorD fRQ
Definition: TQpResidual.h:123
TQpResidual::fNxup
Double_t fNxup
Definition: TQpResidual.h:109
TMatrixD.h
TQpResidual::fNxlo
Double_t fNxlo
Definition: TQpResidual.h:110
TQpResidual::CalcResids
void CalcResids(TQpDataBase *problem, TQpVar *vars)
Calculate residuals, their norms, and duality complementarity gap, given a problem and variable set.
Definition: TQpResidual.cxx:137
TQpVar.h
TQpResidual::fRphi
TVectorD fRphi
Definition: TQpResidual.h:132
TQpResidual::TQpResidual
TQpResidual()
Constructor.
Definition: TQpResidual.cxx:63
TQpDataDens.h
int
TError.h
TQpResidual::ValidNonZeroPattern
Bool_t ValidNonZeroPattern()
Check if vector elements as selected through array indices are non-zero.
Definition: TQpResidual.cxx:323