#include <indigox/algorithm/electron_assignment/astar_optimisation.hpp>
◆ _bool_opts
Normal enum for algorithm option indexing.
Enumerator |
---|
__pairs | Use pairs of electrons.
|
__charged_c | Allow charge carbon.
|
__preplace | Preassign electrons.
|
__initalised | Algorithm initailised.
|
__num_opts | Number of options.
|
◆ Heuristic
Enumerator |
---|
Promiscuous | |
Abstemious | |
◆ IXAStarOptimisation() [1/2]
◆ IXAStarOptimisation() [2/2]
Normal constructor.
Sets the options of the algorithm from their state at the time of construction. Also calls the base constructor.
- Parameters
-
◆ ApplyAssignment()
bool ApplyAssignment |
( |
size_t |
idx | ) |
|
|
inherited |
Apply an optimised assignment.
Applies the optimised assignment at position idx
to the Molecule. Application involves determining the bond order and formal charges from the electron assignment. This method requires the algorithm the have been initalised.
- Parameters
-
idx | the index of the assignment to apply. |
- Returns
- if the application process was successful or not.
◆ CalculateAssignmentScore()
Calculate the score of an assignment.
Simply sets the assignment to that provided, and sums all the scores of the vertices in the AssignmentGraph. If any vertex is given a score if infinity, the summation halts and infinity is returned for the score of the assignment. This method requires the algorithm to have been initialised.
- Parameters
-
a | the assignment to calculate the score of. |
- Returns
- the score of the assignment.
- Exceptions
-
std::runtime_error | if the method is called before initalistion. |
◆ CalculateUpperLimit()
Calculates the upper score limit.
The upper score limit can be used by an assignment algorithm to improve its execution time. The upper limit is calculated by iteratively generating an assignment. Iteration involves assigning electrons to the lowest scoring location, and iterating until all electrons have been assigned. Once the assignment has been generated, its score is calculated. If the score is finite, it is incremented by one. This increment allows easier handling of assignments having a score the same as the upper limit. This method requires the algorithm to have been initialised.
- Returns
- the assignment that generated the upper limit score.
- Exceptions
-
std::runtime_error | if the method is called before initalistion. |
◆ CalculateVertexScore()
Calculate the score of a vertex.
Determines the key of the vertex and returns the score of that key as present in the score table. There are three possibilities for the score returned. The first is the score present in the score table. The second is infinity. For a vertex mapped v
, this occurs when charged carbons are not allowed and the formal charge on a carbon is non-zero, when the magnitude of the formal charge on the atom is larger than that allowed, and if the valency of the atom exceeds that allowed by its element. For an edge mapped v
, infinty occurs when either atom of the bond exceeds its allowed valence. Finally, in either vertex or edge mapped cases, infinity is returned when the key is not found in the score table. The final possible score is zero, which occurs when v
cannot be assigned any electrons and, in the vertex mapped case, when none of the neighbours of v
can have electrons assigned either. This method requires the algorithm to have been initialised.
- Parameters
-
v | the vertex to calculate the score of. |
- Returns
- the score of the vertex.
- Exceptions
-
std::runtime_error | if the method is called before initalistion. |
◆ GetAssignmentGraph()
Obtain the AssignmentGraph in use by the algorithm.
If the molecule assocaited with the assignment algorithm is no longer valid, or the algorithm has not been initalised, the returned shared_ptr is empty.
- Returns
- the AssignmentGraph used by the algorithm.
◆ GetOptimalCount()
size_t GetOptimalCount |
( |
| ) |
const |
|
inlineinherited |
Get the number of optimal assignments found.
- Returns
- the number of optimal assignments found.
◆ GetOptimisedScore()
score_t GetOptimisedScore |
( |
| ) |
const |
|
inlineinherited |
Get the optimised score.
If the optimisation has not been run, returned score will be infinity.
- Returns
- the score of the optimised electron assignment.
◆ Initalise()
virtual void Initalise |
( |
const Molecule & |
mol | ) |
|
|
overridevirtual |
Initalisation method.
Overrides the base class initalisation method so that location masks can be generated as part of initalisation.
- Parameters
-
Reimplemented from IXElectronAssigner::AssignAlgorithm.
◆ IsInitalised()
bool IsInitalised |
( |
| ) |
const |
|
inlineinherited |
If the algorithm has been initalised or not.
- Returns
- if the initalise method has been called.
◆ Run()
◆ SetAssignment()
Apply an assignment to the AssignmentGraph.
Sets the assigned electron counts for all vertices in the AssignmentGraph given the provided mask. Only those assignments which have changed since the previous call to this method are actually modified. As such, all modification to the AssignmentGraph assigned counts should only go through this method. This method requires the algorithm to have been initialised.
- Parameters
-
- Exceptions
-
std::runtime_error | if the method is called before initalistion. |
◆ _g
Assignment graph working on.
◆ _inf
◆ _limit
Upper limit of optimised score.
◆ _locs
Locations to possibly place electrons.
◆ _max_charge
Maximum charge magnitude.
◆ _max_results
Maximum number of results.
◆ _min_score
◆ _mol
◆ _num_e
Number of electrons to assign.
◆ _opts
◆ _previous_mask
Previous assignment mask.
◆ _results
◆ _table
Reference to the score table.
The documentation for this class was generated from the following file: