00001
00002
00003
00004
00005 #ifndef QPGENDATA
00006 #define QPGENDATA
00007
00008 #include "Data.h"
00009 #include "OoqpVectorHandle.h"
00010 #include "OoqpVector.h"
00011 #include "DoubleMatrixHandle.h"
00012
00013 class MpsReader;
00014 class LinearAlgebraPackage;
00015 class QpGenVars;
00016
00017 #ifdef TESTING
00018 class QpGenDataTester;
00019 #endif
00020
00027 class QpGenData : public Data {
00028 #ifdef TESTING
00029 friend QpGenDataTester;
00030 #endif
00031 private:
00032
00035 void randomlyChooseBoundedVariables( OoqpVector& x, OoqpVector& dualx,
00036 OoqpVector& blx, OoqpVector& ixlow,
00037 OoqpVector& bux, OoqpVector& ixupp,
00038 double * ix,
00039 double percentLowerOnly,
00040 double percentUpperOnly,
00041 double percentBound );
00042 protected:
00043 LinearAlgebraPackage * la;
00044
00045 public:
00046 SymMatrixHandle Q;
00047 GenMatrixHandle A;
00048 GenMatrixHandle C;
00049 OoqpVectorHandle g;
00050 OoqpVectorHandle bA;
00051 OoqpVectorHandle bux;
00052 OoqpVectorHandle ixupp;
00053 OoqpVectorHandle blx;
00054 OoqpVectorHandle ixlow;
00055 OoqpVectorHandle bu;
00056 OoqpVectorHandle icupp;
00057 OoqpVectorHandle bl;
00058 OoqpVectorHandle iclow;
00059 OoqpVectorHandle sc;
00060
00061 int nx, my, mz;
00062
00064 QpGenData(LinearAlgebraPackage * la,
00065 int nx_, int my_, int mz_,
00066 int nnzQ, int nnzA, int nnzC);
00067
00070 QpGenData( LinearAlgebraPackage * la,
00071 OoqpVector * c, SymMatrix * Q,
00072 OoqpVector * xlow, OoqpVector * ixlow,
00073 OoqpVector * xupp, OoqpVector * ixupp,
00074 GenMatrix * A, OoqpVector * bA,
00075 GenMatrix * C,
00076 OoqpVector * clow, OoqpVector * iclow,
00077 OoqpVector * cupp, OoqpVector * ciupp );
00078
00081 virtual void putQIntoAt( GenMatrix& M, int row, int col );
00082
00085 virtual void putAIntoAt( GenMatrix& M, int row, int col );
00086
00089 virtual void putCIntoAt( GenMatrix& M, int row, int col );
00090
00093 virtual void putQIntoAt( SymMatrix& M, int row, int col );
00094
00097 virtual void putAIntoAt( SymMatrix& M, int row, int col );
00098
00101 virtual void putCIntoAt( SymMatrix& M, int row, int col );
00102
00104 virtual void Qmult( double beta, OoqpVector& y,
00105 double alpha, OoqpVector& x );
00106
00108 virtual void Amult( double beta, OoqpVector& y,
00109 double alpha, OoqpVector& x);
00110
00112 virtual void Cmult( double beta, OoqpVector& y,
00113 double alpha, OoqpVector& x );
00114
00116 virtual void ATransmult( double beta, OoqpVector& y,
00117 double alpha, OoqpVector& x );
00118
00120 virtual void CTransmult( double beta, OoqpVector& y,
00121 double alpha, OoqpVector& x );
00122
00123
00124
00125
00126 virtual void getg( OoqpVector& cout );
00127 virtual void getbA( OoqpVector& bout );
00128
00130 virtual void getDiagonalOfQ( OoqpVector& dQ );
00131
00132 virtual OoqpVector& xupperBound() { return *bux; };
00133 virtual OoqpVector& ixupperBound() { return *ixupp; };
00134 virtual OoqpVector& xlowerBound() { return *blx; };
00135 virtual OoqpVector& ixlowerBound() { return *ixlow; };
00136 virtual OoqpVector& supperBound() { return *bu; };
00137 virtual OoqpVector& isupperBound() { return *icupp; };
00138 virtual OoqpVector& slowerBound() { return *bl; };
00139 virtual OoqpVector& islowerBound() { return *iclow; };
00140 virtual OoqpVector& scale(){ return *sc; };
00141
00142 virtual void createScaleFromQ();
00143 virtual void scaleQ();
00144 virtual void scaleA();
00145 virtual void scaleC();
00146 virtual void scaleg();
00147 virtual void scalexupp();
00148 virtual void scalexlow();
00149
00150 virtual void flipg();
00151 virtual void flipQ();
00152
00153 virtual double datanorm();
00154 virtual void datainput() {};
00155 virtual void datainput( MpsReader * reader, int& iErr );
00159 virtual void datarandom( OoqpVector & x, OoqpVector & y,
00160 OoqpVector & z, OoqpVector & s );
00161 virtual void print();
00162
00163 virtual double objectiveValue( QpGenVars * vars );
00164
00165 virtual ~QpGenData() {};
00166 };
00167
00168 #endif