Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TQpResidual.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/quadp:$Id$
0002 // Author: Eddy Offermann   May 2004
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 /*************************************************************************
0013  * Parts of this file are copied from the OOQP distribution and          *
0014  * are subject to the following license:                                 *
0015  *                                                                       *
0016  * COPYRIGHT 2001 UNIVERSITY OF CHICAGO                                  *
0017  *                                                                       *
0018  * The copyright holder hereby grants you royalty-free rights to use,    *
0019  * reproduce, prepare derivative works, and to redistribute this software*
0020  * to others, provided that any changes are clearly documented. This     *
0021  * software was authored by:                                             *
0022  *                                                                       *
0023  *   E. MICHAEL GERTZ      gertz@mcs.anl.gov                             *
0024  *   Mathematics and Computer Science Division                           *
0025  *   Argonne National Laboratory                                         *
0026  *   9700 S. Cass Avenue                                                 *
0027  *   Argonne, IL 60439-4844                                              *
0028  *                                                                       *
0029  *   STEPHEN J. WRIGHT     swright@cs.wisc.edu                           *
0030  *   Computer Sciences Department                                        *
0031  *   University of Wisconsin                                             *
0032  *   1210 West Dayton Street                                             *
0033  *   Madison, WI 53706   FAX: (608)262-9777                              *
0034  *                                                                       *
0035  * Any questions or comments may be directed to one of the authors.      *
0036  *                                                                       *
0037  * ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES OF   *
0038  * ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT, AND     *
0039  * OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A CONTRACT   *
0040  * WITH THE DEPARTMENT OF ENERGY.                                        *
0041  *************************************************************************/
0042 
0043 #ifndef ROOT_TQpResidual
0044 #define ROOT_TQpResidual
0045 
0046 #include "TError.h"
0047 
0048 #include "TQpVar.h"
0049 #include "TQpDataDens.h"
0050 
0051 #include "TMatrixD.h"
0052 
0053 ///////////////////////////////////////////////////////////////////////////
0054 //                                                                       //
0055 // Class containing the residuals of a QP when solved by an interior     //
0056 // point QP solver. In terms of our abstract QP formulation, these       //
0057 // residuals are rQ, rA, rC and r3.                                      //
0058 //                                                                       //
0059 ///////////////////////////////////////////////////////////////////////////
0060 
0061 class TQpResidual : public TObject
0062 {
0063 
0064 protected:
0065    Double_t fResidualNorm;                     // The norm of the residuals, omitting the complementariy conditions
0066    Double_t fDualityGap;                       // A quantity that measures progress toward feasibility. In terms
0067                                                //  of the abstract problem formulation, this quantity is defined as
0068                                                //   x' * Q * x - b' * y + c' * x - d' * z
0069 
0070    Int_t    fNx;
0071    Int_t    fMy;
0072    Int_t    fMz;
0073 
0074    Double_t fNxup;
0075    Double_t fNxlo;
0076    Double_t fMcup;
0077    Double_t fMclo;
0078 
0079    // these variables will be "Used" not copied
0080    TVectorD fXupIndex;
0081    TVectorD fXloIndex;
0082    TVectorD fCupIndex;
0083    TVectorD fCloIndex;
0084 
0085    static void GondzioProjection(TVectorD &v,Double_t rmin,Double_t rmax);
0086 
0087 public:
0088    TVectorD fRQ;
0089    TVectorD fRA;
0090    TVectorD fRC;
0091    TVectorD fRz;
0092    TVectorD fRv;
0093    TVectorD fRw;
0094    TVectorD fRt;
0095    TVectorD fRu;
0096    TVectorD fRgamma;
0097    TVectorD fRphi;
0098    TVectorD fRlambda;
0099    TVectorD fRpi;
0100 
0101    TQpResidual();
0102    TQpResidual(Int_t nx,Int_t my,Int_t mz,
0103                TVectorD &ixlow,TVectorD &ixupp,TVectorD &iclow,TVectorD &icupp);
0104    TQpResidual(const TQpResidual &another);
0105 
0106    ~TQpResidual() override {}
0107 
0108    Double_t GetResidualNorm() { return fResidualNorm; }
0109    Double_t GetDualityGap  () { return fDualityGap; };
0110 
0111    void   CalcResids         (TQpDataBase *problem,TQpVar *vars);
0112                                                // calculate residuals, their norms, and duality/
0113                                                // complementarity gap, given a problem and variable set.
0114    void   Add_r3_xz_alpha    (TQpVar *vars,Double_t alpha);
0115                                                // Modify the "complementarity" component of the
0116                                                // residuals, by adding the pairwise products of the
0117                                                // complementary variables plus a constant alpha to this
0118                                                // term.
0119    void   Set_r3_xz_alpha    (TQpVar *vars,Double_t alpha);
0120                                                // Set the "complementarity" component of the residuals
0121                                                // to the pairwise products of the complementary variables
0122                                                // plus a constant alpha
0123    void   Clear_r3           ();               // set the complementarity component of the residuals
0124                                                // to 0.
0125    void   Clear_r1r2         ();               // set the noncomplementarity components of the residual
0126                                                // (the terms arising from the linear equalities in the
0127                                                // KKT conditions) to 0.
0128    void   Project_r3         (Double_t rmin,Double_t rmax);
0129                                                // perform the projection operation required by Gondzio
0130                                                // algorithm: replace each component r3_i of the
0131                                                // complementarity component of the residuals by
0132                                                // r3p_i-r3_i, where r3p_i is the projection of r3_i onto
0133                                                // the box [rmin, rmax]. Then if the resulting value is
0134                                                // less than -rmax, replace it by -rmax.
0135    Bool_t ValidNonZeroPattern();
0136 
0137    TQpResidual &operator= (const TQpResidual &source);
0138 
0139    ClassDefOverride(TQpResidual,1)                     // Qp Residual class
0140 };
0141 #endif