49 for (
size_t var = 0; var <
_varCount; ++var) {
50 if (ideal[term][var] != 0) {
51 ASSERT(ideal[term][var] == 1);
80 size_t nextPos = pos +
_edges[pos] + 1;
95 for (
size_t p = pos + 1; p != nextPos; ++p) {
141 size_t nextPos = pos +
_edges[pos] + 1;
152 if (maybeCount == 0) {
160 vector<size_t>& undo =
_undo[excluded];
161 for (
size_t p = pos + 1; p != nextPos; ++p) {
170 recurse(nextPos, excluded + 1);
181 if (maybeCount == 1) {
186 while (!undo.empty()) {
Represents a monomial ideal with int exponents.
bool isSquareFree() const
size_t getGeneratorCount() const
bool containsIdentity() const
bool isMinimallyGenerated() const
size_t getVarCount() const
bool isIndependentIncludingMaybe(size_t pos)
Returns true if _state is an independent set according to every term in _edges from pos and forward.
vector< vector< size_t > > _undo
Stores information on how to restore the state of _state after having done backtracking on one possib...
void run(Ideal &ideal)
Run the algorithm on ideal.
size_t _varCount
The number of variables in the ideal passed to run.
bool _noIndependentSets
Is true if there are no independent sets for the argument to run.
size_t _minExcluded
The minimal number of excluded elements in any independent set found so far.
VarState
Is used for encoding the state of a partially-decided set of nodes/variables in the backtracking algo...
vector< VarState > _state
The current state of the backtracking algorithm.
void recurse(size_t pos, size_t excluded)
The recursive method that implements the algortihm.
vector< size_t > _edges
Sparse encoding of the parameter to run.
bool couldBeDependence(size_t pos, size_t nextPos, size_t &maybeCount)
Returns true if the term encoded in _edges between pos and nextPos makes or might make the set in _st...
mpz_class getMaxIndepSetSize()
Returns the largest size over all independent sets of the hypergraph passed to run.
size_t _endPos
The size of _edges.
size_t getSizeOfSupport() const