This example shows how to instantiate an CBCSearch task to search for the best merit using a CBC algorithm.
This example shows how to instantiate an CBCSearch task to search for the best merit using a CBC algorithm.
#include <iostream>
#include <memory>
#include "netbuilder/FigureOfMerit/WeightedFigureOfMerit.h"
#include "netbuilder/FigureOfMerit/TValueProjMerit.h"
#include "netbuilder/Task/CBCSearch.h"
#include "netbuilder/Task/FullCBCExplorer.h"
#include "netbuilder/Task/RandomCBCExplorer.h"
#include "netbuilder/Task/MixedCBCExplorer.h"
#include "latticetester/ProductWeights.h"
int main(int argc, char** argv)
{
SET_PATH_TO_LATNETBUILDER_FOR_EXAMPLES();
{
auto weights = std::make_unique<LatticeTester::ProductWeights>(.7);
auto projDepMerit = std::make_unique<TValueProjMerit<EmbeddingType::UNILEVEL>>(3);
auto figure = std::make_unique<WeightedFigureOfMerit<TValueProjMerit<EmbeddingType::UNILEVEL>>>(std::numeric_limits<Real>::infinity(), std::move(weights), std::move(projDepMerit));
auto explorer = std::make_unique<FullCBCExplorer<NetConstruction::POLYNOMIAL, EmbeddingType::UNILEVEL>>(s, size);
auto task = std::make_unique<CBCSearch<NetConstruction::POLYNOMIAL, EmbeddingType::UNILEVEL, FullCBCExplorer>>(s, size, std::move(figure), std::move(explorer));
std::cout << task->format();
task->execute();
std::cout << "Best net:" << std::endl;
std::cout << task->bestNet().format() << std::endl;
std::cout << "Merit value: " << task->bestMeritValue() << std::endl;
std::cout << "============================================================" << std::endl;
}
{
auto weights = std::make_unique<LatticeTester::ProductWeights>(.7);
auto projDepMerit = std::make_unique<TValueProjMerit<EmbeddingType::UNILEVEL>>(3);
auto figure = std::make_unique<WeightedFigureOfMerit<TValueProjMerit<EmbeddingType::UNILEVEL>>>(std::numeric_limits<Real>::infinity(), std::move(weights), std::move(projDepMerit));
auto explorer = std::make_unique<RandomCBCExplorer<NetConstruction::POLYNOMIAL, EmbeddingType::UNILEVEL>>(s, size, 70);
auto task = std::make_unique<CBCSearch<NetConstruction::POLYNOMIAL, EmbeddingType::UNILEVEL, RandomCBCExplorer>>(s, size, std::move(figure), std::move(explorer));
std::cout << task->format();
task->execute();
std::cout << "Best net:" << std::endl;
std::cout << task->bestNet().format() << std::endl;
std::cout << "Merit value: " << task->bestMeritValue() << std::endl;
std::cout << "============================================================" << std::endl;
}
{
auto weights = std::make_unique<LatticeTester::ProductWeights>(.7);
auto projDepMerit = std::make_unique<TValueProjMerit<EmbeddingType::UNILEVEL>>(3);
auto figure = std::make_unique<WeightedFigureOfMerit<TValueProjMerit<EmbeddingType::UNILEVEL>>>(std::numeric_limits<Real>::infinity(), std::move(weights), std::move(projDepMerit));
auto explorer = std::make_unique<MixedCBCExplorer<NetConstruction::POLYNOMIAL, EmbeddingType::UNILEVEL>>(s, size, 3, 70);
auto task = std::make_unique<CBCSearch<NetConstruction::POLYNOMIAL, EmbeddingType::UNILEVEL, MixedCBCExplorer>>(s, size, std::move(figure), std::move(explorer));
std::cout << task->format();
task->execute();
std::cout << "Best net:" << std::endl;
std::cout << task->bestNet().format() << std::endl;
std::cout << "Merit value: " << task->bestMeritValue() << std::endl;
}
}
This file contains the base classes for digital nets in base 2.
This file contains a global variable PATH_TO_LATNETBUILDER_DIR which should always equal the path to ...
Tools for streaming and poor man's factorization.
Basic type definitions of NetBuilder.
Polynomial PolynomialFromInt(uInteger x)
convert Integer to polynomial
Standard tasks that can be performed by LatBuilder.
Definition libtut_net.dox:202
NetBuilder namespace.
Definition libtut_net.dox:17
size_t Dimension
Scalar integer type for dimension.
Definition Types.h:52
Digital net construction traits.
Definition NetConstructionTraits.h:77