relation_set.cc
//stores the relation set in the binary
stores the relation set in the binary
stores the relation set in the binary
void RelationSet::store()  {
    relationSetSize = 0;
    for(uint32_t relId = 0; relId < relations.size(); relId++)  {
        #if OPTIMIZE_NEXT_RELATION_EQUATION_OCCURENCES
            if(relations[relId].type == RelationSetType::EQUAL &&
               relations[relId].variableIds[0] == -1 &&
               relations[relId].variableIds[1] == -1)
            {
                policyBinary.push_back(0, 1);
                #if EVALUATION_OUTPUT 
                    relationSetSize += 1;
                #endif
                continue; 
            }
            policyBinary.push_back(1, 1);
            #if EVALUATION_OUTPUT 
                relationSetSize += 1;
            #endif
        #endif
        policyBinary.push_back(relationTypeToInt[relations[relId].type], bitsForRelationType);
        #if EVALUATION_OUTPUT 
            relationSetSize += bitsForRelationType;
        #endif
        uint8_t numberOfSides = 2; 
        if(relations[relId].type == RelationSetType::IS_TRUE ||
           relations[relId].type == RelationSetType::IS_FALSE)
            numberOfSides = 1;
        for(uint8_t side = 0; side < numberOfSides; side++)  {
            if(relations[relId].variableIds[side] == -1)  { 
                policyBinary.push_back(0, 1); 
                #if EVALUATION_OUTPUT 
                    relationSetSize += 1;
                #endif
            }
            else  { 
                policyBinary.push_back(1, 1); 
                #if EVALUATION_OUTPUT 
                    relationSetSize += 1;
                #endif
                policyBinary.push_back(relations[relId].variableIds[side], variableSet.bitsForSpecificVariableId);
                #if EVALUATION_OUTPUT 
                    relationSetSize += variableSet.bitsForSpecificVariableId;
                #endif
            }
        }
    }
}
void RelationSet :: store ( ) { relationSetSize = 0 ; for ( uint32_t relId = 0 ; relId < relations . size ( ) ; relId ++ ) { #if OPTIMIZE_NEXT_RELATION_EQUATION_OCCURENCES if ( relations [ relId ] . type == RelationSetType :: EQUAL && relations [ relId ] . variableIds [ 0 ] == -1 && relations [ relId ] . variableIds [ 1 ] == -1 ) { policyBinary . push_back ( 0 , 1 ) ; #if EVALUATION_OUTPUT relationSetSize += 1 ; #endif continue ; } policyBinary . push_back ( 1 , 1 ) ; #if EVALUATION_OUTPUT relationSetSize += 1 ; #endif #endif policyBinary . push_back ( relationTypeToInt [ relations [ relId ] . type ] , bitsForRelationType ) ; #if EVALUATION_OUTPUT relationSetSize += bitsForRelationType ; #endif uint8_t numberOfSides = 2 ; if ( relations [ relId ] . type == RelationSetType :: IS_TRUE || relations [ relId ] . type == RelationSetType :: IS_FALSE ) numberOfSides = 1 ; for ( uint8_t side = 0 ; side < numberOfSides ; side ++ ) { if ( relations [ relId ] . variableIds [ side ] == -1 ) { policyBinary . push_back ( 0 , 1 ) ; #if EVALUATION_OUTPUT relationSetSize += 1 ; #endif } else { policyBinary . push_back ( 1 , 1 ) ; #if EVALUATION_OUTPUT relationSetSize += 1 ; #endif policyBinary . push_back ( relations [ relId ] . variableIds [ side ] , variableSet . bitsForSpecificVariableId ) ; #if EVALUATION_OUTPUT relationSetSize += variableSet . bitsForSpecificVariableId ; #endif } } } }
stores the relation set in the binary
stores the relation set in the binary
//compress the popular combination =, next, next by a starting 0 //a starting 1 indicates that a normal relation definition follows //store just a 0 for the popular =, next, next combination //eval RelationSet size output //don't execute the following code for normal relations //else a normal relations follows s.t. //a 1 indicates that a normal relation definition follows //eval RelationSet size output //add the relation type to the binary //eval RelationSet size output //add the relation sides to the binary //normal is a binary operation //IS_TRUE and IS_FALSE only have one child //next variable in the variable set //first bit 0, indicates a next variable //Eval RelationSet size output //specific (redundant) variable, so insert to the id to the original //first bit 1 indicates that a specific variable is following //eval RelationSet size output //followed by the variable id to point to //eval RelationSet size output