ROOT  6.06/09
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 #ifndef ROOT_TError
47 #include "TError.h"
48 #endif
49 
50 #ifndef ROOT_TQpVar
51 #include "TQpVar.h"
52 #endif
53 #ifndef ROOT_TQpDataDens
54 #include "TQpDataDens.h"
55 #endif
56 
57 #ifndef ROOT_TMatrixD
58 #include "TMatrixD.h"
59 #endif
60 
61 ///////////////////////////////////////////////////////////////////////////
62 // //
63 // Class containing the residuals of a QP when solved by an interior //
64 // point QP solver. In terms of our abstract QP formulation, these //
65 // residuals are rQ, rA, rC and r3. //
66 // //
67 ///////////////////////////////////////////////////////////////////////////
68 
69 class TQpResidual : public TObject
70 {
71 
72 protected:
73  Double_t fResidualNorm; // The norm of the residuals, ommiting the complementariy conditions
74  Double_t fDualityGap; // A quantity that measures progress toward feasibility. In terms
75  // of the abstract problem formulation, this quantity is defined as
76  // x' * Q * x - b' * y + c' * x - d' * z
77 
81 
86 
87  // these variables will be "Used" not copied
92 
93  static void GondzioProjection(TVectorD &v,Double_t rmin,Double_t rmax);
94 
95 public:
108 
109  TQpResidual();
111  TVectorD &ixlow,TVectorD &ixupp,TVectorD &iclow,TVectorD &icupp);
112  TQpResidual(const TQpResidual &another);
113 
114  virtual ~TQpResidual() {}
115 
118 
119  void CalcResids (TQpDataBase *problem,TQpVar *vars);
120  // calculate residuals, their norms, and duality/
121  // complementarity gap, given a problem and variable set.
122  void Add_r3_xz_alpha (TQpVar *vars,Double_t alpha);
123  // Modify the "complementarity" component of the
124  // residuals, by adding the pairwise products of the
125  // complementary variables plus a constant alpha to this
126  // term.
127  void Set_r3_xz_alpha (TQpVar *vars,Double_t alpha);
128  // Set the "complementarity" component of the residuals
129  // to the pairwise products of the complementary variables
130  // plus a constant alpha
131  void Clear_r3 (); // set the complementarity component of the residuals
132  // to 0.
133  void Clear_r1r2 (); // set the noncomplementarity components of the residual
134  // (the terms arising from the linear equalities in the
135  // KKT conditions) to 0.
136  void Project_r3 (Double_t rmin,Double_t rmax);
137  // perform the projection operation required by Gondzio
138  // algorithm: replace each component r3_i of the
139  // complementarity component of the residuals by
140  // r3p_i-r3_i, where r3p_i is the projection of r3_i onto
141  // the box [rmin, rmax]. Then if the resulting value is
142  // less than -rmax, replace it by -rmax.
144 
145  TQpResidual &operator= (const TQpResidual &source);
146 
147  ClassDef(TQpResidual,1) // Qp Residual class
148 };
149 #endif
const int nx
Definition: kalman.C:16
TVectorD fRt
Definition: TQpResidual.h:102
void CalcResids(TQpDataBase *problem, TQpVar *vars)
Calculate residuals, their norms, and duality complementarity gap, given a problem and variable set...
TVectorD fRphi
Definition: TQpResidual.h:105
TVectorD fRgamma
Definition: TQpResidual.h:104
Bool_t ValidNonZeroPattern()
Check if vector elements as selected through array indices are non-zero.
virtual ~TQpResidual()
Definition: TQpResidual.h:114
TVectorD fRlambda
Definition: TQpResidual.h:106
TVectorD fRpi
Definition: TQpResidual.h:107
int Int_t
Definition: RtypesCore.h:41
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...
bool Bool_t
Definition: RtypesCore.h:59
TVectorD fXupIndex
Definition: TQpResidual.h:88
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, where r3p_i is the projection of r3_i onto the box [rmin, rmax].
Double_t fMclo
Definition: TQpResidual.h:85
#define ClassDef(name, id)
Definition: Rtypes.h:254
TVectorD fXloIndex
Definition: TQpResidual.h:89
Double_t fDualityGap
Definition: TQpResidual.h:74
TQpResidual & operator=(const TQpResidual &source)
Assignment operator.
TVectorD fRA
Definition: TQpResidual.h:97
Double_t GetResidualNorm()
Definition: TQpResidual.h:116
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...
TVectorD fCloIndex
Definition: TQpResidual.h:91
TVectorD fRz
Definition: TQpResidual.h:99
TVectorD fRv
Definition: TQpResidual.h:100
SVector< double, 2 > v
Definition: Dict.h:5
void Clear_r3()
set the complementarity component of the residuals to 0.
Double_t GetDualityGap()
Definition: TQpResidual.h:117
Double_t fMcup
Definition: TQpResidual.h:84
TVectorD fRu
Definition: TQpResidual.h:103
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...
double Double_t
Definition: RtypesCore.h:55
Double_t fNxup
Definition: TQpResidual.h:82
Double_t fNxlo
Definition: TQpResidual.h:83
void Clear_r1r2()
set the noncomplementarity components of the residual (the terms arising from the linear equalities i...
Mother of all ROOT objects.
Definition: TObject.h:58
Definition: TQpVar.h:65
TVectorD fCupIndex
Definition: TQpResidual.h:90
TVectorD fRQ
Definition: TQpResidual.h:96
Double_t fResidualNorm
Definition: TQpResidual.h:73
TVectorD fRC
Definition: TQpResidual.h:98
TVectorD fRw
Definition: TQpResidual.h:101