#include "TQpDataBase.h"
ClassImp(TQpDataBase)
TQpDataBase::TQpDataBase()
{
fNx = 0;
fMy = 0;
fMz = 0;
}
TQpDataBase::TQpDataBase(Int_t nx,Int_t my,Int_t mz)
{
fNx = nx;
fMy = my;
fMz = mz;
fG .ResizeTo(fNx);
fBa .ResizeTo(fMy);
fXupBound.ResizeTo(fNx);
fXupIndex.ResizeTo(fNx);
fXloBound.ResizeTo(fNx);
fXloIndex.ResizeTo(fNx);
fCupBound.ResizeTo(fMz);
fCupIndex.ResizeTo(fMz);
fCloBound.ResizeTo(fMz);
fCloIndex.ResizeTo(fMz);
}
TQpDataBase::TQpDataBase(const TQpDataBase &another) : TObject(another)
{
*this = another;
}
void TQpDataBase::RandomlyChooseBoundedVariables(
TVectorD &x,TVectorD &dualx,TVectorD &xlow,TVectorD &ixlow,
TVectorD &xupp,TVectorD &ixupp,Double_t &ix,Double_t percentLowerOnly,
Double_t percentUpperOnly,Double_t percentBound)
{
const Int_t n = x.GetNrows();
Int_t i;
for (i = 0; i < n; i++) {
const Double_t r = Drand(ix);
if (r < percentLowerOnly) {
ixlow[i] = 1.0;
xlow [i] = (Drand(ix)-0.5)*3.0;
ixupp[i] = 0.0;
xupp [i] = 0.0;
}
else if (r < percentLowerOnly+percentUpperOnly) {
ixlow[i] = 0.0;
xlow [i] = 0.0;
ixupp[i] = 1.0;
xupp [i] = (Drand(ix)-0.5)*3.0;
}
else if (r < percentLowerOnly+percentUpperOnly+percentBound) {
ixlow[i] = 1.0;
xlow [i] = (Drand(ix)-0.5)*3.0;
ixupp[i] = 1.0;
xupp [i] = xlow[i]+Drand(ix)*10.0;
}
else {
ixlow[i] = 0.0;
xlow [i] = 0.0;
ixupp[i] = 0.0;
xupp [i] = 0.0;
}
}
for (i = 0; i < n; i++) {
if (ixlow[i] == 0.0 && ixupp[i] == 0.0 ) {
x [i] = 20.0*Drand(ix)-10.0;
dualx[i] = 0.0;
}
else if (ixlow[i] != 0.0 && ixupp[i] != 0.0) {
const Double_t r = Drand(ix);
if (r < 0.33 ) {
x [i] = xlow[i];
dualx[i] = 10.0*Drand(ix);
}
else if ( r > .66 ) {
x [i] = xupp[i];
dualx[i] = -10.0*Drand(ix);
}
else {
const Double_t theta = .99*Drand(ix)+.005;
x [i] = (1-theta)*xlow[i]+theta*xupp[i];
dualx[i] = 0.0;
}
}
else if (ixlow[i] != 0.0) {
if (Drand(ix) < .33 ) {
x [i] = xlow[i];
dualx[i] = 10.0*Drand(ix);
}
else {
x [i] = xlow[i]+0.005+10.0*Drand(ix);
dualx[i] = 0.0;
}
}
else {
if (Drand(ix) > .66 ) {
x [i] = xupp[i];
dualx[i] = -10.0*Drand(ix);
}
else {
x [i] = xupp[i]-0.005-10.0*Drand(ix);
dualx[i] = 0.0;
}
}
}
}
TQpDataBase &TQpDataBase::operator=(const TQpDataBase &source)
{
if (this != &source) {
TObject::operator=(source);
fNx = source.fNx;
fMy = source.fMy;
fMz = source.fMz;
fG .ResizeTo(source.fG) ; fG = source.fG ;
fBa .ResizeTo(source.fBa) ; fBa = source.fBa ;
fXupBound.ResizeTo(source.fXupBound); fXupBound = source.fXupBound;
fXupIndex.ResizeTo(source.fXupIndex); fXupIndex = source.fXupIndex;
fXloBound.ResizeTo(source.fXloBound); fXloBound = source.fXloBound;
fXloIndex.ResizeTo(source.fXloIndex); fXloIndex = source.fXloIndex;
fCupBound.ResizeTo(source.fCupBound); fCupBound = source.fCupBound;
fCupIndex.ResizeTo(source.fCupIndex); fCupIndex = source.fCupIndex;
fCloBound.ResizeTo(source.fCloBound); fCloBound = source.fCloBound;
fCloIndex.ResizeTo(source.fCloIndex); fCloIndex = source.fCloIndex;
}
return *this;
}
Last change: Wed Jun 25 08:51:46 2008
Last generated: 2008-06-25 08:51
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.