Exemplo n.º 1
0
    BuecheRastriginFunction::BuecheRastriginFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(10.0))) {
      if (numberOfDimensions_ < 2) {
        throw std::domain_error("BuecheRastriginFunction: The number of dimensions must be greater than 1.");
      } else if (!isRepresentableAsFloatingPoint(numberOfDimensions_)) {
        throw std::overflow_error("BuecheRastriginFunction: The number of elements must be representable as a floating point.");
      }

      arma::vec parameterTranslation = getRandomParameterTranslation();
      for (arma::uword n = 0; n < parameterTranslation.n_elem; n += 2) {
        parameterTranslation(n) = std::abs(parameterTranslation(n));
      }
      setParameterTranslation(parameterTranslation);

      setObjectiveFunctions({{[this](
                                  const arma::vec& parameter_) {
                                assert(parameter_.n_elem == numberOfDimensions_);

                                arma::vec z = parameterConditioning_ % getOscillatedParameter(parameter_);
                                for (arma::uword n = 0; n < z.n_elem; n += 2) {
                                  if (z(n) > 0.0) {
                                    z(n) *= 10.0;
                                  }
                                }

                                return 10.0 * (static_cast<double>(numberOfDimensions_) - arma::accu(arma::cos(2.0 * arma::datum::pi * z))) + std::pow(arma::norm(z), 2.0);
                              },
          "BBOB Büche-Rastrigin Function (f4)"}});
    }
Exemplo n.º 2
0
    WeierstrassFunction::WeierstrassFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(0.01))),
          rotationR_(randomRotationMatrix(numberOfDimensions_)),
          rotationQ_(randomRotationMatrix(numberOfDimensions_)) {
      setParameterTranslation(getRandomParameterTranslation());

#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_);
              
            const arma::Col<double>& z = rotationR_ * (parameterConditioning_ % (rotationQ_ * getOscillatedParameter(rotationR_ * parameter_)));

            double sum = 0.0;
            for (arma::uword n = 0; n < z.n_elem; ++n) {
              for (arma::uword k = 0; k < 12; ++k) {
                sum += std::pow(0.5, k) * std::cos(2.0 * arma::datum::pi * std::pow(3.0, k) * (z(n) + 0.5));
              }
            }

            return 10.0 * std::pow(sum / static_cast<double>(numberOfDimensions_) +1.99951171875, 3.0);
          },
          "BBOB Weierstrass Function (f16)");
    }
Exemplo n.º 3
0
 KatsuuraFunction::KatsuuraFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions),
       parameterConditioning_(getParameterConditioning(10.0)) {
   setParameterTranslation(getRandomParameterTranslation());
   setParameterRotation(getRandomRotationMatrix(numberOfDimensions_));
   setRotationQ(getRandomRotationMatrix(numberOfDimensions_));
 }
Exemplo n.º 4
0
 AttractiveSectorFunction::AttractiveSectorFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions),
       parameterConditioning_(getParameterConditioning(std::sqrt(10.0))) {
   setParameterTranslation(getRandomParameterTranslation());
   setParameterRotation(getRandomRotationMatrix(numberOfDimensions_));
   setRotationQ(getRandomRotationMatrix(numberOfDimensions_));
 }
Exemplo n.º 5
0
 StepEllipsoidalFunction::StepEllipsoidalFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions),
       firstParameterConditioning_(getParameterConditioning(std::sqrt(10.0))),
       secondParameterConditioning_(getParameterConditioning(100.0)) {
   setParameterTranslation(getRandomParameterTranslation());
   setParameterRotation(getRandomRotationMatrix(numberOfDimensions_));
   setRotationQ(getRandomRotationMatrix(numberOfDimensions_));
 }
Exemplo n.º 6
0
 WeierstrassFunction::WeierstrassFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions),
       f0_(-1.99951171875),
       parameterConditioning_(getParameterConditioning(std::sqrt(0.01))) {
   setParameterTranslation(getRandomParameterTranslation());
   setRotationR(getRandomRotationMatrix(numberOfDimensions_));
   setRotationQ(getRandomRotationMatrix(numberOfDimensions_));
 }
