Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:21

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_TQpLinSolverBase
0044 #define ROOT_TQpLinSolverBase
0045 
0046 #include "TError.h"
0047 
0048 #include "TQpVar.h"
0049 #include "TQpDataBase.h"
0050 #include "TQpResidual.h"
0051 #include "TQpProbBase.h"
0052 
0053 #include "TMatrixD.h"
0054 
0055 ///////////////////////////////////////////////////////////////////////////
0056 //                                                                       //
0057 // Implements the main solver for linear systems that arise in           //
0058 // primal-dual interior-point methods for QP . This class  contains      //
0059 // definitions of methods and data common to the sparse and dense        //
0060 // special cases of the general formulation. The derived classes contain //
0061 // the aspects that are specific to the sparse and dense forms.          //
0062 //                                                                       //
0063 ///////////////////////////////////////////////////////////////////////////
0064 
0065 class TQpProbBase;
0066 class TQpLinSolverBase : public TObject
0067 {
0068 
0069 protected:
0070 
0071    TVectorD     fNomegaInv;                    // stores a critical diagonal matrix as a vector
0072    TVectorD     fRhs;                          // right-hand side of the system
0073 
0074    Int_t        fNx;                           // dimensions of the vectors in the general QP formulation
0075    Int_t        fMy;
0076    Int_t        fMz;
0077 
0078    TVectorD     fDd;                           // temporary storage vectors
0079    TVectorD     fDq;
0080 
0081    TVectorD     fXupIndex;                     // index matrices for the upper and lower bounds on x and Cx
0082    TVectorD     fCupIndex;
0083    TVectorD     fXloIndex;
0084    TVectorD     fCloIndex;
0085 
0086    Int_t        fNxup;                         // dimensions of the upper and lower bound vectors
0087    Int_t        fNxlo;
0088    Int_t        fMcup;
0089    Int_t        fMclo;
0090 
0091    TQpProbBase *fFactory;
0092 
0093 public:
0094    TQpLinSolverBase();
0095    TQpLinSolverBase(TQpProbBase *factory,TQpDataBase *data);
0096    TQpLinSolverBase(const TQpLinSolverBase &another);
0097 
0098    ~TQpLinSolverBase() override {}
0099 
0100    virtual void Factor          (TQpDataBase *prob,TQpVar *vars);
0101                                                // sets up the matrix for the main linear system in
0102                                                // "augmented system" form. The actual factorization is
0103                                                // performed by a routine specific to either the sparse
0104                                                // or dense case
0105    virtual void Solve           (TQpDataBase *prob,TQpVar *vars,TQpResidual *resids,TQpVar *step);
0106                                                // solves the system for a given set of residuals.
0107                                                // Assembles the right-hand side appropriate to the
0108                                                // matrix factored in factor, solves the system using
0109                                                // the factorization produced there, partitions the
0110                                                // solution vector into step components, then recovers
0111                                                // the step components eliminated during the block
0112                                                // elimination that produced the augmented system form
0113    virtual void JoinRHS         (TVectorD &rhs, TVectorD &rhs1,TVectorD &rhs2,TVectorD &rhs3);
0114                                                // assembles a single vector object from three given vectors
0115                                                //  rhs (output) final joined vector
0116                                                //  rhs1 (input) first part of rhs
0117                                                //  rhs2 (input) middle part of rhs
0118                                                //  rhs3 (input) last part of rhs
0119    virtual void SeparateVars    (TVectorD &vars1,TVectorD &vars2,TVectorD &vars3,TVectorD &vars);
0120                                                // extracts three component vectors from a given aggregated
0121                                                // vector.
0122                                                //  vars (input) aggregated vector
0123                                                //  vars1 (output) first part of vars
0124                                                //  vars2 (output) middle part of vars
0125                                                //  vars3 (output) last part of vars
0126 
0127    virtual void SolveXYZS       (TVectorD &stepx,TVectorD &stepy,TVectorD &stepz,TVectorD &steps,
0128                                  TVectorD &ztemp,TQpDataBase *data);
0129                                                // assemble right-hand side of augmented system and call
0130                                                // SolveCompressed to solve it
0131 
0132    virtual void SolveCompressed (TVectorD &rhs) = 0;
0133                                                // perform the actual solve using the factors produced in
0134                                                // factor.
0135                                                //  rhs on input contains the aggregated right-hand side of
0136                                                //  the augmented system; on output contains the solution in
0137                                                //  aggregated form
0138 
0139    virtual void PutXDiagonal    (TVectorD &xdiag) = 0;
0140                                                // places the diagonal resulting from the bounds on x into
0141                                                // the augmented system matrix
0142    virtual void PutZDiagonal    (TVectorD& zdiag) = 0;
0143                                                // places the diagonal resulting from the bounds on Cx into
0144                                                // the augmented system matrix
0145    virtual void ComputeDiagonals(TVectorD &dd,TVectorD &omega,TVectorD &t, TVectorD &lambda,
0146                                  TVectorD &u, TVectorD &pi,TVectorD &v, TVectorD &gamma,
0147                                  TVectorD &w, TVectorD &phi);
0148                                                // computes the diagonal matrices in the augmented system
0149                                                // from the current set of variables
0150 
0151    TQpLinSolverBase &operator= (const TQpLinSolverBase &source);
0152 
0153    ClassDefOverride(TQpLinSolverBase,1)                // Qp linear solver base class
0154 };
0155 #endif