24 using std::cout;
using std::endl;
26 #include "system_constants.hpp" 29 #include "monomial.hpp" 30 #include "polynomial.hpp" 32 #include "dynamic_engine.hpp" 34 #include "algorithm_buchberger_basic.hpp" 35 #include "algorithm_buchberger_dynamic.hpp" 37 int main(
int argc,
char *argv[]) {
38 if (argc != 3 or (strcmp(argv[2],
"stat") and strcmp(argv[2],
"dyn"))) {
39 cout <<
"need to know method (usually 2) and then if dynamic (stat or dyn)\n";
44 bool static_algorithm =
true;
45 if (!strcmp(argv[2],
"dyn")) static_algorithm =
false;
48 string X [9] = {
"a",
"b",
"c",
"d",
"r",
"s",
"t",
"x",
"y"} ;
51 DEG_TYPE e0 [] { 0, 0, 0, 0, 0, 0 };
54 Monomial bx { 0, 1, 0, 0, 0, 0, 0, 1, 0 };
55 Monomial ay { 1, 0, 0, 0, 0, 0, 0, 0, 1 };
61 Monomial dx { 0, 0, 0, 1, 0, 0, 0, 1, 0 };
62 Monomial d1 { 0, 0, 0, 1, 0, 0, 0, 0, 0 };
63 Monomial cy { 0, 0, 1, 0, 0, 0, 0, 0, 1 };
64 Monomial y1 { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
70 Monomial b2 { 0, 2, 0, 0, 0, 0, 0, 0, 0 };
71 Monomial a2 { 2, 0, 0, 0, 0, 0, 0, 0, 0 };
72 Monomial r2 { 0, 0, 0, 0, 2, 0, 0, 0, 0 };
78 Monomial c2 { 0, 0, 2, 0, 0, 0, 0, 0, 0 };
79 Monomial c1 { 0, 0, 1, 0, 0, 0, 0, 0, 0 };
80 Monomial one { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
81 Monomial d2 { 0, 0, 0, 2, 0, 0, 0, 0, 0 };
82 Monomial s2 { 0, 0, 0, 0, 0, 2, 0, 0, 0 };
83 Monomial M4 [] { c2, c1, one, d2, s2 };
88 Monomial ac { 1, 0, 1, 0, 0, 0, 0, 0, 0 };
89 Monomial bd { 0, 1, 0, 1, 0, 0, 0, 0, 0 };
90 Monomial t2 { 0, 0, 0, 0, 0, 0, 2, 0, 0 };
91 Monomial M5 [] { a2, ac, c2, b2, bd, d2, t2 };
96 cout <<
"Computing a Groebner basis for\n\t" << f1
103 list<Abstract_Polynomial *> F;
104 F.push_back(&f1); F.push_back(&f2); F.push_back(&f3);
105 F.push_back(&f4); F.push_back(&f5);
106 list<Constant_Polynomial *> G;
107 if (static_algorithm) G =
buchberger(F, method, StrategyFlags::SUGAR_STRATEGY);
109 F, method, StrategyFlags::SUGAR_STRATEGY,
nullptr,
110 DynamicHeuristic::ORD_HILBERT_THEN_DEG
115 g->leading_monomial().print(
true, cout, R.name_list());
A Constant_Polynomial is a polynomial that should not change.
list< Constant_Polynomial * > buchberger(const list< Abstract_Polynomial *> &F, SPolyCreationFlags method, StrategyFlags strategy, WT_TYPE *strategy_weights)
Implementation of Buchberger’s algorithm.
Information necessary for a field modulo a prime.
Prime_Field_Element unity()
“unity” is the multiplicative identity.
SPolyCreationFlags
flag indicating which structure to use for an s-polynomial
Implementation of monomials.
Element of a field of prime characteristic.
Encapsulates information about a polynomial ring for easy access: ground field, number of indetermina...
list< Constant_Polynomial * > buchberger_dynamic(const list< Abstract_Polynomial *> &F, SPolyCreationFlags method, StrategyFlags strategy, WT_TYPE *strategy_weights, DynamicHeuristic heuristic, DynamicSolver solver_type, bool analyze_inputs)
implementation of the dynamic Buchberger algorithm