Exemplo n.º 7
0
    DifferentPowersFunction::DifferentPowersFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions) {
      setParameterTranslation(getRandomParameterTranslation());
      setParameterRotation(randomRotationMatrix(numberOfDimensions_));

      setObjectiveFunction(
          [this](
              const arma::Col<double>& parameter_) {
            assert(parameter_.n_elem == numberOfDimensions_);
              
            const arma::Col<double>& z = arma::abs(parameter_);
            return arma::norm(z % getConditionedParameter(arma::square(z)));
          },
          "BBOB Different Powers Function (f14)");
    }
Exemplo n.º 8
0
    EllipsoidalFunction::EllipsoidalFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(1000000.0)) {
      if (numberOfDimensions_ < 2) {
        throw std::domain_error("EllipsoidalFunction: The number of dimensions must be greater than 1.");
      }

      setParameterTranslation(getRandomParameterTranslation());

      setObjectiveFunctions({{[this](
                                  const arma::vec& parameter_) {
                                assert(parameter_.n_elem == numberOfDimensions_);

                                return arma::dot(parameterConditioning_, arma::square(getOscillatedParameter(parameter_)));
                              },
          "BBOB Ellipsoidal Function (f2)"}});
    }
Exemplo n.º 9
0
    RosenbrockFunction::RosenbrockFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          max_(std::max(1.0, std::sqrt(numberOfDimensions_) / 8.0)) {
      if (numberOfDimensions_ < 2) {
        throw std::domain_error("RosenbrockFunction: The number of dimensions must be greater than 1.");
      }

      setParameterTranslation(0.75 * getRandomParameterTranslation());

      setObjectiveFunctions({{[this](
                                  const arma::vec& parameter_) {
                                assert(parameter_.n_elem == numberOfDimensions_);

                                const arma::vec& z = max_ * parameter_ + 1.0;
                                return 100.0 * std::pow(arma::norm(arma::square(z.head(z.n_elem - 1)) - z.tail(z.n_elem - 1)), 2.0) + std::pow(arma::norm(z.head(z.n_elem - 1) - 1.0), 2.0);
                              },
          "BBOB Rosenbrock Function (f8)"}});
    }
Exemplo n.º 10
0
    RastriginFunction::RastriginFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(10.0))) {
      if (numberOfDimensions_ < 2) {
        throw std::domain_error("RastriginFunction: The number of dimensions must be greater than 1.");
      } else if (!isRepresentableAsFloatingPoint(numberOfDimensions_)) {
        throw std::overflow_error("RastriginFunction: The number of elements must be representable as a floating point.");
      }

      setParameterTranslation(getRandomParameterTranslation());

      setObjectiveFunctions({{[this](
                                  const arma::vec& parameter_) {
                                assert(parameter_.n_elem == numberOfDimensions_);

                                const arma::vec& z = parameterConditioning_ % getAsymmetricParameter(0.2, getOscillatedParameter(parameter_));
                                return 10.0 * (static_cast<double>(numberOfDimensions_) - arma::accu(arma::cos(2.0 * arma::datum::pi * z))) + std::pow(arma::norm(z), 2.0);
                              },
          "BBOB Rastrigin Function (f3)"}});
    }
Exemplo n.º 11
0
    SharpRidgeFunction::SharpRidgeFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(10.0))),
          rotationQ_(synchronise(randomRotationMatrix(numberOfDimensions_))) {
      if (numberOfDimensions_ < 2) {
        throw std::domain_error("SharpRidgeFunction: The number of dimensions must be greater than 1.");
      }

      setParameterTranslation(getRandomParameterTranslation());
      setParameterRotation(randomRotationMatrix(numberOfDimensions_));

      setObjectiveFunctions({{[this](
                                  const arma::vec& parameter_) {
                                assert(parameter_.n_elem == numberOfDimensions_);

                                const arma::vec& z = rotationQ_ * (parameterConditioning_ % parameter_);
                                return std::pow(z(0), 2.0) + 100.0 * arma::norm(z.tail(z.n_elem - 1));
                              },
          "BBOB Sharp Ridge Function (f13)"}});
    }
