7 #ifndef GRAPHGEN_HYPERCUBE_H_
8 #define GRAPHGEN_HYPERCUBE_H_
17 typedef unsigned char byte;
41 for (
size_t i = 0; i<
m_iDim; i++) {
57 char aRepresentation[3] = {
'0',
'1',
'-' };
58 for (
size_t i = 0; i<
m_iDim; i++) {
66 for (
size_t i = 0; i<
m_iDim; i++) {
74 for (
int i =
int(
m_iDim) - 1; i >= 0; i--) {
102 template <
typename T>
103 std::istream&
rawread(std::istream& is, T& val,
size_t n) {
104 return is.read(
reinterpret_cast<char*
>(&val), n);
106 template <
typename T>
107 std::ostream&
rawwrite(std::ostream& os,
const T& val,
size_t n) {
108 return os.write(
reinterpret_cast<const char*
>(&val), n);
118 auto nrules = rs.
rules.size();
119 for (
size_t i = 0; i < nrules; ++i) {
122 std::reverse(begin(s), end(s));
130 std::istream&
read(std::istream& is) {
133 std::ostream&
write(std::ostream& os) {
std::istream & rawread(std::istream &is, T &val, size_t n)
std::ostream & rawwrite(std::ostream &os, const T &val, size_t n)
BinaryDrag< conact > GetOdt(const rule_set &rs, bool force_generation=false)
Returns the optimal (or pseudo optimal) decision tree generated from the given rule set.
BinaryDrag< conact > GenerateOdt(const rule_set &rs)
BinaryDrag< conact > GetOdtWithFileSuffix(const rule_set &rs, const std::string &file_suffix, bool force_generation=false)
Returns the optimal (or pseudo optimal) decision tree generated from the given rule set.
VHyperCube(const rule_set &rs)
const VNode & operator[](const VIndex &idx) const
VNode & operator[](const VIndex &idx)
std::istream & read(std::istream &is)
std::ostream & write(std::ostream &os)
std::vector< VNode > m_arrIndex
BinaryDrag< conact > optimize(bool bVerbose=false)
VIndex(const std::string &s)
std::string GetIndexString() const
unsigned GetIndex() const
std::vector< VDim > m_arrIndex
bool SetIndex(const std::string &s)
unsigned long long uiProb
unsigned long long uiGain
std::bitset< 131 > uiAction
std::vector< rule > rules
std::string binary(size_t u, size_t nbits)