English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Sampler: URANIE::Sampler::TOATSamplingMultiNominal Class Reference
Uranie / Sampler v4.9.0
/* @license-end */
URANIE::Sampler::TOATSamplingMultiNominal Class Reference

This class has been renamed. Please use TOATDesign instead. More...

#include <TOATSamplingMultiNominal.h>

Inheritance diagram for URANIE::Sampler::TOATSamplingMultiNominal:
Collaboration diagram for URANIE::Sampler::TOATSamplingMultiNominal:

Public Member Functions

Constructor and Destructor
 TOATSamplingMultiNominal (URANIE::DataServer::TDataServer *tds, TString mode="regular", Int_t number=2)
 Constructor of the OAT sampler.
 
virtual ~TOATSamplingMultiNominal ()
 Default destructor.
 
Getting and setting parameters
virtual Bool_t getHasData ()
 Returns TRUE if the internal data server contains data.
 
virtual Double_t getNumberOfModifications ()
 Get the number of modifications per attribute and nominal values.
 
virtual TString getSamplingMode ()
 Get OAT sampling mode.
 
virtual TString getGenerationMode ()
 Get random generation method.
 
virtual TList * getChangingAttList ()
 Get the list of changing attributes.
 
virtual TMap * getRangeInformation ()
 Get the list mapping the names of the changing attributes and their corresponding range information.
 
virtual URANIE::DataServer::TDSNtupleD * getNominalValueTuple ()
 Get the tuple storing the nominal values of the attributes.
 
virtual void setOption (TString mode, Int_t number)
 Set the sampling mode and number of modifications.
 
void setRange (TString changingAttName, Double_t rangeValue, Bool_t is_percent=kFALSE)
 Set the range of the sampling for a changing attribute.
 
void setRange (TString changingAttName, TString rangeAttName, Bool_t is_percent=kFALSE)
 Set the name of the attribute holding the range of the sampling for a changing attribute.
 
Generation of the sample
virtual void generateSample (Option_t *option="")
 Generates the sample.
 
Printing Log
virtual void printLog (Option_t *option="")
 Prints the log.
 
- Public Member Functions inherited from URANIE::Sampler::TSamplerStochastic
 TSamplerStochastic (URANIE::DataServer::TDataServer *tds, Option_t *option, Int_t nCalcul)
 Constructor with a dataserver.
 
virtual ~TSamplerStochastic ()
 Default destructor.
 
void setSeed (Int_t ind=0)
 Init the seed.
 
Int_t getSeed ()
 Returns the seed value.
 
- Public Member Functions inherited from URANIE::Sampler::TSampler
 TSampler (URANIE::DataServer::TDataServer *tds, Option_t *option, Int_t nCalcul)
 Constructor with a TDataServer, the options and the size of the sample.
 
virtual ~TSampler ()
 Default destructor.
 
Int_t GetID ()
 Returns the ID of the class.
 
void setMethodName (TString str)
 Sets the method name in a global variable.
 
TString getMethodName ()
 Gets the method name.
 
virtual URANIE::DataServer::TDataServer * getTDS ()
 Return the TDS filling by the sampling algorithm.
 
void parseOption (Option_t *option)
 Parse the option.
 
virtual void createListOfAttributes ()
 Creates the List of attributes to simulate.
 
virtual void createTuple ()
 Creates the TDSNtupleD of data with only the TStochasticAttributes.
 
URANIE::DataServer::TDSNtupleD * getTuple ()
 Returns the TDSNtupleD of data.
 
virtual void fillOtherAttributes ()
 Fills the TDSNtupleD of data with other TFormulaAttributes.
 
void setLog ()
 
void unsetLog ()
 
void changeLog ()
 
Bool_t getLog ()
 

Protected Member Functions

State machine

For the stochastic methods, two states can be created init and terminate which are executed just before the generation of the sample for the first one, and after the generation for the second one. They can be used for pre and post treatment purpose.

virtual void init ()
 Initialise the sampling procedure.
 
virtual void terminate ()
 The post-processing step. Nothing is done.
 
State machine

For the stochastic methods, two2 states can be created init and terminate which are executed just before the generation of the sample for the first one, and after the generation for the second one. They can be used for pre and post treatment purpose.

Private Attributes

TString _sMode
 Sampling mode. So far, can be "random" or "regular".
 
TString _sGenMode
 Data generation mode. Only used in the random mode context, can be "lhs", or "srs".
 
Int_t _nNbModif
 Number of modification for each nominal value of each changing attribute.
 
TList _changingAttList
 List of changing attributes.
 
TMap _infoRangeMap
 A list mapping the names of the changing attributes and their corresponding range information.
 
URANIE::DataServer::TDSNtupleD * _nominalValueTuple
 A tuple storing the nominal values of the attributes.
 
