TQpResidual.h

Go to the documentation of this file.
00001 // @(#)root/quadp:$Id: TQpResidual.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Eddy Offermann   May 2004
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 /*************************************************************************
00013  * Parts of this file are copied from the OOQP distribution and          *
00014  * are subject to the following license:                                 *
00015  *                                                                       *
00016  * COPYRIGHT 2001 UNIVERSITY OF CHICAGO                                  *
00017  *                                                                       *
00018  * The copyright holder hereby grants you royalty-free rights to use,    *
00019  * reproduce, prepare derivative works, and to redistribute this software*
00020  * to others, provided that any changes are clearly documented. This     *
00021  * software was authored by:                                             *
00022  *                                                                       *
00023  *   E. MICHAEL GERTZ      gertz@mcs.anl.gov                             *
00024  *   Mathematics and Computer Science Division                           *
00025  *   Argonne National Laboratory                                         *
00026  *   9700 S. Cass Avenue                                                 *
00027  *   Argonne, IL 60439-4844                                              *
00028  *                                                                       *
00029  *   STEPHEN J. WRIGHT     swright@cs.wisc.edu                           *
00030  *   Computer Sciences Department                                        *
00031  *   University of Wisconsin                                             *
00032  *   1210 West Dayton Street                                             *
00033  *   Madison, WI 53706   FAX: (608)262-9777                              *
00034  *                                                                       *
00035  * Any questions or comments may be directed to one of the authors.      *
00036  *                                                                       *
00037  * ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES OF   *
00038  * ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT, AND     *
00039  * OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A CONTRACT   *
00040  * WITH THE DEPARTMENT OF ENERGY.                                        *
00041  *************************************************************************/
00042 
00043 #ifndef ROOT_TQpResidual
00044 #define ROOT_TQpResidual
00045 
00046 #ifndef ROOT_TError
00047 #include "TError.h"
00048 #endif
00049 
00050 #ifndef ROOT_TQpVar
00051 #include "TQpVar.h"
00052 #endif
00053 #ifndef ROOT_TQpDataDens
00054 #include "TQpDataDens.h"
00055 #endif
00056 
00057 #ifndef ROOT_TMatrixD
00058 #include "TMatrixD.h"
00059 #endif
00060 
00061 ///////////////////////////////////////////////////////////////////////////
00062 //                                                                       //
00063 // Class containing the residuals of a QP when solved by an interior     //
00064 // point QP solver. In terms of our abstract QP formulation, these       //
00065 // residuals are rQ, rA, rC and r3.                                      //
00066 //                                                                       //
00067 ///////////////////////////////////////////////////////////////////////////
00068 
00069 class TQpResidual : public TObject
00070 {
00071 
00072 protected:
00073    Double_t fResidualNorm;                     // The norm of the residuals, ommiting the complementariy conditions
00074    Double_t fDualityGap;                       // A quantity that measures progress toward feasibility. In terms
00075                                                //  of the abstract problem formulation, this quantity is defined as
00076                                                //   x' * Q * x - b' * y + c' * x - d' * z
00077 
00078    Int_t    fNx;
00079    Int_t    fMy;
00080    Int_t    fMz;
00081 
00082    Double_t fNxup;
00083    Double_t fNxlo;
00084    Double_t fMcup;
00085    Double_t fMclo;
00086 
00087    // these variables will be "Used" not copied
00088    TVectorD fXupIndex;
00089    TVectorD fXloIndex;
00090    TVectorD fCupIndex;
00091    TVectorD fCloIndex;
00092 
00093    static void GondzioProjection(TVectorD &v,Double_t rmin,Double_t rmax);
00094 
00095 public:
00096    TVectorD fRQ;
00097    TVectorD fRA;
00098    TVectorD fRC;
00099    TVectorD fRz;
00100    TVectorD fRv;
00101    TVectorD fRw;
00102    TVectorD fRt;
00103    TVectorD fRu;
00104    TVectorD fRgamma;
00105    TVectorD fRphi;
00106    TVectorD fRlambda;
00107    TVectorD fRpi;
00108 
00109    TQpResidual();
00110    TQpResidual(Int_t nx,Int_t my,Int_t mz,
00111                TVectorD &ixlow,TVectorD &ixupp,TVectorD &iclow,TVectorD &icupp);
00112    TQpResidual(const TQpResidual &another);
00113 
00114    virtual ~TQpResidual() {}
00115 
00116    Double_t GetResidualNorm() { return fResidualNorm; }
00117    Double_t GetDualityGap  () { return fDualityGap; };
00118 
00119    void   CalcResids         (TQpDataBase *problem,TQpVar *vars);
00120                                                // calculate residuals, their norms, and duality/
00121                                                // complementarity gap, given a problem and variable set.
00122    void   Add_r3_xz_alpha    (TQpVar *vars,Double_t alpha);
00123                                                // Modify the "complementarity" component of the
00124                                                // residuals, by adding the pairwise products of the
00125                                                // complementary variables plus a constant alpha to this
00126                                                // term.
00127    void   Set_r3_xz_alpha    (TQpVar *vars,Double_t alpha);
00128                                                // Set the "complementarity" component of the residuals
00129                                                // to the pairwise products of the complementary variables
00130                                                // plus a constant alpha
00131    void   Clear_r3           ();               // set the complementarity component of the residuals
00132                                                // to 0.
00133    void   Clear_r1r2         ();               // set the noncomplementarity components of the residual
00134                                                // (the terms arising from the linear equalities in the
00135                                                // KKT conditions) to 0.
00136    void   Project_r3         (Double_t rmin,Double_t rmax);
00137                                                // perform the projection operation required by Gondzio
00138                                                // algorithm: replace each component r3_i of the
00139                                                // complementarity component of the residuals by
00140                                                // r3p_i-r3_i, where r3p_i is the projection of r3_i onto
00141                                                // the box [rmin, rmax]. Then if the resulting value is
00142                                                // less than -rmax, replace it by -rmax.
00143    Bool_t ValidNonZeroPattern();
00144 
00145    TQpResidual &operator= (const TQpResidual &source);
00146 
00147    ClassDef(TQpResidual,1)                     // Qp Residual class
00148 };
00149 #endif

Generated on Tue Jul 5 14:28:05 2011 for ROOT_528-00b_version by  doxygen 1.5.1