00001 // @(#)root/quadp:$Id: TQpProbBase.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_TQpProbBase 00044 #define ROOT_TQpProbBase 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_TQpLinSolverBase 00057 #include "TQpLinSolverBase.h" 00058 #endif 00059 #ifndef ROOT_TQpResidual 00060 #include "TQpResidual.h" 00061 #endif 00062 00063 #ifndef ROOT_TMatrixD 00064 #include "TMatrixD.h" 00065 #endif 00066 00067 /////////////////////////////////////////////////////////////////////////// 00068 // // 00069 // default general problem formulation: // 00070 // // 00071 // minimize c' x + ( 1/2 ) x' * Q x ; // 00072 // subject to A x = b ; // 00073 // clo <= C x <= cup ; // 00074 // xlo <= x <= xup ; // 00075 // // 00076 // The general linear equality constraints must have either an upper // 00077 // or lower bound, but need not have both bounds. The variables may have// 00078 // no bounds; an upper bound; a lower bound or both an upper and lower // 00079 // bound. // 00080 // // 00081 // However, for many (possibly most) QP's, the matrices in the // 00082 // formulation have structure that may be exploited to solve the // 00083 // problem more efficiently. This abstract problem formulation contains // 00084 // a setup such that one can derive and add special formulations . // 00085 // The optimality conditions of the simple QP defined above are // 00086 // follows: // 00087 // // 00088 // rQ = c + Q * x - A' * y - C' * z = 0 // 00089 // rA = A * x - b = 0 // 00090 // rC = C * x - s - d = 0 // 00091 // r3 = S * z = 0 // 00092 // s, z >= 0 // 00093 // // 00094 // Where rQ, rA, rC and r3 newly defined quantities known as residual // 00095 // vectors and x, y, z and s are variables of used in solution of the // 00096 // QPs. // 00097 // // 00098 /////////////////////////////////////////////////////////////////////////// 00099 00100 class TQpLinSolverBase; 00101 class TQpProbBase : public TObject 00102 { 00103 00104 public: 00105 Int_t fNx; // number of elements in x 00106 Int_t fMy; // number of rows in A and b 00107 Int_t fMz; // number of rows in C 00108 00109 TQpProbBase(); 00110 TQpProbBase(Int_t nx,Int_t my,Int_t mz); 00111 TQpProbBase(const TQpProbBase &another); 00112 00113 virtual ~TQpProbBase() {} 00114 00115 virtual TQpDataBase *MakeData (TVectorD &c, 00116 TMatrixDBase &Q_in, 00117 TVectorD &xlo, TVectorD &ixlo, 00118 TVectorD &xup, TVectorD &ixup, 00119 TMatrixDBase &A_in,TVectorD &bA, 00120 TMatrixDBase &C_in, 00121 TVectorD &clo, TVectorD &iclo, 00122 TVectorD &cup, TVectorD &icup) = 0; 00123 virtual TQpResidual *MakeResiduals(const TQpDataBase *data) = 0; 00124 virtual TQpVar *MakeVariables(const TQpDataBase *data) = 0; 00125 virtual TQpLinSolverBase *MakeLinSys (const TQpDataBase *data) = 0; 00126 00127 virtual void JoinRHS (TVectorD &rhs_in,TVectorD &rhs1_in,TVectorD &rhs2_in,TVectorD &rhs3_in) = 0; 00128 virtual void SeparateVars(TVectorD &x_in,TVectorD &y_in,TVectorD &z_in,TVectorD &vars_in) = 0; 00129 00130 TQpProbBase &operator= (const TQpProbBase &source); 00131 00132 ClassDef(TQpProbBase,1) // Qp problem formulation base class 00133 }; 00134 #endif