ROOT  6.06/09
Reference Guide
TQpDataBase.h
Go to the documentation of this file.
1 // @(#)root/quadp:$Id$
2 // Author: Eddy Offermann May 2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /*************************************************************************
13  * Parts of this file are copied from the OOQP distribution and *
14  * are subject to the following license: *
15  * *
16  * COPYRIGHT 2001 UNIVERSITY OF CHICAGO *
17  * *
18  * The copyright holder hereby grants you royalty-free rights to use, *
19  * reproduce, prepare derivative works, and to redistribute this software*
20  * to others, provided that any changes are clearly documented. This *
21  * software was authored by: *
22  * *
23  * E. MICHAEL GERTZ gertz@mcs.anl.gov *
24  * Mathematics and Computer Science Division *
25  * Argonne National Laboratory *
26  * 9700 S. Cass Avenue *
27  * Argonne, IL 60439-4844 *
28  * *
29  * STEPHEN J. WRIGHT swright@cs.wisc.edu *
30  * Computer Sciences Department *
31  * University of Wisconsin *
32  * 1210 West Dayton Street *
33  * Madison, WI 53706 FAX: (608)262-9777 *
34  * *
35  * Any questions or comments may be directed to one of the authors. *
36  * *
37  * ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES OF *
38  * ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT, AND *
39  * OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A CONTRACT *
40  * WITH THE DEPARTMENT OF ENERGY. *
41  *************************************************************************/
42 
43 #ifndef ROOT_TQpDataBase
44 #define ROOT_TQpDataBase
45 
46 #ifndef ROOT_TError
47 #include "TError.h"
48 #endif
49 
50 #ifndef ROOT_TQpVar
51 #include "TQpVar.h"
52 #endif
53 
54 #ifndef ROOT_TMatrixD
55 #include "TMatrixD.h"
56 #endif
57 
58 //////////////////////////////////////////////////////////////////////////
59 // //
60 // TQpDataBase //
61 // //
62 // Data for the general QP formulation //
63 // //
64 //////////////////////////////////////////////////////////////////////////
65 
66 class TQpDataBase : public TObject
67 {
68 
69 protected:
70 
71  // as part of setting up a random test problem, generate a random
72  // set of upper, lower, and two-sided bounds
73  static void RandomlyChooseBoundedVariables(TVectorD &x,TVectorD &dualx,TVectorD &blx,TVectorD &ixlow,
74  TVectorD &bux,TVectorD &ixupp,Double_t &ix,Double_t percentLowerOnly,
75  Double_t percentUpperOnly,Double_t percentBound);
76 
77 public:
78 
82 
83  TVectorD fG; // linear part of Objective function
84  TVectorD fBa; // vector of equality constraint
85  TVectorD fXupBound; // Bounds on variables
89  TVectorD fCupBound; // Inequality constraints
93 
94  TQpDataBase();
96  TQpDataBase(const TQpDataBase &another);
97  virtual ~TQpDataBase() {}
98 
99  virtual void PutQIntoAt(TMatrixDBase &M,Int_t row,Int_t col) = 0;
100  virtual void PutAIntoAt(TMatrixDBase &M,Int_t row,Int_t col) = 0;
101  virtual void PutCIntoAt(TMatrixDBase &M,Int_t row,Int_t col) = 0;
102 
103  virtual void Qmult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
104  virtual void Amult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
105  virtual void Cmult (Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
106  virtual void ATransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
107  virtual void CTransmult(Double_t beta,TVectorD& y,Double_t alpha,const TVectorD& x) = 0;
108 
109  virtual void GetDiagonalOfQ(TVectorD &dQ) = 0;
110 
111  virtual TVectorD &GetG () { return fG; }
112  virtual TVectorD &GetBa () { return fBa; }
113 
114  virtual TVectorD &GetXupperBound () { return fXupBound; }
115  virtual TVectorD &GetiXupperBound() { return fXupIndex; }
116  virtual TVectorD &GetXlowerBound () { return fXloBound; }
117  virtual TVectorD &GetiXlowerBound() { return fXloIndex; }
118  virtual TVectorD &GetSupperBound () { return fCupBound; }
119  virtual TVectorD &GetiSupperBound() { return fCupIndex; }
120  virtual TVectorD &GetSlowerBound () { return fCloBound; }
121  virtual TVectorD &GetiSlowerBound() { return fCloIndex; }
122 
123  virtual Double_t DataNorm () = 0;
124  virtual void DataRandom (TVectorD &x,TVectorD &y,TVectorD &z,TVectorD &s) = 0;
125  virtual Double_t ObjectiveValue(TQpVar *vars) = 0;
126 
127  TQpDataBase &operator= (const TQpDataBase &source);
128 
129  ClassDef(TQpDataBase,1) // Qp Base Data class
130 };
131 #endif
const int nx
Definition: kalman.C:16
virtual Double_t DataNorm()=0
TVectorD fXupBound
Definition: TQpDataBase.h:85
virtual void Qmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)=0
TQpDataBase & operator=(const TQpDataBase &source)
Assignment operator.
TVectorD fXloIndex
Definition: TQpDataBase.h:88
virtual TVectorD & GetiSlowerBound()
Definition: TQpDataBase.h:121
TVectorD fG
Definition: TQpDataBase.h:83
virtual TVectorD & GetXlowerBound()
Definition: TQpDataBase.h:116
virtual void CTransmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)=0
int Int_t
Definition: RtypesCore.h:41
virtual void ATransmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)=0
virtual void DataRandom(TVectorD &x, TVectorD &y, TVectorD &z, TVectorD &s)=0
TVectorD fCupIndex
Definition: TQpDataBase.h:90
double beta(double x, double y)
Calculates the beta function.
virtual TVectorD & GetBa()
Definition: TQpDataBase.h:112
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
TVectorD fCloBound
Definition: TQpDataBase.h:91
virtual void GetDiagonalOfQ(TVectorD &dQ)=0
virtual void Amult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)=0
virtual TVectorD & GetG()
Definition: TQpDataBase.h:111
virtual TVectorD & GetiXupperBound()
Definition: TQpDataBase.h:115
virtual void Cmult(Double_t beta, TVectorD &y, Double_t alpha, const TVectorD &x)=0
TVectorD fXloBound
Definition: TQpDataBase.h:87
TVectorD fXupIndex
Definition: TQpDataBase.h:86
virtual Double_t ObjectiveValue(TQpVar *vars)=0
double Double_t
Definition: RtypesCore.h:55
TVectorD fBa
Definition: TQpDataBase.h:84
Double_t y[n]
Definition: legend1.C:17
static void RandomlyChooseBoundedVariables(TVectorD &x, TVectorD &dualx, TVectorD &blx, TVectorD &ixlow, TVectorD &bux, TVectorD &ixupp, Double_t &ix, Double_t percentLowerOnly, Double_t percentUpperOnly, Double_t percentBound)
Randomly choose x and its boundaries.
Mother of all ROOT objects.
Definition: TObject.h:58
virtual TVectorD & GetXupperBound()
Definition: TQpDataBase.h:114
Definition: TQpVar.h:65
virtual void PutAIntoAt(TMatrixDBase &M, Int_t row, Int_t col)=0
TVectorD fCupBound
Definition: TQpDataBase.h:89
virtual void PutCIntoAt(TMatrixDBase &M, Int_t row, Int_t col)=0
TVectorD fCloIndex
Definition: TQpDataBase.h:92
virtual ~TQpDataBase()
Definition: TQpDataBase.h:97
virtual TVectorD & GetiXlowerBound()
Definition: TQpDataBase.h:117
virtual TVectorD & GetiSupperBound()
Definition: TQpDataBase.h:119
virtual TVectorD & GetSlowerBound()
Definition: TQpDataBase.h:120
virtual void PutQIntoAt(TMatrixDBase &M, Int_t row, Int_t col)=0
virtual TVectorD & GetSupperBound()
Definition: TQpDataBase.h:118