A equality constrained row of the output problem formulation. More...
#include <constraint.hh>
Public Member Functions | |
constraint () | |
Default constructor. | |
constraint (std::string *name, rational *goal, int mod) | |
Constructor for use by the parser. | |
constraint (std::string name, rational goal, int mod) | |
Full constructor. | |
void | swap (constraint &other) |
Swap two constraints. | |
Public Attributes | |
std::string | name |
The name of the quantum number for which this constraint must hold. | |
rational | goal |
The right hand side of the euqality. | |
int | mod |
The divisor for modulo arithmetic. |
A equality constrained row of the output problem formulation.
In terms of the matrix of a linear program, a constraint object describes a single row as a whole, giving its name and rules, but not the matrix elements, which will be included in the columns represented by field objects.
A constraint represented through this class is an equality constraint for the sum over a specified component of each field description. The component is identified by name. The calculation might use modulo arithmetic.
Some special rows may created which are not representet as constraint objects internally, e.g. because they are inequalities.
Definition at line 46 of file constraint.hh.
constraint::constraint | ( | ) |
Default constructor.
Uses default values for all members, like a goal of 0 and no modulo arithmetic to be used.
Definition at line 38 of file constraint.cc.
constraint::constraint | ( | std::string * | n, | |
rational * | g, | |||
int | m = 0 | |||
) |
Constructor for use by the parser.
As the parser represents most objects through pointers, this version of the constructor accepts pointers, and takes care of freeing the memory of the objects pointed to.
n | the name of the associated quantum number. | |
g | the goal, i.e. the right hand side of the equation. | |
m | the modulo divisor, or 0 for no modulo arithmetic. |
Definition at line 51 of file constraint.cc.
constraint::constraint | ( | std::string | n, | |
rational | g, | |||
int | m = 0 | |||
) |
Full constructor.
This constructor takes its arguments by value. They map to the members of the constraint object in an obvious way.
n | the name of the associated quantum number. | |
g | the goal, i.e. the right hand side of the equation. | |
m | the modulo divisor, or 0 for no modulo arithmetic. |
Definition at line 66 of file constraint.cc.
void constraint::swap | ( | constraint & | other | ) |
Swap two constraints.
This method implements the optimized swapping operation, which is used by the std::swap(constraint&, constraint&) function in generic code.
other | the other constraint objects with which this one should be swapped. |
Definition at line 79 of file constraint.cc.
References goal, mod, and name.
Referenced by std::swap().
The right hand side of the euqality.
Both the lower and the upper bound of the row will have this value.
Definition at line 64 of file constraint.hh.
Referenced by swap().
int constraint::mod |
The divisor for modulo arithmetic.
The special value 0 means that no modulo arithmetic should be used.
Definition at line 71 of file constraint.hh.
Referenced by swap().
std::string constraint::name |
The name of the quantum number for which this constraint must hold.
This is used as a lookup to identify the comonent inside the field descriptions.
Definition at line 57 of file constraint.hh.
Referenced by swap().