17
17
#include "termorder.h"
18
18
#include "ep_standard.h"
19
19
#include "ep_xfig.h"
20
#include "field_rationalfunctions2.h"
20
21
#include "gfanapplication.h"
25
#include "traverser_groebnerfan.h"
24
27
static Timer globalTimer("Global-timer",1);
26
29
class GCats : public GFanApplication
28
32
SimpleOption optionInputIsGroebnerBasis;
29
33
SimpleOption optionSymmetry;
30
34
SimpleOption optionEchoSymmetry;
31
35
SimpleOption optionSubspace;
32
36
// SimpleOption optionPerformanceTimer;
33
37
SimpleOption optionDisableSymmetryTest;
38
IntegerOption optionParameters;
40
bool includeInDefaultInstallation()
42
return name1[0]!=0;//Make sure that "gfan" itself does not go to the documentation section of the manual.
35
44
const char *helpText()
37
return "This is a program for computing all reduced Groebner bases of a polynomial ideal. It takes a generating set for the ideal as input. By default the enumeration is done by an almost memoryless reverse search. If the ideal is symmetric the symmetry option is useful and enumeration will be done up to symmetry using a breadth first search. The program needs a starting Groebner basis to do its computations. If the -g option is not specified it will compute one using Buchberger's algorithm.\n";
46
#define HELP "This is a program for computing all reduced Groebner bases of a polynomial ideal. It takes the ring and a generating set for the ideal as input. By default the enumeration is done by an almost memoryless reverse search. If the ideal is symmetric the symmetry option is useful and enumeration will be done up to symmetry using a breadth first search. The program needs a starting Groebner basis to do its computations. If the -g option is not specified it will compute one using Buchberger's algorithm.\n"
48
// return "This is the Gfan program for computing Groebner fans and tropical vaieties"HELP;
51
GCats(const char *name2):
40
53
// optionPerformanceTimer("-T",
41
54
// "Enable performance timer.\n"),
42
55
optionInputIsGroebnerBasis("-g",
48
61
optionEchoSymmetry("-e","Echo. Output the generators for the symmetry group.\n"),
49
62
optionSubspace("--subspace",
50
63
"Only do breadth first search on cones with their interior intersecting a specified subspace. The subspace is given by a list of hyperplane normals at the end of the input. The intersection of the hyperplanes is the subspace being specified. Note that the set of Groebner cones intersecting the subspace could be disconnected and that only one connected component is computed. Works only together with --symmetry.\n"),
51
optionDisableSymmetryTest("--disableSymmetryTest","When using --symmetry this option will disable the check that the group read off from the input actually is a symmetry group with respect to the input ideal.\n")
64
optionDisableSymmetryTest("--disableSymmetryTest","When using --symmetry this option will disable the check that the group read off from the input actually is a symmetry group with respect to the input ideal.\n"),
65
optionParameters("--parameters","With this option you can specify how many variables to treat as parameters instead of variables. This makes it possible to do computations where the coefficient field is the field of rational functions in the parameters. This does not work well at the moment.",0)
68
optionSubspace.hide();//Is not supported anymore
63
bool minkowski=false;//Does the Minkowski sum trick work?
64
// Field::printList(Stderr);
66
// LpSolver::printList(Stderr);
67
// lpSetSolver("cddgmp");
72
AsciiPrinter(Stdout).printFieldElement(a+b);
81
debug<<"This is the Gfan program for computing Groebner fans and tropical varieties.\n"
82
"Use the command \"gfan list\" to view all subcommands.\n"
83
"The command \"gfan\" is deprecate for computing all Groebner bases of an ideal.\n"
84
"Please use subcommand \"gfan _bases\" instead. Awaiting input. <Ctrl>-D to end.\n";
76
87
LexicographicTermOrder myOrder;
78
89
PolynomialSet g=FileParser(Stdin).parsePolynomialSetWithRing();
90
if(optionParameters.getValue())g=makeVariablesParameters(makeVariablesParameters(g.getRing(),optionParameters.getValue()),g);
80
92
log3 AsciiPrinter(Stderr).printPolynomialSet(g);
81
93
AsciiPrinter(Stdout).printPolynomialRing(g.getRing());
113
124
log1 fprintf(Stderr,"A reduced Groebner basis has been computed\n");
116
127
SymmetryGroup s(g.numberOfVariablesInRing());
129
IntegerVectorList generators;
119
131
EnumerationAlgorithm *rs;
120
132
if(optionSymmetry.getValue())
122
IntegerVectorList generators=FileParser(Stdin).parseIntegerVectorList();
134
generators=FileParser(Stdin).parseIntegerVectorList();
124
135
if(!optionDisableSymmetryTest.getValue())
126
137
for(IntegerVectorList::iterator i=generators.begin();i!=generators.end();i++)
133
144
s.computeClosure(generators);
134
145
log1 s.print(Stderr);
135
BreadthFirstSearch *bs=new BreadthFirstSearch(s,minkowski);
136
if(optionSubspace.getValue())
137
bs->setSubspace(FileParser(Stdin).parseIntegerVectorList());
140
if(optionEchoSymmetry.getValue())
141
AsciiPrinter(Stdout).printVectorList(generators);
148
{//using old breadth first traversal
149
BreadthFirstSearch *bs=new BreadthFirstSearch(s,/*minkowski*/0);
150
/* if(optionSubspace.getValue())
151
bs->setSubspace(FileParser(Stdin).parseIntegerVectorList());
155
if(optionEchoSymmetry.getValue())AsciiPrinter(Stdout).printVectorList(generators);
158
rs->setEnumerationTarget(ep);
163
{//using new traversal
164
GroebnerFanTraverser traverser(g);
165
TargetGlue target(*ep);
166
if(optionEchoSymmetry.getValue())AsciiPrinter(Stdout).printVectorList(generators);
168
symmetricTraverse(traverser,target,&s);
144
rs=new ReverseSearch(myOrder);
146
// rs->setProgressPrinting(true);
174
rs=new ReverseSearch(myOrder);
147
175
ep->open(Stdout);
148
176
rs->setEnumerationTarget(ep);
151
fprintf(Stderr,"Enumerating...\n");
153
177
rs->enumerate(g);
161
187
globalTimer.off();
162
188
// if(optionPerformanceTimer.getValue())Timer::printList();
168
static GCats theApplication;
194
static GCats theApplication("_bases");
195
static GCats theApplication2("");