Frobby 0.9.5
SliceParameters.cpp
Go to the documentation of this file.
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see http://www.gnu.org/licenses/.
16*/
17#include "stdinc.h"
18#include "SliceParameters.h"
19
20#include "SliceFacade.h"
21#include "error.h"
23#include "BigattiFacade.h"
24
28 _exposeBoundParam(exposeBoundParam),
29 _exposeIndependenceParam(exposeIndependenceParam),
30
31 _printDebug
32 ("debug",
33 "Print what the algorithm does at each step.",
34 false),
35
36 _printStatistics
37 ("stats",
38 "Print statistics on what the algorithm did.",
39 false),
40
42 ("bound",
43 "Use the bound optimization to solve optimization problems faster\n"
44 "by eliminating non-improving slices.",
46
48 ("boundSimplify",
49 "Use the bound optimization to solve optimization problems faster by\n"
50 "simplifying slices through seeking to generate non-improving slices.\n"
51 "This requires turning elimination of non-improving slices on.",
53
54 _useIndependence
55 ("independence",
56 "Perform independence splits when possible.",
58
59 _useSimplification
60 ("simplify",
61 "Perform simplification when possible.",
62 true),
63
64 _minimal
65 ("minimal",
66 "Specifies that the input ideal is minimally generated by the given\n"
67 "generators. Turning this on can improve performance, but if it is not\n"
68 "true then Frobby may go into an infinite loop or produce incorrect results.",
69 false),
70
71 _canonical
72 ("canon",
73 "Sort the output, including the variables, to get a canonical\n"
74 "representation. This requires storing the entire output in memory, which\n"
75 "can increase run time modestly and increase memory consumption greatly.",
76 false),
77
78 _useBigattiGeneric
79 ("genericBase",
80 "Detect generic ideals as a base case of the Bigatti algorithm.",
81 true),
82
83 _widenPivot
84 ("widenPivot",
85 "Widen selected pivots when performing pivot splits.\n"
86 "Bigatti et.al. algorithm only.",
87 true),
88
89 _split
90 ("split",
91 "The split selection strategy to use. Slice options are maxlabel, minlabel,\n"
92 "varlabel, minimum, median, maximum, mingen, indep and gcd. Optimization\n"
93 "computations support the specialized strategy degree as well.",
94 "median") {
102 if (_exposeBoundParam) {
105 }
107
111
113 (" Slice algorithm only.");
115 (" Slice algorithm only.");
117 (" Slice algorithm only.");
119 ("\nSlice algorithm only.");
121 ("\nThe impact for the Bigatti et.al. algorithm is much less than for the"
122 "\nSlice Algorithm since the Bigatti et.al. algorithm always has to\n"
123 "store the entire output in memory regardless of this option.");
125 ("\nBigatti et.al. options are median, mostNGPure, mostNGGcd,\n"
126 "mostNGTight, typicalPure, typicalGcd, typicalTight, typicalNGPure,\n"
127 "typicalNGGcd, typicalNGTight, someNGPure, someNGGcd and someNGTight.");
128 }
129}
130
134
135void SliceParameters::setSplit(const string& split) {
136 _split = split;
137}
138
142
146
148 return _canonical;
149}
150
151const string& SliceParameters::getSplit() const {
152 return _split.getValue();
153}
154
156 bool allowDegree) {
159
160 if (split.get() == 0)
161 reportError("Unknown Slice split strategy \"" + _split.getValue() + "\".");
162
163 if (!allowLabel && split->isLabelSplit())
164 reportError("Label split strategy is not appropriate "
165 "in this context.");
166
167 // TODO: implement degree when there is no grading too, so that it
168 // is always appropriate.
169 if (!allowDegree && _split.getValue() == "degree") {
170 reportError("The split strategy degree is not appropriate "
171 "in this context.");
172 }
173
174 // TODO: remove the deprecated frob.
175 if (!allowDegree && _split.getValue() == "frob") {
176 reportError("The split strategy frob is not appropriate "
177 "in this context.");
178 }
179}
180
182 auto_ptr<BigattiPivotStrategy> split = BigattiPivotStrategy::createStrategy
183 (_split.getValue().c_str(), _widenPivot);
184
185 if (split.get() == 0)
186 reportError("Unknown Bigatti et.al. pivot strategy \"" +
187 _split.getValue() + "\".");
188}
189
191 return _printDebug;
192}
193
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
bool _useBoundSimplification
bool _useBoundElimination
void addParameter(Parameter *parameter)
void appendToDescription(const char *str)
Definition Parameter.cpp:31
bool getPrintStatistics() const
Returns the value of the stats option.
BoolParameter _printDebug
BoolParameter _canonical
void validateSplit(bool allowLabel, bool allowDegree)
Checks that the slice split selection strategy specified is valid.
bool getCanonical() const
Get the value of the canonical option.
void validateSplitHilbert()
Checks that the Bigatti Et.al.
void setSplit(const string &split)
Set the value of the option for choosing the split selection strategy.
SliceParameters(bool exposeBoundParams=false, bool exposeIndependenceParam=true, bool supportBigattiAlgorithm=false)
Construct the parameters with default values.
BoolParameter _useIndependence
BoolParameter _printStatistics
bool getUseBoundElimination() const
Get the value of the bound elimination option.
BoolParameter _widenPivot
BoolParameter _useBoundSimplification
BoolParameter _minimal
StringParameter _split
const string & getSplit() const
Get the value of the split option.
BoolParameter _useSimplification
BoolParameter _useBigattiGeneric
bool getUseBoundSimplification() const
Get the value of the bound simplification option.
bool getPrintDebug() const
Returns the value of the debug option.
BoolParameter _useBoundElimination
void setUseIndependence(bool value)
Set the value of the independence split option.
static auto_ptr< SplitStrategy > createStrategy(const string &prefix)
Returns the strategy whose name has the given prefix.
const string & getValue() const
void reportError(const string &errorMsg)
Definition error.cpp:23