BlackBoxOptimisationBenchmark::BlackBoxOptimisationBenchmark( const arma::uword numberOfDimensions) : OptimisationProblem(numberOfDimensions) { // A vector with all elements set to -5. setLowerBounds(arma::zeros<arma::Col<double>>(numberOfDimensions_) - 5.0); // A vector with all elements set to 5. setUpperBounds(arma::zeros<arma::Col<double>>(numberOfDimensions_) + 5.0); // The objective value translation is randomly chosen from a Cauchy distribution with an approximate 50% chance to be within [-100, 100], rounded up to 2 decimal places. // The translation is further bounded between -1000 and 1000. setObjectiveValueTranslation(std::min(1000.0, std::max(-1000.0, std::floor(std::cauchy_distribution<double>(0.0, 100.0)(Rng::getGenerator()) * 100.0) / 100.0))); setAcceptableObjectiveValue(objectiveValueTranslation_ + 1.0e-8); }
OptimisationProblem<T>::OptimisationProblem( const std::size_t numberOfDimensions) noexcept : numberOfDimensions_(numberOfDimensions) { reset(); // A vector with all elements set to the lowest representable value. setLowerBounds(arma::zeros<arma::Col<T>>(numberOfDimensions_) - std::numeric_limits<T>::max()); // A vector with all elements set to the largest representable value. setUpperBounds(arma::zeros<arma::Col<T>>(numberOfDimensions_) + std::numeric_limits<T>::max()); // (0, ..., numberOfDimensions - 1) setParameterPermutation(arma::linspace<arma::Col<unsigned int>>(0, numberOfDimensions_ - 1, numberOfDimensions)); setParameterScaling(arma::ones<arma::Col<T>>(numberOfDimensions_)); setParameterTranslation(arma::zeros<arma::Col<T>>(numberOfDimensions_)); setParameterRotation(arma::eye<arma::Mat<T>>(numberOfDimensions_, numberOfDimensions_)); setObjectiveValueScaling(1.0); setObjectiveValueTranslation(0.0); setAcceptableObjectiveValue(std::numeric_limits<double>::lowest()); }
VariableSettings::VariableSettings( const VariableSettings& rhs ) { uint i; dim = rhs.dim; type = rhs.type; if ( rhs.names != 0 ) { names = (char**) calloc( dim,sizeof(char*) ); for( i=0; i<dim; ++i ) { names[i] = new char[MAX_LENGTH_NAME+1]; setName( i,rhs.names[i] ); } } else { names = 0; } if ( rhs.units != 0 ) { units = (char**) calloc( dim,sizeof(char*) ); for( i=0; i<dim; ++i ) { units[i] = new char[MAX_LENGTH_NAME+1]; setUnit( i,rhs.units[i] ); } } else { units = 0; } if ( rhs.scaling.isEmpty( ) == BT_FALSE ) { scaling.init( dim ); setScaling( rhs.scaling ); } else { scaling.init( ); } if ( rhs.lb.isEmpty( ) == BT_FALSE ) { lb.init( dim ); setLowerBounds( rhs.lb ); } else { lb.init( ); } if ( rhs.ub.isEmpty( ) == BT_FALSE ) { ub.init( dim ); setUpperBounds( rhs.ub ); } else { ub.init( ); } autoInit = rhs.autoInit; }