Brief description of class still missing. More...
#include <GeneratorModels.h>
Public Member Functions | |
| const ActiveModels * | activeModels () const |
| void | add (int modelIndex) |
| const BestModels * | bestModels () const |
| BestModels * | bestModels () |
| void | clear () |
| void | commitStatistics (NewModel *m, double giveUp) |
| GeneratorModels (ModelSet *allModels) | |
| GeneratorModels (const GeneratorModels &o) | |
| int | giveUpCount () const |
| int | quarantinedCount () const |
| int | rejectedCount () const |
| GeneratorModels * | removeDeadModels () const |
| const ScaledModels * | scaledModels () const |
| int | serialNumber () const |
| void | setBestModelCount (int nr) |
| void | setScaledModels (const RealSpace ¶meterSpace) |
| ~GeneratorModels () | |
Brief description of class still missing.
Full description of class still missing
| DinverCore::GeneratorModels::GeneratorModels | ( | ModelSet * | allModels | ) |
Description of constructor still missing
References TRACE.
Referenced by removeDeadModels().
: SharedObject() { TRACE; _activeModels=new ActiveModels(allModels); _bestModels=new BestModels(_activeModels); _scaledModels=0; _serialNumber=_nextSerialNumber++; _rejectedCount=0; _giveUpCount=0; _quarantinedCount=0; }
Description of constructor still missing
References DinverCore::ActiveModels::allModels(), and TRACE.
: SharedObject() { TRACE; _activeModels=new ActiveModels(o._activeModels->allModels()); _bestModels=new BestModels(_activeModels); _scaledModels=0; _serialNumber=_nextSerialNumber++; _rejectedCount=o._rejectedCount; _giveUpCount=o._giveUpCount; _quarantinedCount=o._quarantinedCount; }
| const ActiveModels* DinverCore::GeneratorModels::activeModels | ( | ) | const [inline] |
Referenced by DinverCore::ModelRepository::activeModelCount(), DinverCore::ModelRepository::printActiveModels(), and DinverCore::ModelRepository::start().
{return _activeModels;}
| void DinverCore::GeneratorModels::add | ( | int | modelIndex | ) |
Adds model m to active and best models.
References DinverCore::ActiveModels::add(), DinverCore::BestModels::add(), DinverCore::ActiveModels::count(), and TRACE.
Referenced by DinverCore::ModelRepository::importModels().
| const BestModels* DinverCore::GeneratorModels::bestModels | ( | ) | const [inline] |
Referenced by DinverCore::ModelRepository::bestModelCount(), DinverCore::ModelRepository::createModel(), and DinverCore::ModelRepository::start().
{return _bestModels;}
| BestModels* DinverCore::GeneratorModels::bestModels | ( | ) | [inline] |
{return _bestModels;}
| void DinverCore::GeneratorModels::clear | ( | ) |
References DinverCore::ActiveModels::clear(), DinverCore::BestModels::clear(), and TRACE.
Referenced by DinverCore::ModelRepository::clear().
| void DinverCore::GeneratorModels::commitStatistics | ( | NewModel * | m, |
| double | giveUp | ||
| ) |
References DinverCore::ParentIndex::activeIndex(), DinverCore::ActiveModel::addAccepted(), DinverCore::ActiveModel::addRejected(), DinverCore::ActiveModels::at(), DinverCore::ActiveModel::giveUp(), DinverCore::NewModel::isValidMisfit(), DinverCore::NewModel::isValidParent(), DinverCore::NewModel::navigatorHits(), DinverCore::NewModel::parentIndex(), DinverCore::ParentIndex::serialNumber(), serialNumber(), DinverCore::ActiveModels::setNavigatorHits(), DinverCore::ActiveModel::setQuarantined(), and TRACE.
{
TRACE;
if(m->parentIndex()) { // Neighborhood
// Fully commit statistics only to models based on this GeneratorModels
if(m->parentIndex()->serialNumber()==serialNumber()) {
//_activeModels->addNavigatorHits(m->navigatorHits());
_activeModels->setNavigatorHits(m->navigatorHits());
ActiveModel& am=_activeModels->at(m->parentIndex()->activeIndex());
if(m->isValidParent()) {
if(m->isValidMisfit()) {
am.addAccepted();
} else {
_rejectedCount++;
am.addRejected();
if(am.giveUp(giveUp)) {
_giveUpCount++;
am.setQuarantined();
_quarantinedCount++;
}
}
} else {
// This is an atomic cell, keep it but remove its parent from best cells and prevent its re-insertion
am.setQuarantined();
_quarantinedCount++;
//App::stream() << tr("Atomic cell detected: quarantine") << endl;
}
} else { // Count only rejected models, we do not have access to parent cell anymore
// Atomic cells must not be confused with rejected ones
if(!m->isValidMisfit() && m->isValidParent()) {
_rejectedCount++;
}
}
} else { // Monte-Carlo
if(!m->isValidMisfit()) {
_rejectedCount++;
}
}
}
| int DinverCore::GeneratorModels::giveUpCount | ( | ) | const [inline] |
Referenced by DinverCore::ModelRepository::giveUpCount().
{return _giveUpCount;}
| int DinverCore::GeneratorModels::quarantinedCount | ( | ) | const [inline] |
{return _quarantinedCount;}
| int DinverCore::GeneratorModels::rejectedCount | ( | ) | const [inline] |
Referenced by DinverCore::ModelRepository::rejectedCount(), and DinverCore::ModelRepository::validModelCount().
{return _rejectedCount;}
Create a new GeneratorModels with all dead models removed.
References DinverCore::BestModels::activeModelMap(), DinverCore::ActiveModels::add(), DinverCore::BestModels::add(), DinverCore::ActiveModels::at(), DinverCore::ActiveModels::count(), GeneratorModels(), DinverCore::ActiveModel::healthCheck(), DinverCore::ActiveModel::isDying(), DinverCore::ActiveModel::isQuarantined(), DinverCore::BestModels::setModels(), and TRACE.
{
TRACE;
GeneratorModels * newGeneratorModels=new GeneratorModels(*this);
ActiveModels * newActiveModels=newGeneratorModels->_activeModels;
BestModels * newBestModels=newGeneratorModels->_bestModels;
int * bestModelIndex=_bestModels->activeModelMap();
int activeCount=_activeModels->count();
for(int i=0; i<activeCount; i++) {
const ActiveModel& m=_activeModels->at(i);
if(bestModelIndex[i]==-1 || m.isQuarantined()) { // Not a best model or a quarantined best cell
if(!m.isDying()) {
newActiveModels->add(m).healthCheck();
}
} else {
newActiveModels->add(m);
newBestModels->add(newActiveModels->count()-1);
}
}
newBestModels->setModels(newActiveModels);
delete [] bestModelIndex;
return newGeneratorModels;
}
| const ScaledModels* DinverCore::GeneratorModels::scaledModels | ( | ) | const [inline] |
{return _scaledModels;}
| int DinverCore::GeneratorModels::serialNumber | ( | ) | const [inline] |
Referenced by commitStatistics().
{return _serialNumber;}
| void DinverCore::GeneratorModels::setBestModelCount | ( | int | nr | ) |
Required for the first GeneratorModels. Those produced by remodeDeadModels() have best models yet fully initialized.
References QGpCoreTools::endl(), DinverCore::BestModels::setNr(), QGpCoreTools::tr(), and TRACE.
Referenced by DinverCore::ModelRepository::setBestModelCount().
| void DinverCore::GeneratorModels::setScaledModels | ( | const RealSpace & | parameterSpace | ) |
Wathelet(2008): Voronoi geometry is not invariant against axis scaling and it has a strong effect on exploration properties.
Scales are calculated in the integer space based on the size of the best models region.
References DinverCore::BestModels::count(), DinverCore::Parameter::gridCount(), DinverCore::BestModels::model(), TRACE, DinverCore::RealSpace::variableParameter(), and DinverCore::RealSpace::variableParameterCount().
{
TRACE;
ASSERT(!_scaledModels);
int ndVar=parameterSpace.variableParameterCount();
double * s =new double[ndVar];
if(_bestModels->count()< 2) { // Use parameter space limits instead of
// the best models
double tmp;
for(int ip=0; ip<ndVar; ip++) {
tmp=parameterSpace.variableParameter(ip)->gridCount();
if(tmp < 1.0) tmp=1.0;
s[ip]=1.0/tmp;
}
} else {
int * minModel=new int[ndVar];
int * maxModel=new int[ndVar];
const int * model=_bestModels->model(0);
for(int ip=0; ip<ndVar; ip++) {
minModel[ip]=model[ip];
maxModel[ip]=model[ip];
}
for(int im=_bestModels->count()-1; im>=0; im--) {
model=_bestModels->model(im);
for(int ip=0; ip<ndVar; ip++) {
if(model[ip]<minModel[ip]) minModel[ip]=model[ip];
else if(model[ip]>maxModel[ip]) maxModel[ip]=model[ip];
}
}
// Calculate the scaling factors
double tmp;
//App::stream() << tr("Size of best region:\n");
for(int ip=0; ip<ndVar; ip++) {
tmp=maxModel[ip]-minModel[ip];
if(tmp < 1.0) tmp=1.0;
s[ip]=1.0/tmp;
//App::stream() << " " << tmp;
}
//App::stream() << endl;
delete [] minModel;
delete [] maxModel;
}
_scaledModels=new ScaledModels(_activeModels, s);
}