36 #include <unordered_map>
54 "The \"SAMPLING\" statement defines methods used for the optimizer in sample mode.")
58 (
"TYPE",
"Distribution type.",
64 "RANDOM_SEQUENCE_UNIFORM_INT",
65 "RANDOM_SEQUENCE_UNIFORM"});
68 (
"VARIABLE",
"Name of design variable");
71 (
"SEED",
"seed for random sampling");
74 (
"FNAME",
"File to read from the sampling points");
77 (
"N",
"Number of sampling points", 1);
80 (
"RANDOM",
"Whether sequence should be sampled randomly (default: false)",
false);
83 (
"STEP",
"Increment for randomized sequences (default: 1)", 1.0);
107 if (sampling ==
nullptr) {
109 "OpalSample \"" + name +
"\" not found.");
116 double lower,
double upper,
117 size_t modulo,
bool ) {
119 if ( lower >= upper ) {
121 "Lower bound >= upper bound.");
124 static const std::unordered_map<std::string, OpalSampleMethod> stringOpalSampleMethod_s = {
136 "The attribute \"TYPE\" isn't set for the \"SAMPLING\" statement");
157 "The sampling method \"TYPE=" + type +
"\" is not supported out of random sampling mode");
225 "Invalid \"TYPE\" for the \"SAMPLING\" statement");
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
static OpalData * getInstance()
unsigned int getSize() const
int seed
The current random seed.
std::string getString(const Attribute &attr)
Get string value.
virtual OpalSample * clone(const std::string &name)
Make clone.
std::shared_ptr< SamplingMethod > sampleMethod_m
std::string getVariable() const
bool getBool(const Attribute &attr)
Return logical value.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
double FromFile(std::string file, const std::vector< double > &referencePoint)
void initialize(const std::string &dvarName, double lower, double upper, size_t modulo=1, bool sequence=false)
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
The base class for all OPAL exceptions.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
static OpalSample * find(const std::string &name)
Find sampling method.
std::vector< Attribute > itsAttr
The object attributes.
double getReal(const Attribute &attr)
Return real value.
OpalSample()
Exemplar constructor.
The base class for all OPAL definitions.
Object * find(const std::string &name)
Find entry.
virtual void execute()
Check the OpalSample data.