Gröbner basis project
Codebase for research into Gröbner basis computation
weighted_sugar_strategy.hpp
1 #ifndef __WEIGHTED_SUGAR_STRATEGY_HPP_
2 #define __WEIGHTED_SUGAR_STRATEGY_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 "strategies.hpp"
24 #include "polynomial.hpp"
25 
27 
40 public:
52  Poly_WSugar_Data(const Abstract_Polynomial * poly, const WT_TYPE * w);
58  virtual bool equivalent(const Poly_Strategy_Data & sd) const;
64  virtual bool first_larger(const Poly_Strategy_Data & sd) const;
69  virtual void at_generation_tasks();
75  virtual void at_generation_tasks(const Monomial & t);
81  virtual void pre_reduction_tasks(
82  const EXP_TYPE * u, const Abstract_Polynomial & g
83  );
85 
87  StrategyFlags type() { return StrategyFlags::WSUGAR_STRATEGY; }
89  DEG_TYPE poly_sugar() const;
91  const WT_TYPE * weighting() const;
93 
94 
96  void change_weights(const WT_TYPE * w) { weights = w; }
98 
99  friend ostream & operator <<(ostream &, const Poly_WSugar_Data &);
102 protected:
104  DEG_TYPE sugar;
106  const WT_TYPE * weights;
107 };
108 
117 public:
119 
126 
127 
129  virtual bool equivalent(const Pair_Strategy_Data & sd) const;
131  virtual bool first_larger(const Pair_Strategy_Data & sd) const;
133 
134 
136  DEG_TYPE pair_sugar();
138 
142  virtual void adjust_sugar(DEG_TYPE new_sugar) { sugar = new_sugar; }
145 protected:
149  DEG_TYPE sugar;
150 };
151 
152 #endif
The general class of a polynomial.
Definition: polynomial.hpp:101
polynomial-related strategy data
Definition: strategies.hpp:49
StrategyFlags type()
type of strategy
Critical_Pair_Basic * cp
the critical pair to which this Normal_Strategy belongs
ordering critical pairs using the weighted sugar strategy
DEG_TYPE poly_sugar() const
the sugar itself
DEG_TYPE sugar
the polynomial’s sugar
Structure for sorting critical pairs.
Definition: strategies.hpp:145
virtual bool first_larger(const Poly_Strategy_Data &sd) const
returns true iff this sugar is larger than sd ’s
DEG_TYPE sugar
the pair*rsquo;s sugar
virtual void pre_reduction_tasks(const EXP_TYPE *u, const Abstract_Polynomial &g)
re-evaluates the sugar, if need be
StrategyFlags
flag indicating which strategy to use for computation
Definition: strategies.hpp:34
virtual void at_generation_tasks()
sets the sugar to the largest weighted degree of a monomial in the assigned previously polynomial ...
polynomial-related data for a weighted sugar strategy
Implementation of monomials.
Definition: monomial.hpp:69
Poly_WSugar_Data(const Abstract_Polynomial *poly, const WT_TYPE *w)
records poly as the reference for this
const WT_TYPE * weights
pointer to the weights
void change_weights(const WT_TYPE *w)
changes the weights used to compute the sugar to w
const WT_TYPE * weighting() const
the weights used to compute the sugar
Controls the creation of s-polynomials.
virtual bool equivalent(const Poly_Strategy_Data &sd) const
returns true iff the sugars are equal