7 #ifndef GRAPHGEN_HYPERCUBEPP_H_
8 #define GRAPHGEN_HYPERCUBEPP_H_
20 std::istream&
rawread(std::istream& is, T& val,
size_t n) {
21 return is.read(
reinterpret_cast<char*
>(&val), n);
24 std::ostream&
rawwrite(std::ostream& os,
const T& val,
size_t n) {
25 return os.write(
reinterpret_cast<const char*
>(&val), n);
29 size_t GetIndexWithIndifference(
size_t value,
size_t indif) {
32 for (
size_t pos = 0; pos <
nbits_; ++pos) {
33 if ((indif >> pos) & 1) {
34 index += 2 *
pow3_[pos];
37 index += ((value >> vbits) & 1)*
pow3_[pos];
44 size_t GetIndex(
size_t value) {
46 for (
int pos = 0; pos < static_cast<int>(
nbits_); ++pos) {
47 index += ((value >> pos) & 1)*
pow3_[pos];
74 data_(size_t(pow(3.0, rs.conditions.size()))),
pow3_(rs.conditions.size())
78 for (
size_t i = 1; i <
nbits_; ++i) {
83 auto nrules = rs.
rules.size();
84 for (
size_t i = 0; i < nrules; ++i) {
86 size_t idx = GetIndex(i);
93 std::istream&
read(std::istream& is) {
96 std::ostream&
write(std::ostream& os) {
Node & operator[](size_t idx)
HyperCube(const rule_set &rs)
std::ostream & write(std::ostream &os)
const Node & operator[](size_t idx) const
BinaryDrag< conact > Optimize()
std::vector< size_t > pow3_
std::vector< Node > data_
std::istream & read(std::istream &is)
BinaryDrag< conact > GenerateOdt(const rule_set &rs)
BinaryDrag< conact > GetOdt(const rule_set &rs, bool force_generation)
Returns the optimal (or pseudo optimal) decision tree generated from the given rule set.
std::ostream & rawwrite(std::ostream &os, const T &val, size_t n)
std::istream & rawread(std::istream &is, T &val, size_t n)
BinaryDrag< conact > GetOdtWithFileSuffix(const rule_set &rs, const string &file_suffix, bool force_generation)
unsigned long long frequency_
std::bitset< 131 > actions_
std::vector< rule > rules