Bool_t _bHasData
 Boolean value set to TRUE if the data server _tds contains data.
 

Additional Inherited Members

- Public Attributes inherited from URANIE::Sampler::TSampler
Int_t _nS
 The size of the sample.
 
Int_t _nX
 The size of attributes to sample.
 
URANIE::DataServer::TDSNtupleD * _ntsample
 the tntuple of data
 
TString _sMethod
 The title of the sampler method.
 
Bool_t _blog
 Log Printing.
 
Bool_t _bupdateFile
 Update the back up file when generating the attributeformula if there is some.
 
URANIE::DataServer::TDataServer * _tds
 Pointer to a TDS.
 
TList * _lstOfAttributesToSample
 The list of Stochastic Attributes to sample.
 
- Protected Attributes inherited from URANIE::Sampler::TSamplerStochastic
Int_t _nSeed
 

Detailed Description

This class has been renamed. Please use TOATDesign instead.

The principle of the OAT design of experiment is to modify only one attribute at a time, all the other factors being kept at a nominal value. This is the simplest way to compute partial derivatives or sensitivities. For the latter application however, it might not be the best solution as this approach does not explore multi-factorial and non-linear effects.

The present implementation is an improvement of TOATSampling. The user has now two ways of defining the nominal values of the attributes: by setting the default value for each attribute or by providing a tds with a set of nominal values. In the latter case, more than one set of nominal values can be provided, and an OAT sampling will be generated for each one of them.

The generated values are sampled inside an interval, centered on the nominal value. The width of this interval is defined as the "range". For each changing attribute, the user has to define the range, either as a numerical value, or as the name of an attribute of the tds. In both cases, an option allows the resulting value of the range to be interpreted as a percentage of the nominal value.

Two modes of data generation are available. The "regular" mode will generate data regularily spaced over the interval. The "random" mode will generate random values inside the interval. In the "random" mode, the changing attributes must be TStochasticAttribute objects. This means that (at the moment) this mode can't be used on attributes loaded from a file.

The number of generated values is not limited. It just needs to be greater or equal to 2. And if the sampling is "regular", it must also be even. But if an odd value is given, it will be reduced to an even one.

Here is a small example script, showing a regular OAT sampling on 2 attributes whose nominal values are read from a file:

--— file myNominalValues.dat --—

#COLUMN_NAMES: x1 | rx1 | x2

3.0  0.4  2.0
5.0  0.2  3.0

--— data generation script --—

{
// Construction of the data server
URANIE::DataServer::TDataServer tds("myTDS","OAT sampling TDS");
// Load the nominal values
tds.fileDataRead("myNominalValues.dat");
// Create the sampler
// Set the range of attribute x1. It will be the value of attribute rx1.
s.setRange("x1","rx1");
// Set the range of attribute x2. It will be 10.0% of x2's nominal value.
s.setRange("x2",10.0,kTRUE);
// Generate an OAT sampling where only x1 and x2 will vary
s.generateSample();
// Save the results to a file
tds.exportData("myOATSampling.dat");
}
This class has been renamed. Please use TOATDesign instead.
Definition TOATSamplingMultiNominal.h:145

--— file myOATSampling.dat --—

#COLUMN_NAMES: x1| rx1| x2| __nominal_set__| __modified_att__| myTDS__n__iter__

3.00   0.4   2.000   1.0   -1.0    1.0 
2.80   0.4   2.000   1.0    0.0    2.0 
3.20   0.4   2.000   1.0    0.0    3.0 
2.90   0.4   2.000   1.0    0.0    4.0 
3.10   0.4   2.000   1.0    0.0    5.0 
3.00   0.4   1.900   1.0    2.0    6.0 
3.00   0.4   2.100   1.0    2.0    7.0 
3.00   0.4   1.950   1.0    2.0    8.0 
3.00   0.4   2.050   1.0    2.0    9.0 
5.00   0.2   3.000   2.0   -1.0   10.0 
4.90   0.2   3.000   2.0    0.0   11.0 
5.10   0.2   3.000   2.0    0.0   12.0 
4.95   0.2   3.000   2.0    0.0   13.0 
5.05   0.2   3.000   2.0    0.0   14.0 
5.00   0.2   2.850   2.0    2.0   15.0 
5.00   0.2   3.150   2.0    2.0   16.0 
5.00   0.2   2.925   2.0    2.0   17.0 
5.00   0.2   3.075   2.0    2.0   18.0  

The attribute nominal_set refers to the set of nominal values used to generate the data. The attribute modified_att gives the index of the attribute whose value has been modified. If it is -1, this means that all the values are nominal.

Constructor & Destructor Documentation

◆ TOATSamplingMultiNominal()

