propagation

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 conservationrules.

class AbstractPropagator(graph)[source]

Bases: abc.ABC

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 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]

Creates 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]

Creates 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]

Initializes 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.

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, to allow 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 and 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

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 InteractionNodeSettings[source]

Bases: object

Container class for the interaction settings, which 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

Bases: enum.Enum

An enumeration.

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

Bases: expertsystem.state.propagation.AbstractPropagator

create_edge_variables(edge_ids, qn_list)[source]

Creates 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]

Creates variables for the quantum numbers of the specified node.

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

Bases: object

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

Decodes the variable name (see encode_variable_name())

encode_variable_name(variable_info, delimiter)[source]

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)

graph_element_types

alias of expertsystem.state.propagation.GraphElementTypes