TQpDataBase.h

Go to the documentation of this file.
00001 // @(#)root/quadp:$Id: TQpDataBase.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_TQpDataBase
00044 #define ROOT_TQpDataBase
00045 
00046 #ifndef ROOT_TError
00047 #include "TError.h"
00048 #endif
00049 
00050 #ifndef ROOT_TQpVar
00051 #include "TQpVar.h"
00052 #endif
00053 
00054 #ifndef ROOT_TMatrixD
00055 #include "TMatrixD.h"
00056 #endif
00057 
00058 //////////////////////////////////////////////////////////////////////////
00059 //                                                                      //
00060 // TQpDataBase                                                          //
00061 //                                                                      //
00062 // Data for the general QP formulation                                  //
00063 //                                                                      //
00064 //////////////////////////////////////////////////////////////////////////
00065 
00066 class TQpDataBase : public TObject
00067 {
00068 
00069 protected:
00070 
00071    // as part of setting up a random test problem, generate a random
00072    //  set of upper, lower, and two-sided bounds
00073    static void RandomlyChooseBoundedVariables(TVectorD &x,TVectorD &dualx,TVectorD &blx,TVectorD &ixlow,
00074                                               TVectorD &bux,TVectorD &ixupp,Double_t &ix,Double_t percentLowerOnly,
00075                                               Double_t percentUpperOnly,Double_t percentBound);
00076 
00077 public:
00078 
00079    Int_t    fNx;
00080    Int_t    fMy;
00081    Int_t    fMz;
00082 
00083    TVectorD fG;                                // linear part of Objective function
00084    TVectorD fBa;                               // vector of equality constraint
00085    TVectorD fXupBound;                         // Bounds on variables
00086    TVectorD fXupIndex;
00087    TVectorD fXloBound;
00088    TVectorD fXloIndex;
00089    TVectorD fCupBound;                         // Inequality constraints
00090    TVectorD fCupIndex;
00091    TVectorD fCloBound;
00092    TVectorD fCloIndex;
00093 
00094    TQpDataBase();
00095    TQpDataBase(Int_t nx,Int_t my,Int_t mz);
00096    TQpDataBase(const TQpDataBase &another);
00097    virtual ~TQpDataBase() {}
00098 
00099    virtual void PutQIntoAt(TMatrixDBase &M,Int_t row,Int_t col) = 0;
00100    virtual void PutAIntoAt(TMatrixDBase &M,Int_t row,Int_t col) = 0;
00101    virtual void PutCIntoAt(TMatrixDBase &M,Int_t row,Int_t col) = 0;
00102 
00103    virtual void Qmult     (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
00104    virtual void Amult     (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
00105    virtual void Cmult     (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
00106    virtual void ATransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
00107    virtual void CTransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
00108 
00109    virtual void GetDiagonalOfQ(TVectorD &dQ) = 0;
00110 
00111    virtual TVectorD &GetG           () { return fG; }
00112    virtual TVectorD &GetBa          () { return fBa; }
00113 
00114    virtual TVectorD &GetXupperBound () { return fXupBound; }
00115    virtual TVectorD &GetiXupperBound() { return fXupIndex; }
00116    virtual TVectorD &GetXlowerBound () { return fXloBound; }
00117    virtual TVectorD &GetiXlowerBound() { return fXloIndex; }
00118    virtual TVectorD &GetSupperBound () { return fCupBound;  }
00119    virtual TVectorD &GetiSupperBound() { return fCupIndex; }
00120    virtual TVectorD &GetSlowerBound () { return fCloBound;  }
00121    virtual TVectorD &GetiSlowerBound() { return fCloIndex; }
00122 
00123    virtual Double_t  DataNorm      () = 0;
00124    virtual void      DataRandom    (TVectorD &x,TVectorD &y,TVectorD &z,TVectorD &s) = 0;
00125    virtual Double_t  ObjectiveValue(TQpVar *vars) = 0;
00126 
00127    TQpDataBase &operator= (const TQpDataBase &source);
00128 
00129    ClassDef(TQpDataBase,1)                     // Qp Base Data class
00130 };
00131 #endif

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