Logo ROOT   6.10/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 #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 
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:
100 
101  TQpResidual();
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
const int nx
Definition: kalman.C:16
TVectorD fRt
Definition: TQpResidual.h:94
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:97
TVectorD fRgamma
Definition: TQpResidual.h:96
Bool_t ValidNonZeroPattern()
Check if vector elements as selected through array indices are non-zero.
virtual ~TQpResidual()
Definition: TQpResidual.h:106
TVectorD fRlambda
Definition: TQpResidual.h:98
TVectorD fRpi
Definition: TQpResidual.h:99
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:80
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:77
#define ClassDef(name, id)
Definition: Rtypes.h:297
TVectorD fXloIndex
Definition: TQpResidual.h:81
Double_t fDualityGap
Definition: TQpResidual.h:66
TQpResidual & operator=(const TQpResidual &source)
Assignment operator.
TVectorD fRA
Definition: TQpResidual.h:89
Double_t GetResidualNorm()
Definition: TQpResidual.h:108
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:83
TVectorD fRz
Definition: TQpResidual.h:91
TVectorD fRv
Definition: TQpResidual.h:92
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:109
Double_t fMcup
Definition: TQpResidual.h:76
TVectorD fRu
Definition: TQpResidual.h:95
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:74
Double_t fNxlo
Definition: TQpResidual.h:75
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:37
TQpResidual()
Constructor.
Definition: TQpResidual.cxx:65
Definition: TQpVar.h:59
TVectorD fCupIndex
Definition: TQpResidual.h:82
TVectorD fRQ
Definition: TQpResidual.h:88
Double_t fResidualNorm
Definition: TQpResidual.h:65
TVectorD fRC
Definition: TQpResidual.h:90
TVectorD fRw
Definition: TQpResidual.h:93