本文整理汇总了C++中arma::Col::load方法的典型用法代码示例。如果您正苦于以下问题:C++ Col::load方法的具体用法?C++ Col::load怎么用?C++ Col::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arma::Col
的用法示例。
在下文中一共展示了Col::load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: weierstrassFunction
TestWeierstrassFunction weierstrassFunction(40);
SECTION(".getObjectiveValueImplementation") {
SECTION("Returns the objective value") {
arma::Mat<double> rotationR;
REQUIRE(rotationR.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_1.input"));
weierstrassFunction.setRotationR(rotationR);
arma::Mat<double> rotationQ;
REQUIRE(rotationQ.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_2.input"));
weierstrassFunction.setRotationQ(rotationQ);
arma::Mat<double> parameters;
REQUIRE(parameters.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_parameters_40x100.input"));
arma::Col<double> expectedObjectiveValues;
REQUIRE(expectedObjectiveValues.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/bbob_weierstrassFunction_dim40_1x100.expected"));
for (arma::uword n = 0; n < parameters.n_cols; ++n) {
CHECK(weierstrassFunction.getObjectiveValueImplementation(parameters.col(n)) == Approx(expectedObjectiveValues(n)));
}
}
}
SECTION(".toString") {
SECTION("Returns a (filesystem friendly) name for the class.") {
CHECK(weierstrassFunction.toString() == "bbob_weierstrass_function");
}
}
}
示例2: optimisationProblem
SCENARIO("bbob::WeierstrassFunction.objectiveFunction_", "[bbob::WeierstrassFunction][bbob::WeierstrassFunction.objectiveFunction_]") {
GIVEN("Some parameters") {
// All expected objective values where generated for a 40-dimensional problem instance.
const arma::uword numberOfDimensions = 40;
CAPTURE(numberOfDimensions);
TestWeierstrassFunction optimisationProblem(numberOfDimensions);
REQUIRE(optimisationProblem.rotationR_.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_1.input"));
REQUIRE(optimisationProblem.rotationQ_.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_2.input"));
arma::Mat<double> parameters;
REQUIRE(parameters.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_parameters_40x100.input"));
THEN("Return their objective value") {
arma::Col<double> expectedObjectiveValues;
REQUIRE(expectedObjectiveValues.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/weierstrassFunction_dim40_1x100.expected"));
for (arma::uword n = 0; n < parameters.n_cols; ++n) {
CHECK(optimisationProblem.objectiveFunction_(parameters.col(n)) == Approx(expectedObjectiveValues(n)));
}
}
}
}
SCENARIO("bbob::WeierstrassFunction.getNormalisedObjectiveValue", "[bbob::WeierstrassFunction][bbob::WeierstrassFunction.getNormalisedObjectiveValue]") {
GIVEN("A parameter") {
const arma::uword numberOfDimensions = SYNCHRONISED(1 + discreteRandomNumber());
CAPTURE(numberOfDimensions);
const arma::Col<double>& parameter = arma::normalise(continuousRandomNumbers(numberOfDimensions));
CAPTURE(parameter);
示例3: GIVEN
SCENARIO("bbob::SchaffersF7FunctionIllConditioned.objectiveFunction_", "[bbob::SchaffersF7FunctionIllConditioned][bbob::SchaffersF7FunctionIllConditioned.objectiveFunction_]") {
GIVEN("Some parameters") {
// All expected objective values where generated for a 40-dimensional problem instance.
const arma::uword numberOfDimensions = 40;
CAPTURE(numberOfDimensions);
TestSchaffersF7FunctionIllConditioned optimisationProblem(numberOfDimensions);
REQUIRE(optimisationProblem.rotationQ_.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_2.input"));
arma::Mat<double> parameters;
REQUIRE(parameters.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_parameters_40x100.input"));
THEN("Return their objective value") {
arma::Col<double> expectedObjectiveValues;
REQUIRE(expectedObjectiveValues.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/schaffersF7FunctionIllConditioned_dim40_1x100.expected"));
for (arma::uword n = 0; n < parameters.n_cols; ++n) {
CHECK(optimisationProblem.objectiveFunction_(parameters.col(n)) == Approx(expectedObjectiveValues(n)));
}
}
}
}
SCENARIO("bbob::SchaffersF7FunctionIllConditioned.getNormalisedObjectiveValue", "[bbob::SchaffersF7FunctionIllConditioned][bbob::SchaffersF7FunctionIllConditioned.getNormalisedObjectiveValue]") {
GIVEN("A parameter") {
const arma::uword numberOfDimensions = SYNCHRONISED(1 + discreteRandomNumber());
CAPTURE(numberOfDimensions);
const arma::Col<double>& parameter = arma::normalise(continuousRandomNumbers(numberOfDimensions));
CAPTURE(parameter);
示例4: GIVEN
GIVEN("Some parameters") {
// All expected objective values where generated for a 40-dimensional problem instance.
const arma::uword numberOfDimensions = 40;
CAPTURE(numberOfDimensions);
TestGallaghersGaussian101mePeaksFunction optimisationProblem(numberOfDimensions);
REQUIRE(optimisationProblem.rotationQ_.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_1.input"));
REQUIRE(optimisationProblem.localParameterConditionings_.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_localParameterConditionings_40x101.input"));
REQUIRE(optimisationProblem.localParameterTranslations_.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_localParameterTranslations_40x101.input"));
arma::Mat<double> parameters;
REQUIRE(parameters.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_parameters_40x100.input"));
THEN("Return their objective value") {
arma::Col<double> expectedObjectiveValues;
REQUIRE(expectedObjectiveValues.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/gallaghersGaussian101mePeaksFunction_dim40_1x100.expected"));
for (arma::uword n = 0; n < parameters.n_cols; ++n) {
CHECK(optimisationProblem.objectiveFunction_(parameters.col(n)) == Approx(expectedObjectiveValues(n)));
}
}
}
}
SCENARIO("bbob::GallaghersGaussian101mePeaksFunction.getNormalisedObjectiveValue", "[bbob::GallaghersGaussian101mePeaksFunction][bbob::GallaghersGaussian101mePeaksFunction.getNormalisedObjectiveValue]") {
GIVEN("A parameter") {
const arma::uword numberOfDimensions = SYNCHRONISED(1 + discreteRandomNumber());
CAPTURE(numberOfDimensions);
const arma::Col<double>& parameter = arma::normalise(continuousRandomNumbers(numberOfDimensions));
CAPTURE(parameter);
示例5: optimisationProblem
using mant::bbob::RosenbrockFunctionRotated::objectiveFunction_;
};
SCENARIO("bbob::RosenbrockFunctionRotated.objectiveFunction_", "[bbob::RosenbrockFunctionRotated][bbob::RosenbrockFunctionRotated.objectiveFunction_]") {
GIVEN("Some parameters") {
// All expected objective values where generated for a 40-dimensional problem instance.
const arma::uword numberOfDimensions = 40;
CAPTURE(numberOfDimensions);
TestRosenbrockFunctionRotated optimisationProblem(numberOfDimensions);
arma::Mat<double> parameters;
REQUIRE(parameters.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/_parameters_40x100.input"));
THEN("Return their objective value") {
arma::Col<double> expectedObjectiveValues;
REQUIRE(expectedObjectiveValues.load(::rootTestDataDirectory + "/optimisationProblem/benchmarkOptimisationProblem/blackBoxOptimisationBenchmark/rosenbrockFunctionRotated_dim40_1x100.expected"));
for (arma::uword n = 0; n < parameters.n_cols; ++n) {
CHECK(optimisationProblem.objectiveFunction_(parameters.col(n)) == Approx(expectedObjectiveValues(n)));
}
}
}
}
SCENARIO("bbob::RosenbrockFunctionRotated.getNormalisedObjectiveValue", "[bbob::RosenbrockFunctionRotated][bbob::RosenbrockFunctionRotated.getNormalisedObjectiveValue]") {
GIVEN("A parameter") {
const arma::uword numberOfDimensions = SYNCHRONISED(1 + discreteRandomNumber());
CAPTURE(numberOfDimensions);
const arma::Col<double>& parameter = arma::normalise(continuousRandomNumbers(numberOfDimensions));
CAPTURE(parameter);
示例6: SECTION
SECTION(".getObjectiveValueImplementation") {
SECTION("Returns the objective value") {
arma::Mat<double> rotationR;
REQUIRE(rotationR.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_1.input"));
lunacekBiRastriginFunction.setRotationR(rotationR);
arma::Mat<double> rotationQ;
REQUIRE(rotationQ.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_rotationMatrix_40x40_2.input"));
lunacekBiRastriginFunction.setRotationQ(rotationQ);
arma::Mat<double> parameters;
REQUIRE(parameters.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/_parameters_40x100.input"));
arma::Col<double> expectedObjectiveValues;
REQUIRE(expectedObjectiveValues.load(testDirectory + "/data/optimisationProblem/blackBoxOptimisationBenchmark/bbob_lunacekBiRastriginFunction_dim40_1x100.expected"));
for (arma::uword n = 0; n < parameters.n_cols; ++n) {
CHECK(lunacekBiRastriginFunction.getObjectiveValueImplementation(parameters.col(n)) == Approx(expectedObjectiveValues(n)));
}
}
}
SECTION(".toString") {
SECTION("Returns a (filesystem friendly) name for the class.") {
CHECK(lunacekBiRastriginFunction.toString() =="bbob_lunacek_bi_rastrigin_function");
}
}
}