QuISP
Loading...
Searching...
No Matches
quisp::runtime::RuleSet Class Reference

The RuleSet. More...

#include <RuleSet.h>

Collaboration diagram for quisp::runtime::RuleSet:

Public Member Functions

 RuleSet (const std::string &name="", const std::vector< Rule > &rules=std::vector< Rule >(), const Program &termination_cond=Program{"never terminate", {}}, bool debugging=false)
 
void finalize ()
 analyzes its rules and instructions to collect informations for execution.
 

Public Attributes

std::set< QNodeAddrpartners
 the partner(connection participating nodes) QNodeAddrs used in this RuleSet.
 
std::unordered_map< QNodeAddr, RuleIdpartner_initial_rule_table
 This contains a list of pairs of the rule_id and partner's QNodeAddr.
 
std::unordered_map< std::pair< QNodeAddr, RuleId >, RuleIdnext_rule_table = {}
 contains the next rule ids corresponding to the current partner and rule id like: (partner_addr, current_rule_id): next_rule_id
 
unsigned long id
 the RuleSet id
 
int owner_addr
 the owner's QNode address.
 
std::string name
 the RuleSet name for debugging.
 
std::vector< Rulerules
 the Rules in this RuleSet. Each Rule has Condition and Action.
 
Program termination_condition
 the Program to check the RuleSet is terminated or not.
 
bool debugging = false
 

Static Protected Member Functions

static void collectPartners (const RuleId rule_id, const InstructionTypes &instr, std::set< QNodeAddr > &partners, std::unordered_map< QNodeAddr, std::vector< RuleId > > &partner_rules)
 an internal method to traverse the given Rule's whole Program to collect their partners.
 

Detailed Description

The RuleSet.

The responder QNode creates a set of RuleSets for each QNode in the path. The RuleSet contains a list of Rules. The Runtime receives the given RuleSet and executes it. The Runtime and the Ruleset will be deleted when the RuleSet is terminated.

Constructor & Destructor Documentation

◆ RuleSet()

quisp::runtime::RuleSet::RuleSet ( const std::string & name = "",
const std::vector< Rule > & rules = std::vector<Rule>(),
const Program & termination_cond = Program{"never terminate", {}},
bool debugging = false )
inline

Member Function Documentation

◆ collectPartners()

void quisp::runtime::RuleSet::collectPartners ( const RuleId rule_id,
const InstructionTypes & instr,
std::set< QNodeAddr > & partners,
std::unordered_map< QNodeAddr, std::vector< RuleId > > & partner_rules )
inlinestaticprotected

an internal method to traverse the given Rule's whole Program to collect their partners.

◆ finalize()

void quisp::runtime::RuleSet::finalize ( )

analyzes its rules and instructions to collect informations for execution.

Member Data Documentation

◆ debugging

bool quisp::runtime::RuleSet::debugging = false

◆ id

unsigned long quisp::runtime::RuleSet::id

the RuleSet id

◆ name

std::string quisp::runtime::RuleSet::name

the RuleSet name for debugging.

◆ next_rule_table

std::unordered_map<std::pair<QNodeAddr, RuleId>, RuleId> quisp::runtime::RuleSet::next_rule_table = {}

contains the next rule ids corresponding to the current partner and rule id like: (partner_addr, current_rule_id): next_rule_id

◆ owner_addr

int quisp::runtime::RuleSet::owner_addr

the owner's QNode address.

◆ partner_initial_rule_table

std::unordered_map<QNodeAddr, RuleId> quisp::runtime::RuleSet::partner_initial_rule_table

This contains a list of pairs of the rule_id and partner's QNodeAddr.

The Runtime assigns the entangled qubit to the rule by looking up this map. This is initialized when the Runtime receives the RuleSet.

◆ partners

std::set<QNodeAddr> quisp::runtime::RuleSet::partners

the partner(connection participating nodes) QNodeAddrs used in this RuleSet.

◆ rules

std::vector<Rule> quisp::runtime::RuleSet::rules

the Rules in this RuleSet. Each Rule has Condition and Action.

◆ termination_condition

Program quisp::runtime::RuleSet::termination_condition

the Program to check the RuleSet is terminated or not.


The documentation for this class was generated from the following files: