ReductionStrategy.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_groebner_ReductionStrategy_h_
#define polybori_groebner_ReductionStrategy_h_
// include basic definitions
#include "groebner_defs.h"
#include "polynomial_properties.h"
#include "PolyEntryVector.h"
#include "ReductionOptions.h"
#include "ReductionTerms.h"
#include "SetAssociatedMinimal.h"
BEGIN_NAMESPACE_PBORIGB
class ReductionStrategy:
public PolyEntryVector, public ReductionOptions, public ReductionTerms {
typedef ReductionStrategy self;
public:
ReductionStrategy(const BoolePolyRing& ring):
PolyEntryVector(), ReductionOptions(),
ReductionTerms(ring) { }
void addGenerator(const PolyEntry& entry) {
PolyEntryVector::append(entry);
setupSetsForElement(back());
}
void append(const PolyEntry& entry) { addGenerator(entry); }
Polynomial nf(const Polynomial& p) const {
return (optRedTail? reducedNormalForm(p): headNormalForm(p));
}
bool canRewrite(const Polynomial& p) const {
return is_rewriteable(p, minimalLeadingTerms);
}
int select1(const Polynomial& p) const;
int select1(const Monomial& m) const;
int select_short(const Polynomial& p) const {
return select_short_by_terms(p.leadDivisors());
}
int select_short(const Monomial& m) const {
return select_short_by_terms(m.divisors());
}
Polynomial headNormalForm(const Polynomial& p) const;
Polynomial reducedNormalForm(const Polynomial& p) const;
void llReduceAll();
operator const PolyEntryVector&() const {
return static_cast<const PolyEntryVector&>(*this);
}
protected:
void llReduce(const PolyEntry& entry, const Exponent& ll_e);
int select_short_by_terms(const MonomialSet&) const;
void unmarkNonMinimalLeadingTerms(MonomialSet removed) {
std::for_each(removed.expBegin(), removed.expEnd(),
SetAssociatedMinimal<Exponent, false>(*this));
}
void setupSetsForElement(const PolyEntry& entry);
template <class Iterator, class CompareType>
size_type minimum(Iterator start, Iterator finish, const CompareType& comp)
const {
start = std::min_element(start, finish, comp);
if PBORI_UNLIKELY(start == finish)
return size_type(-1);
return index(*start);
}
};
inline bool
irreducible_lead(Monomial lm, const ReductionStrategy& strat){
return (!(strat.minimalLeadingTerms.hasTermOfVariables(lm)));//
// strat.generators.minimalLeadingTerms.intersect(lm.divisors()).isZero();
}
END_NAMESPACE_PBORIGB
#endif /* polybori_ReductionStrategy_h_ */
polybori::groebner::ReductionStrategy::ReductionStrategy
ReductionStrategy(const BoolePolyRing &ring)
Definition: ReductionStrategy.h:39
SetAssociatedMinimal.h
polynomial_properties.h
polybori::BooleExponent
This class is just a wrapper for using variables for storing indices as interim data structure for Bo...
Definition: BooleExponent.h:34
polybori::groebner::ReductionStrategy::append
void append(const PolyEntry &entry)
Definition: ReductionStrategy.h:51
polybori::groebner::PolyEntryVector
Definition: PolyEntryVector.h:28
ReductionTerms.h
polybori::groebner::PolyEntryVector::size_type
data_type::size_type size_type
Definition: PolyEntryVector.h:35
END_NAMESPACE_PBORIGB
#define END_NAMESPACE_PBORIGB
Definition: groebner_defs.h:16
polybori::BooleSet::expEnd
exp_iterator expEnd() const
Finish of iteration over exponent vectors.
Definition: BooleSet.cc:109
polybori::groebner::irreducible_lead
bool irreducible_lead(Monomial lm, const ReductionStrategy &strat)
Definition: ReductionStrategy.h:107
polybori::BoolePolyRing
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
polybori::groebner::ReductionStrategy::canRewrite
bool canRewrite(const Polynomial &p) const
Definition: ReductionStrategy.h:57
BEGIN_NAMESPACE_PBORIGB
#define BEGIN_NAMESPACE_PBORIGB
Definition: groebner_defs.h:15
polybori::BooleSet::expBegin
exp_iterator expBegin() const
Start of iteration over exponent vectors.
Definition: BooleSet.cc:101
polybori::groebner::PolyEntry
This class defines PolyEntry.
Definition: PolyEntry.h:32
polybori::groebner::ReductionStrategy::select_short
int select_short(const Monomial &m) const
Definition: ReductionStrategy.h:67
polybori::BoolePolynomial
This class wraps the underlying decicion diagram type and defines the necessary operations.
Definition: BoolePolynomial.h:85
polybori::groebner::SetAssociatedMinimal
This class set the attribute minimal of a given index to a valued selected by the template parameter ...
Definition: SetAssociatedMinimal.h:32
groebner_defs.h
polybori::BooleMonomial::divisors
set_type divisors() const
Divisors of the monomial.
Definition: BooleMonomial.h:154
polybori::groebner::ReductionStrategy::select_short
int select_short(const Polynomial &p) const
Definition: ReductionStrategy.h:64
polybori::groebner::ReductionTerms
This class defines term for ReductionStrategy.
Definition: ReductionTerms.h:46
polybori::groebner::ReductionStrategy::minimum
size_type minimum(Iterator start, Iterator finish, const CompareType &comp) const
Definition: ReductionStrategy.h:94
polybori::groebner::is_rewriteable
bool is_rewriteable(const Polynomial &p, const MonomialSet &leading_terms)
Definition: polynomial_properties.cc:104
polybori::groebner::ReductionStrategy::nf
Polynomial nf(const Polynomial &p) const
Definition: ReductionStrategy.h:53
polybori::groebner::ReductionStrategy::unmarkNonMinimalLeadingTerms
void unmarkNonMinimalLeadingTerms(MonomialSet removed)
Definition: ReductionStrategy.h:85
polybori::BoolePolynomial::leadDivisors
set_type leadDivisors() const
Get all divisors of the leading term.
Definition: BoolePolynomial.h:328
ReductionOptions.h
PolyEntryVector.h
polybori::BooleSet::hasTermOfVariables
bool_type hasTermOfVariables(const term_type &rhs) const
Definition: BooleSet.cc:182
polybori::groebner::ReductionOptions
This class defines option values for the ReductionStrategy.
Definition: ReductionOptions.h:29
polybori::BooleSet
Definition: BooleSet.h:57
polybori::groebner::ReductionStrategy
This class defines ReductionStrategy.
Definition: ReductionStrategy.h:34
polybori::BooleMonomial
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
polybori::groebner::ReductionTerms::minimalLeadingTerms
MinimalLeadingTerms minimalLeadingTerms
Definition: ReductionTerms.h:52
PBORI_UNLIKELY
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
polybori::for_each
void for_each(InIter start, InIter finish, Object &obj, MemberFuncPtr func)
Definition: pbori_algo.h:857
polybori::groebner::ReductionStrategy::addGenerator
void addGenerator(const PolyEntry &entry)
Adding next element.
Definition: ReductionStrategy.h:44