LunacekBiRastriginFunction::LunacekBiRastriginFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          s_(1.0 - 0.5 / (std::sqrt(static_cast<double>(numberOfDimensions_) + 20.0) - 4.1)),
          mu_(std::sqrt(5.25 / s_)),
          parameterConditinong_(getParameterConditioning(10.0)),
          rotationR_(randomRotationMatrix(numberOfDimensions_)),
          rotationQ_(randomRotationMatrix(numberOfDimensions_)) {
      // A vector with all elements randomly and uniformly set to either 2 or -2.
      setParameterScaling(arma::zeros<arma::Col<double>>(numberOfDimensions_) + (std::bernoulli_distribution(0.5)(Rng::getGenerator()) ? 2.0 : -2.0));

#if defined(SUPPORT_MPI)
      MPI_Bcast(rotationR_.memptr(), static_cast<int>(rotationR_.n_elem), MPI_DOUBLE, 0, MPI_COMM_WORLD);
      MPI_Bcast(rotationQ_.memptr(), static_cast<int>(rotationQ_.n_elem), MPI_DOUBLE, 0, MPI_COMM_WORLD);
#endif

      setObjectiveFunction(
          [this](
              const arma::Col<double>& parameter_) {
            assert(parameter_.n_elem == numberOfDimensions_);
              
            return std::min(std::pow(arma::norm(parameter_ - 2.5), 2.0), static_cast<double>(numberOfDimensions_) + s_ * std::pow(arma::norm(parameter_ + mu_), 2.0)) + 10.0 * (static_cast<double>(numberOfDimensions_) - arma::accu(arma::cos(2.0 * arma::datum::pi * rotationQ_ * (parameterConditinong_ % (rotationR_ * (parameter_ - 2.5))))));
          },
          "BBOB Lunacek bi-Rastrigin Function (f24)");
    }
示例#2
0
 SchwefelFunction::SchwefelFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions),
       parameterConditioning_(getParameterConditioning(std::sqrt(10.0))) {
   // A vector with all elements randomly and uniformly set to either 2 or -2.
   setParameterScaling(arma::zeros<arma::Col<double>>(numberOfDimensions_) + (std::bernoulli_distribution(0.5)(Rng::getGenerator()) ? 2.0 : -2.0));
 }
 LunacekBiRastriginFunction::LunacekBiRastriginFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions),
       s_(1.0 - 0.5 / (std::sqrt(static_cast<double>(numberOfDimensions_) + 20.0) - 4.1)),
       mu_(std::sqrt(5.25 / s_)),
       parameterConditinong_(getParameterConditioning(10.0)) {
   // A vector with all elements randomly and uniformly set to either 2 or -2.
   setParameterScaling(arma::zeros<arma::Col<double>>(numberOfDimensions_) + (std::bernoulli_distribution(0.5)(Rng::getGenerator()) ? 2.0 : -2.0));
   setRotationR(getRandomRotationMatrix(numberOfDimensions_));
   setRotationQ(getRandomRotationMatrix(numberOfDimensions_));
 }
 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());
 }
示例#5
0
    SchwefelFunction::SchwefelFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(10.0))) {
      // A vector with all elements randomly and uniformly set to either 2 or -2.
      setParameterScaling(arma::zeros<arma::Col<double>>(numberOfDimensions_) + (std::bernoulli_distribution(0.5)(Rng::getGenerator()) ? 2.0 : -2.0));

      setObjectiveFunction(
          [this](
              const arma::Col<double>& parameter_) {
            assert(parameter_.n_elem == numberOfDimensions_);
              
            arma::Col<double> s = parameter_;
            s.tail(s.n_elem - 1) += 0.25 * (s.head(s.n_elem - 1) - 4.2096874633);

            const arma::Col<double>& z = 100.0 * (parameterConditioning_ % (s - 4.2096874633) + 4.2096874633);

            return 0.01 * (418.9828872724339 - arma::dot(z, arma::sin(arma::sqrt(arma::abs(z)))) / static_cast<double>(numberOfDimensions_)) + 100.0 * getBoundaryPenalty(z / 100.0);
          },
          "BBOB Schwefel Function (f20)");
    }