int DDACEAlgorithmOptions::samplesForCentralComposite(const Problem& problem) { if (!problem.allVariablesAreContinuousOrStaticTransformations()) { LOG(Info,"Problem '" << problem.name() << "' has un-ignorable discrete variables, which " << "means that the central composite algorithm cannot be applied."); return 0; } int n = problem.numContinuousVariables(); return 1 + 2*n + static_cast<int>(std::pow(2.0,n)); }
int DDACEAlgorithmOptions::samplesForBoxBehnken(const Problem& problem) { if (!problem.allVariablesAreContinuousOrStaticTransformations()) { LOG(Info,"Problem '" << problem.name() << "' has un-ignorable discrete variables, which " << "means that the box-behnken algorithm cannot be applied."); return 0; } int n = problem.numContinuousVariables(); return 1 + n * static_cast<int>(std::pow(2.0,n-1)); }
bool DDACEAlgorithmOptions_Impl::setSamplesForGrid(int numGridPartitions,const Problem& problem) { if (algorithmType() != DDACEAlgorithmType::grid) { LOG(Info,"This method only applies to the grid algorithm type, but '" << algorithmType() << "' is selected."); return false; } if (!problem.allVariablesAreContinuousOrStaticTransformations()) { LOG(Info,"Problem '" << problem.name() << "' has un-ignorable discrete variables, which " << "means that the grid algorithm cannot be applied."); return false; } bool result = setSymbols(numGridPartitions); result = result && setSamples(static_cast<int>(std::pow((double)numGridPartitions,problem.numContinuousVariables()))); return result; }
bool DDACEAlgorithm_Impl::isCompatibleProblemType(const Problem& problem) const { DDACEAlgorithmOptions options = ddaceAlgorithmOptions(); // Some types only work for continuous problems. if (!problem.allVariablesAreContinuousOrStaticTransformations()) { switch (options.algorithmType().value()) { case DDACEAlgorithmType::central_composite : case DDACEAlgorithmType::box_behnken : case DDACEAlgorithmType::grid : LOG(Warn,"DDACE Central Composite, Box-Behnken and Grid algorithms only work with continuous " << "variables. (All discrete variables must be down-selected to 0-1 selected " << "perturbations.) DesignOfExperiments can be used to run a grid design on discrete " << "variables."); return false; default : break; } } return true; }