19#ifndef FPLLL_ENUMERATE_H
20#define FPLLL_ENUMERATE_H
35 const vector<int> &max_indices = vector<int>())
36 : _gso(gso), _evaluator(evaluator)
42 void enumerate(
int first,
int last, FT &fmaxdist,
long fmaxdistexpo,
43 const vector<FT> &target_coord = vector<FT>(),
44 const vector<enumxt> &subtree = vector<enumxt>(),
45 const vector<enumf> &pruning = vector<enumf>(),
bool dual =
false,
46 bool subtree_reset =
false);
48 inline uint64_t
get_nodes(
const int level = -1)
const
52 return std::accumulate(
nodes.cbegin(),
nodes.cend(), 0);
64 vector<enumf> pruning_bounds;
68 void prepare_enumeration(
const vector<enumxt> &subtree,
bool solvingsvp,
bool subtree_reset);
73 void reset(
enumf cur_dist,
int cur_depth);
74 virtual void process_solution(
enumf newmaxdist);
75 virtual void process_subsolution(
int offset,
enumf newdist);
82 const vector<int> &max_indices = vector<int>())
83 : _gso(gso), _evaluator(evaluator), _max_indices(max_indices), enumdyn(nullptr), _nodes{}
87 void enumerate(
int first,
int last, FT &fmaxdist,
long fmaxdistexpo,
88 const vector<FT> &target_coord = vector<FT>(),
89 const vector<enumxt> &subtree = vector<enumxt>(),
90 const vector<enumf> &pruning = vector<enumf>(),
bool dual =
false,
91 bool subtree_reset =
false)
96 if (enumext.get() ==
nullptr)
98 if (enumext->enumerate(first, last, fmaxdist, fmaxdistexpo, pruning,
dual))
100 _nodes = enumext->get_nodes_array();
106 if (enumdyn.get() ==
nullptr)
108 enumdyn->enumerate(first, last, fmaxdist, fmaxdistexpo, target_coord, subtree, pruning,
dual,
110 _nodes = enumdyn->get_nodes_array();
116 return std::accumulate(_nodes.begin(), _nodes.end(), 0);
117 return _nodes[level];
120 inline array<uint64_t, FPLLL_EXTENUM_MAX_EXTENUM_DIM>
get_nodes_array()
const {
return _nodes; }
125 vector<int> _max_indices;
126 std::unique_ptr<EnumerationDyn<ZT, FT>> enumdyn;
127 std::unique_ptr<ExternalEnumeration<ZT, FT>> enumext;
128 array<uint64_t, FPLLL_EXTENUM_MAX_EXTENUM_DIM> _nodes;
Definition: enumerate_base.h:57
array< uint64_t, FPLLL_EXTENUM_MAX_EXTENUM_DIM > nodes
Definition: enumerate_base.h:101
vector< int > _max_indices
Definition: enumerate_base.h:94
Definition: enumerate.h:32
void enumerate(int first, int last, FT &fmaxdist, long fmaxdistexpo, const vector< FT > &target_coord=vector< FT >(), const vector< enumxt > &subtree=vector< enumxt >(), const vector< enumf > &pruning=vector< enumf >(), bool dual=false, bool subtree_reset=false)
Definition: enumerate.cpp:59
array< uint64_t, FPLLL_EXTENUM_MAX_EXTENUM_DIM > get_nodes_array()
Definition: enumerate.h:57
EnumerationDyn(MatGSOInterface< ZT, FT > &gso, Evaluator< FT > &evaluator, const vector< int > &max_indices=vector< int >())
Definition: enumerate.h:34
uint64_t get_nodes(const int level=-1) const
Definition: enumerate.h:48
Definition: enumerate.h:79
Enumeration(MatGSOInterface< ZT, FT > &gso, Evaluator< FT > &evaluator, const vector< int > &max_indices=vector< int >())
Definition: enumerate.h:81
void enumerate(int first, int last, FT &fmaxdist, long fmaxdistexpo, const vector< FT > &target_coord=vector< FT >(), const vector< enumxt > &subtree=vector< enumxt >(), const vector< enumf > &pruning=vector< enumf >(), bool dual=false, bool subtree_reset=false)
Definition: enumerate.h:87
uint64_t get_nodes(const int level=-1) const
Definition: enumerate.h:113
array< uint64_t, FPLLL_EXTENUM_MAX_EXTENUM_DIM > get_nodes_array() const
Definition: enumerate.h:120
Definition: evaluator.h:66
Definition: enumerate_ext.h:105
Definition: gso_interface.h:60
#define FPLLL_END_NAMESPACE
Definition: defs.h:117
#define FPLLL_BEGIN_NAMESPACE
Definition: defs.h:114
std::function< extenum_fc_enumerate > get_external_enumerator()
Definition: enumerate_ext.cpp:46
fplll_extenum_enumf std::function< extenum_cb_set_config > std::function< extenum_cb_process_sol > std::function< extenum_cb_process_subsol > bool dual
Definition: enumerate_ext_api.h:91
fplll_extenum_enumf maxdist
Definition: enumerate_ext_api.h:89
FPLLL_BEGIN_NAMESPACE typedef double enumf
Definition: nr.h:42