PolyBoRi
CountCriterion.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_CountCriterion_h_
17 #define polybori_groebner_CountCriterion_h_
18 
19 // include basic definitions
20 #include "groebner_defs.h"
21 
22 #include "GroebnerStrategy.h"
23 #include "interpolate.h"
24 
26 
32 public:
34  int j;
36  this->strat=&strat;
37  this->j=j;
38  }
39  bool operator() (int i){
40  const PolyEntry & e1=const_cast<const GroebnerStrategy*>(strat)->generators[i];
41  const PolyEntry & e2=const_cast<const GroebnerStrategy*>(strat)->generators[j];
42  const int USED_VARIABLES_BOUND=6;
43  if ((e1.usedVariables.deg()>USED_VARIABLES_BOUND)||
44  (e2.usedVariables.deg()>USED_VARIABLES_BOUND)||
45  (e1.usedVariables.LCMDeg(e2.usedVariables) > USED_VARIABLES_BOUND)
46 
47 
48  ||(e1.p.set().nNodes()>30)||(e2.p.set().nNodes()>30))
49  return false;
50 
52 
53  MonomialSet space=uv_exp.divisors(e1.p.ring());
54 
55  Monomial lead_lcm=e1.lead.LCM(e2.lead);
56  //I am sure, there exists combinatorial formulas
57  MonomialSet common_lead_space=lead_lcm.divisors();
58  Monomial gcd=e1.lead.GCD(e2.lead);
59  int gcd_deg = gcd_deg;
60  int standard_monomials_in_common_lead=
61  // common_lead_space.diff(
62  // common_lead_space.multiplesOf(e1.lead)).diff(
63  // common_lead_space.multiplesOf(e2.lead)).size();
64  (1<<gcd_deg)*((1<<(e1.leadDeg-gcd_deg))-1+(1<<(e1.leadDeg-gcd_deg)
65  )-1)
66  +((1<<gcd_deg)-1)*((1<<(e1.leadDeg-gcd_deg))+(1<<(e2.leadDeg-gcd_deg)));
67 
68  MonomialSet::size_type standard_monomials =
69  (standard_monomials_in_common_lead <<(uv_exp.size()-lead_lcm.deg()));
70 
71  MonomialSet zeros1=zeros(e1.p, space);
72  MonomialSet zeros2=zeros(e2.p, space);
73 
74  MonomialSet my_zeros=zeros1.intersect(zeros2);
75 
76 
77  // MonomialSet my_zeros=zeros(e1.p, space).intersect(zeros(e2.p, space));
78 
79 
80  if (PBORI_UNLIKELY(standard_monomials==my_zeros.size()))
81  {
82  strat->pairs.status.setToHasTRep(i,j);
83  return true;
84 
85  }
86  else
87  return false;
88  }
89  bool operator() (const Exponent &m){
90  int i = strat->generators.index(m);
91  return (*this)(i);
92  }
93 
94 
95 };
96 
98 
99 #endif /* polybori_CountCriterion_h_ */
deg_type deg() const
Degree of the monomial.
Definition: BooleMonomial.h:146
Exponent usedVariables
Definition: PolyEntryBase.h:62
GroebnerStrategy * strat
Definition: CountCriterion.h:33
This class is just a wrapper for using variables for storing indices as interim data structure for Bo...
Definition: BooleExponent.h:34
self GCD(const self &) const
Compute the greatest common divisor.
Definition: BooleMonomial.cc:169
deg_type leadDeg
Definition: PolyEntryBase.h:59
size_type index(const KeyType &key) const
Retrieve index associated to key.
Definition: PolyEntryVector.h:99
Polynomial p
Definition: PolyEntryBase.h:54
deg_type LCMDeg(const self &) const
Degree of the least common multiple.
Definition: BooleExponent.cc:293
#define END_NAMESPACE_PBORIGB
Definition: groebner_defs.h:16
set_type divisors(const ring_type &) const
Divisors of the monomial.
Definition: BooleExponent.cc:417
self LCM(const self &) const
Compute the greatest common divisor.
Definition: BooleExponent.cc:319
self LCM(const self &) const
Compute the least common multiple.
Definition: BooleMonomial.cc:219
const ring_type & ring() const
Access ring, where this belongs to.
Definition: BoolePolynomial.h:478
This class defines CountCriterion.
Definition: CountCriterion.h:31
set_type set() const
Get corresponding subset of of the powerset over all variables.
Definition: BoolePolynomial.h:464
#define BEGIN_NAMESPACE_PBORIGB
Definition: groebner_defs.h:15
This class defines PolyEntry.
Definition: PolyEntry.h:32
PairStatusSet status
Definition: PairManager.h:75
ReductionStrategy generators
Definition: GroebnerStrategy.h:204
int j
Definition: CountCriterion.h:34
CountCriterion(GroebnerStrategy &strat, int j)
Definition: CountCriterion.h:35
set_type divisors() const
Divisors of the monomial.
Definition: BooleMonomial.h:154
size_type size() const
Returns number of terms.
Definition: BooleSet.h:242
This class defines GroebnerStrategy.
Definition: GroebnerStrategy.h:41
void setToHasTRep(int ia, int ja)
Definition: PairStatusSet.h:39
PairManagerWithStrategy< strategy_type > pairs
For compatibility reasons make this a public member.
Definition: PairManagerFacade.h:95
size_type nNodes() const
Number of nodes in the current decision diagram.
Definition: CCuddDDFacade.h:235
MonomialSet zeros(Polynomial p, MonomialSet candidates)
Definition: interpolate.cc:85
Monomial lead
Definition: PolyEntryBase.h:55
std::size_t size_type
Type for lengths, dimensions, etc.
Definition: pbori_defs.h:219
Definition: BooleSet.h:57
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
size_type size() const
Degree of the corresponding monomial.
Definition: BooleExponent.h:109
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
deg_type deg() const
Degree of the corresponding monomial.
Definition: BooleExponent.h:118