propagation

Functions to propagate quantum numbers through a StateTransitionGraph.

This module is responsible for propagating the quantum numbers of the initial and final state particles through a graphs (Propagator classes). Hence it finds the allowed quantum numbers of the intermediate states. The propagator classes (e.g. CSPPropagator) use the implemented conservation rules of conservation_rules.

class AbstractPropagator(graph)[source]

Bases: abc.ABC

Abstract interface of a propagator.

assign_settings_to_all_nodes(interaction_settings)[source]
assign_settings_to_node(node_id, interaction_settings)[source]
abstract find_solutions()[source]
get_non_satisfied_conservation_laws()[source]
set_allowed_intermediate_particles(allowed_intermediate_particles)[source]
class CSPPropagator(graph)[source]

Bases: expertsystem.state.propagation.AbstractPropagator

Quantum number propagator reducing the problem to a CSP.

Quantum number propagator reducing the problem to a constraint satisfaction problem and solving this with the python-constraint module.

The variables are the quantum numbers of particles/edges, but also some composite quantum numbers which are attributed to the interaction nodes (such as angular momentum \(L\)). The conservation laws serve as the constraints and are wrapped with a special class ConservationLawConstraintWrapper.

add_variable(var_info, domain)[source]
apply_solutions_to_graph(solutions)[source]

Apply the CSP solutions to the graph instance.

In other words attach the solution quantum numbers as properties to the edges. Also the solutions are filtered using the allowed intermediate particle list, to avoid large memory consumption.

Parameters

solutions – list of solutions of the csp solver

Returns

solution graphs ([StateTransitionGraph])

create_edge_variables(edge_ids, qn_dict)[source]

Create variables for the quantum numbers of the specified edges.

If a quantum number is already defined for an edge, then a fixed variable is created, which cannot be changed by the csp solver. This is the case for initial and final state edges. Otherwise the edges are initialized with the specified domains of that quantum number.

create_node_variables(node_id, qn_dict)[source]

Create variables for the quantum numbers of the specified node.

If a quantum number is already defined for a node, then a fixed variable is created, which cannot be changed by the csp solver. Otherwise the node is initialized with the specified domain of that quantum number.

find_solutions()[source]
initialize_constraints()[source]

Initialize all of the constraints for this graph.

For each interaction node a set of independent constraints/conservation laws are created. For each conservation law a new CSP wrapper is created. This wrapper needs all of the qn numbers/variables which enter or exit the node and play a role for this conservation law. Hence variables are also created within this method.

static prepare_qns(qn_names, qn_domains, type_to_filter)[source]
class ConservationLawConstraintWrapper(rule, variable_mapping, name_delimiter)[source]

Bases: expertsystem.solvers.constraint.Constraint

Wrapper class of the python-constraint Constraint class.

This allows a customized definition of conservation laws, and hence a cleaner user interface.

__call__(variables, domains, assignments, forwardcheck=False, _unassigned=Unassigned)[source]

Perform the constraint checking

If the forwardcheck parameter is not false, besides telling if the constraint is currently broken or not, the constraint implementation may choose to hide values from the domains of unassigned variables to prevent them from being used, and thus prune the search space.

Parameters
  • variables – Variables affected by that constraint, in the same order provided by the user

  • domains (dict) – Dictionary mapping variables to their domains

  • assignments (dict) – Dictionary mapping assigned variables to their current assumed value

  • forwardcheck – Boolean value stating whether forward checking should be performed or not

Returns

Boolean value stating if this constraint is currently broken or not

Return type

bool

initialize_particle_list(variable_set, fixed_variables, list_to_init)[source]
initialize_particle_lists()[source]

Fill the name decoding map.

Also initialize the in and out particle lists. The variable names follow the scheme edge_id(delimiter)qn_name. This method creates a dict linking the var name to a list that consists of the particle list index and the qn name.

register_graph_node(node_id)[source]
update_variable_lists(parameters)[source]
class FullPropagator(graph, propagation_mode='fast')[source]

Bases: object

Hander that combines all propagator rules.

assign_settings_to_all_nodes(interaction_settings)[source]
assign_settings_to_node(node_id, interaction_settings)[source]
find_solutions()[source]
get_non_satisfied_conservation_laws()[source]
set_allowed_intermediate_particles(allowed_intermediate_particles)[source]
class GraphElementTypes[source]

Bases: enum.Enum

Types of graph elements in the form of an enumerate.

edge = 2
node = 1
class InteractionNodeSettings[source]

Bases: object

Container class for the interaction settings.

This class can be assigned to each node of a state transition graph. Hence, these settings contain the complete configuration information which is required for the solution finding, e.g:

  • list of conservation laws

  • list of quantum number domains

  • strength scale parameter (higher value means stronger force)

class InteractionTypes[source]

Bases: enum.Enum

Types of interactions in the form of an enumerate.

EM = 2
Strong = 1
Weak = 3
class ParticleStateTransitionGraphValidator(graph)[source]

Bases: expertsystem.state.propagation.AbstractPropagator

Validate particle states in a transition graph.

create_edge_variables(edge_ids, qn_list)[source]

Create variables for the quantum numbers of the specified edges.

Initial and final state edges just get a single domain value. Intermediate edges are initialized with the default domains of that quantum number.

create_node_variables(node_id, qn_list)[source]

Create variables for the quantum numbers of the specified node.

create_variable_containers(node_id, cons_law)[source]
find_solutions()[source]
static prepare_qns(qn_names, type_to_filter)[source]
class VariableInfo(graph_element_type, element_id, qn_name)[source]

Bases: object

Data container for variable information.

add_qn_to_graph_element(graph, var_info, value)[source]
decode_variable_name(variable_name, delimiter)[source]

Decode the variable name.

Also see encode_variable_name.

encode_variable_name(variable_info, delimiter)[source]

Encode variable name.

The variable names are encoded as a concatenated string of the form graph element type + delimiter + element id + delimiter + qn name The variable of type VariableInfo and contains:

  • graph_element_type: is either “node” or “edge” (enum)

  • element_id: is the id of that node/edge (as it is defined in the graph)

  • qn_name: the quantum number name (enum)