URANIE::Sampler::TOATSamplingMultiNominal::TOATSamplingMultiNominal ( URANIE::DataServer::TDataServer *  tds,
TString  mode = "regular",
Int_t  number = 2 
)

Constructor of the OAT sampler.

Parameters
tds(URANIE::DataServer::TDataServer*) Data server containing the attributes.
mode(TString): the sampling mode. It can be either:
  • "regular" (or "reg"): generate regularily spaced values around the nominal value.
  • "lhs": generate random values using the "lhs" sampling method
  • "srs": generate random values using the "srs" sampling method
  • "random" (or "rand"): same as "srs". (Default = "regular").
number(Int_t): the number of values to generate for each nominal value of a given attribute. If _sMode is "regular", number must be even and equal or greater than 2. Otherwise, _nNbModif is set to max(2, number-1).
Exceptions
UErrorExceptionsif "number" is negative or null
UErrorExceptionsif "number" is odd and "mode" is "regular".
UErrorExceptionsif "mode" is unknown.
Deprecated:
This class has been renamed. Please use TOATDesign instead.

Referenced by ClassImp().

◆ ~TOATSamplingMultiNominal()

virtual URANIE::Sampler::TOATSamplingMultiNominal::~TOATSamplingMultiNominal ( )
virtual

Default destructor.

Referenced by ClassImp().

Member Function Documentation

◆ generateSample()

virtual void URANIE::Sampler::TOATSamplingMultiNominal::generateSample ( Option_t *  option = "")
virtual

Generates the sample.

This function creates the OAT sampling data.

Parameters
option(Option_t *): this parameter is not used at the moment. (Default = "").

Implements URANIE::Sampler::TSampler.

Referenced by ClassImp().

◆ getChangingAttList()

virtual TList * URANIE::Sampler::TOATSamplingMultiNominal::getChangingAttList ( )
inlinevirtual

Get the list of changing attributes.

References _changingAttList.

◆ getGenerationMode()

virtual TString URANIE::Sampler::TOATSamplingMultiNominal::getGenerationMode ( )
inlinevirtual

Get random generation method.

References _sGenMode.

◆ getHasData()

virtual Bool_t URANIE::Sampler::TOATSamplingMultiNominal::getHasData ( )
inlinevirtual

Returns TRUE if the internal data server contains data.

References _bHasData.

◆ getNominalValueTuple()

virtual URANIE::DataServer::TDSNtupleD * URANIE::Sampler::TOATSamplingMultiNominal::getNominalValueTuple ( )
inlinevirtual

Get the tuple storing the nominal values of the attributes.

References _nominalValueTuple.

◆ getNumberOfModifications()

virtual Double_t URANIE::Sampler::TOATSamplingMultiNominal::getNumberOfModifications ( )
inlinevirtual

Get the number of modifications per attribute and nominal values.

References _nNbModif.

◆ getRangeInformation()

virtual TMap * URANIE::Sampler::TOATSamplingMultiNominal::getRangeInformation ( )
inlinevirtual

Get the list mapping the names of the changing attributes and their corresponding range information.

References _infoRangeMap.

◆ getSamplingMode()

virtual TString URANIE::Sampler::TOATSamplingMultiNominal::getSamplingMode ( )
inlinevirtual

Get OAT sampling mode.

References _sMode.

◆ init()

virtual void URANIE::Sampler::TOATSamplingMultiNominal::init ( )
protectedvirtual

Initialise the sampling procedure.

This function creates a tuple containing the nominal values of all the attributes of the data server. It also creates two new attributes:

  • nominal_set: tells the user which set of nominal value is used;
  • modified_att: tells which attribute has been modified.
Exceptions
UErrorExceptionsif the original data server is empty and one of its attributes has no default value.

Reimplemented from URANIE::Sampler::TSamplerStochastic.

Referenced by ClassImp().

◆ printLog()

virtual void URANIE::Sampler::TOATSamplingMultiNominal::printLog ( Option_t *  option = "")
virtual

Prints the log.

Prints some internal informations about the object.

Parameters
option(Option_t *): this parameter is not used at the moment. (Default = "").

Reimplemented from URANIE::Sampler::TSamplerStochastic.

Referenced by ClassImp().

◆ setOption()

virtual void URANIE::Sampler::TOATSamplingMultiNominal::setOption ( TString  mode,
Int_t  number 
)
virtual

Set the sampling mode and number of modifications.

This function sets the values of the _sMode and _nNbModif variables.

Parameters
mode(TString): the sampling mode. It can be either:
  • "regular": generate regularily spaced values around the nominal value.
  • "lhs": generate random values using the "lhs" sampling method
  • "srs": generate random values using the "srs" sampling method
  • "random": same as "srs".
number(Int_t): the number of values to generate for each nominal value of a given attribute. If _sMode is "regular", number must be even and equal or greater than 2. Otherwise, _nNbModif is set to max(2, number-1).
Exceptions
UErrorExceptionsif "mode" is unknown.
UErrorExceptionsif "number" is odd and "mode" is "regular".

Referenced by ClassImp().

◆ setRange() [1/2]

void URANIE::Sampler::TOATSamplingMultiNominal::setRange ( TString  changingAttName,
Double_t  rangeValue,
Bool_t  is_percent = kFALSE 
)

Set the range of the sampling for a changing attribute.

This function sets the value of the range inside which the values of the changing attribute will be sampled. If this value is R, and the nominal value is N, the new values will be sampled in the interval [N-R/2; N+R/2]. The range can also be interpreted as a percentage p of the nominal value, in which case R = p * N / 100.

Note
a function setRange must be called for every changing attribute. There is no default range value.
Parameters
changingAttName(TString): name of the changing attribute to sample.
rangeValue(Double_t): the range value, i.e. the width of the interval around the nominal value where the sampling will take place.
is_percent(Bool_t): if True, the rangeValue parameter will be interpreted as a percentage of the nominal value of the changing attribute. (Default = kFALSE).
Exceptions
UErrorExceptionsif no attribute changingAttName is found in the data server.
UErrorExceptionsif the data server is empty and the attribute has no default value.
UErrorExceptionsif range is negative or null.
UErrorExceptionsif mode is random and the attribute isn't a TStochasticAttribute.
UErrorExceptionsif a range was already set for the attribute.

Referenced by ClassImp().

◆ setRange() [2/2]

void URANIE::Sampler::TOATSamplingMultiNominal::setRange ( TString  changingAttName,
TString  rangeAttName,
Bool_t  is_percent = kFALSE 
)

Set the name of the attribute holding the range of the sampling for a changing attribute.

This function associate the name of two attributes of the data server, the first being the changing attribute, the second holding the size of the range of the sampling. In this case, the value of the range will be read directly from the data server or the range attribute's default value.

Note
a function setRange must be called for every changing attribute. There is no default range value.
Parameters
changingAttName(TString): name of the changing attribute to sample.
rangeAttName(TString): name of the attribute holding the range value.
is_percent(Bool_t): if True, the rangeValue parameter will be interpreted as a percentage of the nominal value of the changing attribute. (Default = kFALSE).
Exceptions
UErrorExceptionsif no attribute rangeAttName is found in the data server.
UErrorExceptionsif no attribute changingAttName is found in the data server.
UErrorExceptionsif the data server is empty and the attribute has no default value.
UErrorExceptionsif the data server is empty and the range attribute has no default value.
UErrorExceptionsif the data server is empty and the range attribute's default value is negative or null.
UErrorExceptionsif mode is random and the attribute isn't a TStochasticAttribute.
UErrorExceptionsif a range was already set for the attribute.

◆ terminate()

virtual void URANIE::Sampler::TOATSamplingMultiNominal::terminate ( )
inlineprotectedvirtual

The post-processing step. Nothing is done.

Reimplemented from URANIE::Sampler::TSamplerStochastic.

Referenced by ClassImp().

Member Data Documentation

◆ _bHasData

Bool_t URANIE::Sampler::TOATSamplingMultiNominal::_bHasData
private

Boolean value set to TRUE if the data server _tds contains data.

Referenced by ClassImp(), and getHasData().

◆ _changingAttList

TList URANIE::Sampler::TOATSamplingMultiNominal::_changingAttList
private

List of changing attributes.

Referenced by ClassImp(), and getChangingAttList().

◆ _infoRangeMap

TMap URANIE::Sampler::TOATSamplingMultiNominal::_infoRangeMap
private

A list mapping the names of the changing attributes and their corresponding range information.

Referenced by ClassImp(), and getRangeInformation().

◆ _nNbModif

Int_t URANIE::Sampler::TOATSamplingMultiNominal::_nNbModif
private

Number of modification for each nominal value of each changing attribute.

Referenced by ClassImp(), and getNumberOfModifications().

◆ _nominalValueTuple

URANIE::DataServer::TDSNtupleD* URANIE::Sampler::TOATSamplingMultiNominal::_nominalValueTuple
private

A tuple storing the nominal values of the attributes.

Referenced by ClassImp(), and getNominalValueTuple().

◆ _sGenMode

TString URANIE::Sampler::TOATSamplingMultiNominal::_sGenMode
private

Data generation mode. Only used in the random mode context, can be "lhs", or "srs".

Referenced by ClassImp(), and getGenerationMode().

◆ _sMode

TString URANIE::Sampler::TOATSamplingMultiNominal::_sMode
private

Sampling mode. So far, can be "random" or "regular".

Referenced by ClassImp(), and getSamplingMode().