Logo ROOT   6.07/09
Reference Guide
TQpLinSolverBase.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_TQpLinSolverBase
44 #define ROOT_TQpLinSolverBase
45 
46 #ifndef ROOT_TError
47 #include "TError.h"
48 #endif
49 
50 #ifndef ROOT_TQpVar
51 #include "TQpVar.h"
52 #endif
53 #ifndef ROOT_TQpDataBase
54 #include "TQpDataBase.h"
55 #endif
56 #ifndef ROOT_TQpResidual
57 #include "TQpResidual.h"
58 #endif
59 #ifndef ROOT_TQpProbBase
60 #include "TQpProbBase.h"
61 #endif
62 
63 #ifndef ROOT_TMatrixD
64 #include "TMatrixD.h"
65 #endif
66 
67 ///////////////////////////////////////////////////////////////////////////
68 // //
69 // Implements the main solver for linear systems that arise in //
70 // primal-dual interior-point methods for QP . This class contains //
71 // definitions of methods and data common to the sparse and dense //
72 // special cases of the general formulation. The derived classes contain //
73 // the aspects that are specific to the sparse and dense forms. //
74 // //
75 ///////////////////////////////////////////////////////////////////////////
76 
77 class TQpProbBase;
78 class TQpLinSolverBase : public TObject
79 {
80 
81 protected:
82 
83  TVectorD fNomegaInv; // stores a critical diagonal matrix as a vector
84  TVectorD fRhs; // right-hand side of the system
85 
86  Int_t fNx; // dimensions of the vectors in the general QP formulation
89 
90  TVectorD fDd; // temporary storage vectors
92 
93  TVectorD fXupIndex; // index matrices for the upper and lower bounds on x and Cx
97 
98  Int_t fNxup; // dimensions of the upper and lower bound vectors
102 
104 
105 public:
107  TQpLinSolverBase(TQpProbBase *factory,TQpDataBase *data);
108  TQpLinSolverBase(const TQpLinSolverBase &another);
109 
110  virtual ~TQpLinSolverBase() {}
111 
112  virtual void Factor (TQpDataBase *prob,TQpVar *vars);
113  // sets up the matrix for the main linear system in
114  // "augmented system" form. The actual factorization is
115  // performed by a routine specific to either the sparse
116  // or dense case
117  virtual void Solve (TQpDataBase *prob,TQpVar *vars,TQpResidual *resids,TQpVar *step);
118  // solves the system for a given set of residuals.
119  // Assembles the right-hand side appropriate to the
120  // matrix factored in factor, solves the system using
121  // the factorization produced there, partitions the
122  // solution vector into step components, then recovers
123  // the step components eliminated during the block
124  // elimination that produced the augmented system form
125  virtual void JoinRHS (TVectorD &rhs, TVectorD &rhs1,TVectorD &rhs2,TVectorD &rhs3);
126  // assembles a single vector object from three given vectors
127  // rhs (output) final joined vector
128  // rhs1 (input) first part of rhs
129  // rhs2 (input) middle part of rhs
130  // rhs3 (input) last part of rhs
131  virtual void SeparateVars (TVectorD &vars1,TVectorD &vars2,TVectorD &vars3,TVectorD &vars);
132  // extracts three component vectors from a given aggregated
133  // vector.
134  // vars (input) aggregated vector
135  // vars1 (output) first part of vars
136  // vars2 (output) middle part of vars
137  // vars3 (output) last part of vars
138 
139  virtual void SolveXYZS (TVectorD &stepx,TVectorD &stepy,TVectorD &stepz,TVectorD &steps,
140  TVectorD &ztemp,TQpDataBase *data);
141  // assemble right-hand side of augmented system and call
142  // SolveCompressed to solve it
143 
144  virtual void SolveCompressed (TVectorD &rhs) = 0;
145  // perform the actual solve using the factors produced in
146  // factor.
147  // rhs on input contains the aggregated right-hand side of
148  // the augmented system; on output contains the solution in
149  // aggregated form
150 
151  virtual void PutXDiagonal (TVectorD &xdiag) = 0;
152  // places the diagonal resulting from the bounds on x into
153  // the augmented system matrix
154  virtual void PutZDiagonal (TVectorD& zdiag) = 0;
155  // places the diagonal resulting from the bounds on Cx into
156  // the augmented system matrix
157  virtual void ComputeDiagonals(TVectorD &dd,TVectorD &omega,TVectorD &t, TVectorD &lambda,
159  TVectorD &w, TVectorD &phi);
160  // computes the diagonal matrices in the augmented system
161  // from the current set of variables
162 
164 
165  ClassDef(TQpLinSolverBase,1) // Qp linear solver base class
166 };
167 #endif
TQpLinSolverBase()
Default constructor.
const double pi
int Int_t
Definition: RtypesCore.h:41
TQpProbBase * fFactory
virtual void Solve(TQpDataBase *prob, TQpVar *vars, TQpResidual *resids, TQpVar *step)
Solves the system for a given set of residuals.
virtual void PutXDiagonal(TVectorD &xdiag)=0
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void PutZDiagonal(TVectorD &zdiag)=0
virtual void ComputeDiagonals(TVectorD &dd, TVectorD &omega, TVectorD &t, TVectorD &lambda, TVectorD &u, TVectorD &pi, TVectorD &v, TVectorD &gamma, TVectorD &w, TVectorD &phi)
Computes the diagonal matrices in the augmented system from the current set of variables.
double gamma(double x)
SVector< double, 2 > v
Definition: Dict.h:5
virtual void SeparateVars(TVectorD &vars1, TVectorD &vars2, TVectorD &vars3, TVectorD &vars)
Extracts three component vectors from a given aggregated vector.
virtual ~TQpLinSolverBase()
virtual void SolveXYZS(TVectorD &stepx, TVectorD &stepy, TVectorD &stepz, TVectorD &steps, TVectorD &ztemp, TQpDataBase *data)
Assemble right-hand side of augmented system and call SolveCompressed to solve it.
virtual void Factor(TQpDataBase *prob, TQpVar *vars)
Sets up the matrix for the main linear system in "augmented system" form.
Mother of all ROOT objects.
Definition: TObject.h:44
virtual void SolveCompressed(TVectorD &rhs)=0
Definition: TQpVar.h:65
TQpLinSolverBase & operator=(const TQpLinSolverBase &source)
Assignment opeartor.
virtual void JoinRHS(TVectorD &rhs, TVectorD &rhs1, TVectorD &rhs2, TVectorD &rhs3)
Assembles a single vector object from three given vectors .