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