Exemplo n.º 12
0
    SharpRidgeFunction::SharpRidgeFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(10.0))),
          rotationQ_(randomRotationMatrix(numberOfDimensions_)) {
      setParameterTranslation(getRandomParameterTranslation());
      setParameterRotation(randomRotationMatrix(numberOfDimensions_));

#if defined(SUPPORT_MPI)
      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_);
              
            const arma::Col<double>& z = rotationQ_ * (parameterConditioning_ % parameter_);
            return std::pow(z(0), 2.0) + 100.0 * arma::norm(z.tail(z.n_elem - 1));
          },
          "BBOB Sharp Ridge Function (f13)");
    }
Exemplo n.º 13
0
    AttractiveSectorFunction::AttractiveSectorFunction(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(10.0))),
          rotationQ_(synchronise(randomRotationMatrix(numberOfDimensions_))) {
      if (numberOfDimensions_ < 2) {
        throw std::domain_error("AttractiveSectorFunction: The number of dimensions must be greater than 1.");
      }

      setParameterTranslation(getRandomParameterTranslation());
      setParameterRotation(randomRotationMatrix(numberOfDimensions_));

      setObjectiveFunctions({{[this](
                                  const arma::vec& parameter_) {
                                assert(parameter_.n_elem == numberOfDimensions_);

                                arma::vec z = rotationQ_ * (parameterConditioning_ % parameter_);
                                z.elem(arma::find(z % parameterTranslation_ > 0.0)) *= 100.0;

                                return std::pow(getOscillatedValue(std::pow(arma::norm(z), 2.0)), 0.9);
                              },
          "BBOB Attractive Sector Function (f6)"}});
    }
Exemplo n.º 14
0
    SchaffersF7Function::SchaffersF7Function(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(10.0))),
          rotationQ_(synchronise(randomRotationMatrix(numberOfDimensions_))) {
      if (numberOfDimensions_ < 2) {
        throw std::domain_error("SchaffersF7Function: The number of dimensions must be greater than 1.");
      }

      setParameterTranslation(getRandomParameterTranslation());
      setParameterRotation(randomRotationMatrix(numberOfDimensions_));

      setObjectiveFunctions({{[this](
                                  const arma::vec& parameter_) {
                                assert(parameter_.n_elem == numberOfDimensions_);

                                const arma::vec& s = arma::square(parameterConditioning_ % (rotationQ_ * getAsymmetricParameter(0.5, parameter_)));
                                const arma::vec& z = arma::pow(s.head(s.n_elem - 1) + s.tail(s.n_elem - 1), 0.25);

                                return std::pow(arma::mean(z % (1.0 + arma::square(arma::sin(50.0 * arma::pow(z, 0.4))))), 2.0);
                              },
          "BBOB Schaffers F7 Function (f17)"}});
    }
    SchaffersF7FunctionIllConditioned::SchaffersF7FunctionIllConditioned(
        const arma::uword numberOfDimensions)
        : BlackBoxOptimisationBenchmark(numberOfDimensions),
          parameterConditioning_(getParameterConditioning(std::sqrt(1000.0))),
          rotationQ_(randomRotationMatrix(numberOfDimensions_)) {
      setParameterTranslation(getRandomParameterTranslation());
      setParameterRotation(randomRotationMatrix(numberOfDimensions_));

#if defined(SUPPORT_MPI)
      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_);
              
            const arma::Col<double>& s = arma::square(parameterConditioning_ % (rotationQ_ * getAsymmetricParameter(0.5, parameter_)));
            const arma::Col<double>& z = arma::pow(s.head(s.n_elem - 1) + s.tail(s.n_elem - 1), 0.25);

            return std::pow(arma::mean(z % (1.0 + arma::square(arma::sin(50.0 * arma::pow(z, 0.4))))), 2.0);
          },
          "BBOB Schaffers F7 Function, ill-conditioned (f18)");
    }
Exemplo n.º 16
0
 RosenbrockFunction::RosenbrockFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions),
       max_(std::max(1.0, std::sqrt(numberOfDimensions_) / 8.0)) {
   setParameterTranslation(0.75 * getRandomParameterTranslation());
 }
Exemplo n.º 17
0
 SphereFunction::SphereFunction(
     const arma::uword numberOfDimensions)
     : BlackBoxOptimisationBenchmark(numberOfDimensions) {
   setParameterTranslation(getRandomParameterTranslation());
 }