TQpSolverBase.h

Go to the documentation of this file.
00001 // @(#)root/quadp:$Id: TQpSolverBase.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_TQpSolverBase
00044 #define ROOT_TQpSolverBase
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_TQpDataBase
00054 #include "TQpDataBase.h"
00055 #endif
00056 #ifndef ROOT_TQpResidual
00057 #include "TQpResidual.h"
00058 #endif
00059 #ifndef ROOT_TQpProbBase
00060 #include "TQpProbBase.h"
00061 #endif
00062 #ifndef ROOT_TQpLinSolverBase
00063 #include "TQpLinSolverBase.h"
00064 #endif
00065 
00066 #ifndef ROOT_TMatrixD
00067 #include "TMatrixD.h"
00068 #endif
00069 
00070 ///////////////////////////////////////////////////////////////////////////
00071 //                                                                       //
00072 // Abstract base class for QP solver using interior-point                //
00073 //                                                                       //
00074 ///////////////////////////////////////////////////////////////////////////
00075 
00076 enum ETerminationCode
00077 {
00078    kSUCCESSFUL_TERMINATION = 0,
00079    kNOT_FINISHED,
00080    kMAX_ITS_EXCEEDED,
00081    kINFEASIBLE,
00082    kUNKNOWN
00083 };
00084 
00085 class TQpSolverBase : public TObject
00086 {
00087 
00088 protected:
00089    TQpLinSolverBase *fSys;
00090 
00091    Double_t          fDnorm;                   // norm of problem data
00092 
00093    Double_t          fMutol;                   // termination parameters
00094    Double_t          fArtol;
00095 
00096    Double_t          fGamma_f;                 // parameters associated with the step length heuristic
00097    Double_t          fGamma_a;
00098    Double_t          fPhi;                     // merit function, defined as the sum of the complementarity gap
00099                                                // the residual norms, divided by (1+norm of problem data)
00100    Int_t             fMaxit;                   // maximum number of  iterations allowed
00101 
00102    Double_t         *fMu_history;              //[fMaxit] history of values of mu obtained on all iterations to date
00103    Double_t         *fRnorm_history;           //[fMaxit] history of values of residual norm obtained on all iterations to date
00104    Double_t         *fPhi_history;             //[fMaxit] history of values of phi obtained on all iterations to date
00105 
00106    Double_t         *fPhi_min_history;         //[fMaxit] the i-th entry of this array contains the minimum value of phi
00107                                                //          encountered by the algorithm on or before iteration i
00108 
00109 public:
00110    Int_t             fIter;                    // iteration counter
00111 
00112    TQpSolverBase();
00113    TQpSolverBase(const TQpSolverBase &another);
00114 
00115    virtual ~TQpSolverBase();
00116 
00117    virtual void     Start       (TQpProbBase *formulation,
00118                                  TQpVar *iterate,TQpDataBase *prob,
00119                                  TQpResidual *resid,TQpVar *step);
00120                                                // starting point heuristic
00121    virtual void     DefStart    (TQpProbBase *formulation,
00122                                  TQpVar *iterate,TQpDataBase *prob,
00123                                  TQpResidual *resid,TQpVar *step);
00124                                                // default starting point heuristic
00125    virtual void     SteveStart  (TQpProbBase *formulation,
00126                                  TQpVar *iterate,TQpDataBase *prob,
00127                                  TQpResidual *resid,TQpVar *step);
00128                                                // alternative starting point heuristic
00129    virtual void     DumbStart   (TQpProbBase *formulation,
00130                                  TQpVar *iterate,TQpDataBase *prob,
00131                                  TQpResidual *resid,TQpVar *step);
00132                                                // alternative starting point heuristic: sets the
00133                                                // "complementary" variables to a large positive value
00134                                                 // (based on the norm of the problem data) and the
00135                                                // remaining variables to zero
00136 
00137    virtual Int_t    Solve       (TQpDataBase *prob,TQpVar *iterate,
00138                                  TQpResidual *resids) = 0;
00139                                                // implements the interior-point method for solving the QP
00140 
00141    virtual Double_t FinalStepLength
00142                                 (TQpVar *iterate,TQpVar *step);
00143                                                // Mehrotra's heuristic to calculate the final step
00144 
00145    virtual void     DoMonitor   (TQpDataBase *data,TQpVar *vars,
00146                                  TQpResidual *resids,Double_t alpha,
00147                                  Double_t sigma,Int_t i,Double_t mu,
00148                                  Int_t stop_code,Int_t level);
00149                                                // perform monitor operation at each interior-point iteration
00150    virtual void     DefMonitor  (TQpDataBase *data,TQpVar *vars,
00151                                  TQpResidual *resids,Double_t alpha,
00152                                  Double_t sigma,Int_t i,Double_t mu,
00153                                  Int_t stop_code,Int_t level) = 0;
00154                                                // default monitor: prints out one line of information
00155                                                // on each interior-point iteration
00156    virtual Int_t    DoStatus    (TQpDataBase *data,TQpVar *vars,
00157                                  TQpResidual *resids,Int_t i,Double_t mu,
00158                                  Int_t level);
00159                                                // this method called to test for convergence status at
00160                                                // at the end of each interior-point iteration
00161    virtual Int_t    DefStatus   (TQpDataBase *data,TQpVar *vars,
00162                                  TQpResidual *resids,Int_t i,Double_t mu,
00163                                  Int_t level);
00164                                                // default method for checking status. May be replaced
00165                                                // by a user-defined method
00166 
00167    TQpLinSolverBase *GetLinearSystem()            { return fSys; }
00168    void              SetMuTol       (Double_t m)  { fMutol = m; }
00169    Double_t          GetMuTol       ()            { return fMutol; }
00170 
00171    void              SetArTol       (Double_t ar) { fArtol = ar; }
00172    Double_t          GetArTol       ()            { return fArtol; }
00173    Double_t          DataNorm       ()            { return fDnorm; }
00174 
00175    TQpSolverBase &operator= (const TQpSolverBase &source);
00176 
00177    ClassDef(TQpSolverBase,1)                   // Qp Solver class
00178 };
00179 #endif

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