Gröbner basis project
Codebase for research into Gröbner basis computation
strategies.hpp
1 #ifndef __STRATEGIES_HPP_
2 #define __STRATEGIES_HPP_
3 
4 /*****************************************************************************\
5 * This file is part of DynGB. *
6 * *
7 * DynGB is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * Foobar is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with DynGB. If not, see <http://www.gnu.org/licenses/>. *
19 \*****************************************************************************/
20 
21 #include "system_constants.hpp"
22 
23 #include "monomial.hpp"
24 
26 
34 enum class StrategyFlags {
35  NORMAL_STRATEGY = 1,
36  SUGAR_STRATEGY,
37  WSUGAR_STRATEGY
38 };
39 
50 public:
52  virtual ~Poly_Strategy_Data() { };
55 
56  virtual StrategyFlags type() = 0;
59 
60 
64  virtual bool equivalent(const Poly_Strategy_Data &) const = 0;
66  bool operator==(const Poly_Strategy_Data &other) const;
70  virtual bool first_larger(const Poly_Strategy_Data &) const = 0;
72  bool operator >(const Poly_Strategy_Data &other) const;
74  bool operator >=(const Poly_Strategy_Data &other) const;
76  bool operator <(const Poly_Strategy_Data &other) const;
78  bool operator <=(const Poly_Strategy_Data &other) const;
80 
81 
88  virtual void at_generation_tasks() { }
96  virtual void at_generation_tasks(const Monomial & t) { }
107  virtual bool valid_reduction(
108  const Abstract_Polynomial & r, const Abstract_Polynomial & g
109  ) const;
112  void pre_reduction_tasks(const Monomial & u, const Abstract_Polynomial & g) {
113  pre_reduction_tasks(u.log(), g);
114  }
124  virtual void pre_reduction_tasks(
125  const EXP_TYPE * u, const Abstract_Polynomial & g
126  ) { }
128 
129 
131  friend ostream & operator <<(ostream &, const Poly_Strategy_Data &);
133 protected:
136 };
137 
146 public:
148  virtual ~Pair_Strategy_Data();
151 
152 
154  virtual bool equivalent(const Pair_Strategy_Data &) const = 0;
156  bool operator ==(const Pair_Strategy_Data & sd) const;
158  virtual bool first_larger(const Pair_Strategy_Data &) const = 0;
160  bool operator >(const Pair_Strategy_Data & sd) const;
162  bool operator >=(const Pair_Strategy_Data & sd) const;
164  bool operator <(const Pair_Strategy_Data & sd) const;
166  bool operator <=(const Pair_Strategy_Data & sd) const;
168 
169 
177  virtual void pre_spolynomial_tasks() const;
179 };
180 
181 #endif
The general class of a polynomial.
Definition: polynomial.hpp:101
const Abstract_Polynomial * p
the polynomial to which this strategy applies
Definition: strategies.hpp:135
polynomial-related strategy data
Definition: strategies.hpp:49
Structure for sorting critical pairs.
Definition: strategies.hpp:145
virtual void at_generation_tasks()
hook called while first generating polynomial
Definition: strategies.hpp:88
StrategyFlags
flag indicating which strategy to use for computation
Definition: strategies.hpp:34
virtual void pre_reduction_tasks(const EXP_TYPE *u, const Abstract_Polynomial &g)
hook called immediately before performing reduction
Definition: strategies.hpp:124
Implementation of monomials.
Definition: monomial.hpp:69
const EXP_TYPE * log() const
Direct access to the exponents, for whatever reason.
Definition: monomial.hpp:157
virtual void at_generation_tasks(const Monomial &t)
hook called while first generating a polynomial multiple
Definition: strategies.hpp:96