Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TQpSolverBase.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_TQpSolverBase
0044 #define ROOT_TQpSolverBase
0045 
0046 #include "TError.h"
0047 
0048 #include "TObject.h"
0049 #include "TQpVar.h"
0050 #include "TQpDataBase.h"
0051 #include "TQpResidual.h"
0052 #include "TQpProbBase.h"
0053 #include "TQpLinSolverBase.h"
0054 
0055 #include "TMatrixD.h"
0056 
0057 ///////////////////////////////////////////////////////////////////////////
0058 //                                                                       //
0059 // Abstract base class for QP solver using interior-point                //
0060 //                                                                       //
0061 ///////////////////////////////////////////////////////////////////////////
0062 
0063 enum ETerminationCode
0064 {
0065    kSUCCESSFUL_TERMINATION = 0,
0066    kNOT_FINISHED,
0067    kMAX_ITS_EXCEEDED,
0068    kINFEASIBLE,
0069    kUNKNOWN
0070 };
0071 
0072 class TQpSolverBase : public TObject
0073 {
0074 
0075 protected:
0076    TQpLinSolverBase *fSys;
0077 
0078    Double_t          fDnorm;                   // norm of problem data
0079 
0080    Double_t          fMutol;                   // termination parameters
0081    Double_t          fArtol;
0082 
0083    Double_t          fGamma_f;                 // parameters associated with the step length heuristic
0084    Double_t          fGamma_a;
0085    Double_t          fPhi;                     // merit function, defined as the sum of the complementarity gap
0086                                                // the residual norms, divided by (1+norm of problem data)
0087    Int_t             fMaxit;                   // maximum number of  iterations allowed
0088 
0089    Double_t         *fMu_history;              //[fMaxit] history of values of mu obtained on all iterations to date
0090    Double_t         *fRnorm_history;           //[fMaxit] history of values of residual norm obtained on all iterations to date
0091    Double_t         *fPhi_history;             //[fMaxit] history of values of phi obtained on all iterations to date
0092 
0093    Double_t         *fPhi_min_history;         //[fMaxit] the i-th entry of this array contains the minimum value of phi
0094                                                //          encountered by the algorithm on or before iteration i
0095 
0096 public:
0097    Int_t             fIter;                    // iteration counter
0098 
0099    TQpSolverBase();
0100    TQpSolverBase(const TQpSolverBase &another);
0101 
0102    ~TQpSolverBase() override;
0103 
0104    virtual void     Start       (TQpProbBase *formulation,
0105                                  TQpVar *iterate,TQpDataBase *prob,
0106                                  TQpResidual *resid,TQpVar *step);
0107                                                // starting point heuristic
0108    virtual void     DefStart    (TQpProbBase *formulation,
0109                                  TQpVar *iterate,TQpDataBase *prob,
0110                                  TQpResidual *resid,TQpVar *step);
0111                                                // default starting point heuristic
0112    virtual void     SteveStart  (TQpProbBase *formulation,
0113                                  TQpVar *iterate,TQpDataBase *prob,
0114                                  TQpResidual *resid,TQpVar *step);
0115                                                // alternative starting point heuristic
0116    virtual void     DumbStart   (TQpProbBase *formulation,
0117                                  TQpVar *iterate,TQpDataBase *prob,
0118                                  TQpResidual *resid,TQpVar *step);
0119                                                // alternative starting point heuristic: sets the
0120                                                // "complementary" variables to a large positive value
0121                                                 // (based on the norm of the problem data) and the
0122                                                // remaining variables to zero
0123 
0124    virtual Int_t    Solve       (TQpDataBase *prob,TQpVar *iterate,
0125                                  TQpResidual *resids) = 0;
0126                                                // implements the interior-point method for solving the QP
0127 
0128    virtual Double_t FinalStepLength
0129                                 (TQpVar *iterate,TQpVar *step);
0130                                                // Mehrotra's heuristic to calculate the final step
0131 
0132    virtual void     DoMonitor   (TQpDataBase *data,TQpVar *vars,
0133                                  TQpResidual *resids,Double_t alpha,
0134                                  Double_t sigma,Int_t i,Double_t mu,
0135                                  Int_t stop_code,Int_t level);
0136                                                // perform monitor operation at each interior-point iteration
0137    virtual void     DefMonitor  (TQpDataBase *data,TQpVar *vars,
0138                                  TQpResidual *resids,Double_t alpha,
0139                                  Double_t sigma,Int_t i,Double_t mu,
0140                                  Int_t stop_code,Int_t level) = 0;
0141                                                // default monitor: prints out one line of information
0142                                                // on each interior-point iteration
0143    virtual Int_t    DoStatus    (TQpDataBase *data,TQpVar *vars,
0144                                  TQpResidual *resids,Int_t i,Double_t mu,
0145                                  Int_t level);
0146                                                // this method called to test for convergence status at
0147                                                // at the end of each interior-point iteration
0148    virtual Int_t    DefStatus   (TQpDataBase *data,TQpVar *vars,
0149                                  TQpResidual *resids,Int_t i,Double_t mu,
0150                                  Int_t level);
0151                                                // default method for checking status. May be replaced
0152                                                // by a user-defined method
0153 
0154    TQpLinSolverBase *GetLinearSystem()            { return fSys; }
0155    void              SetMuTol       (Double_t m)  { fMutol = m; }
0156    Double_t          GetMuTol       ()            { return fMutol; }
0157 
0158    void              SetArTol       (Double_t ar) { fArtol = ar; }
0159    Double_t          GetArTol       ()            { return fArtol; }
0160    Double_t          DataNorm       ()            { return fDnorm; }
0161 
0162    TQpSolverBase &operator= (const TQpSolverBase &source);
0163 
0164    ClassDefOverride(TQpSolverBase,1)                   // Qp Solver class
0165 };
0166 #endif