27 _internalTracker(
"internal nodes"),
28 _leafTracker(
"leaf nodes") {
36 _strategy->run(ideal);
38 fputs(
"**** Slice Algorithm Statistics ****\n", _out);
39 _internalTracker.printReport(_out);
40 _leafTracker.printReport(_out);
45 _internalTracker.preliminaryRecord(*
slice);
46 _leafTracker.preliminaryRecord(*
slice);
51 _leafTracker.commitRecord();
53 _internalTracker.commitRecord();
59 _strategy->setUseIndependence(
use);
63 _strategy->setUseSimplification(
use);
67 return _strategy->getUseSimplification();
71 _strategy->freeSlice(
slice);
79 _prelimIdealGenCount =
slice.getIdeal().getGeneratorCount();
80 _prelimSubGenCount =
slice.getSubtract().getGeneratorCount();
81 _prelimVarCount =
slice.getVarCount();
87 _idealGenSum += _prelimIdealGenCount;
88 _subGenSum += _prelimSubGenCount;
89 _varSum += _prelimVarCount;
92 if (_prelimIdealGenCount > 0)
101 fprintf(
out,
" | %f generators of ideal on avg.\n", getAvgIdealGenCount());
102 fprintf(
out,
" | %f generators of subtract on avg.\n", getAvgSubGenCount());
103 fprintf(
out,
" | %f variables of ambient ring on avg.\n", getAvgVarCount());
105 if (!_nodesByGenCount.empty()) {
106 fputs(
" |- nodes by log base 2 of ideal generator count:\n",
out);
110 map<size_t, mpz_class>::const_iterator
it =
112 if (
it != _nodesByGenCount.end())
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
Represents a monomial ideal with int exponents.
This class describes the interface of a strategy object for the Slice Algorithm.
This class represents a slice, which is the central data structure of the Slice Algorithm.
virtual void setUseSimplification(bool use)
This method should only be called before calling run().
virtual void run(const Ideal &ideal)
Run the Slice algorithm.
StatisticsStrategy(SliceStrategy *strategy, FILE *out)
Statistics are written to out, and every call is delegated to strategy.
virtual bool processSlice(TaskEngine &tasks, auto_ptr< Slice > slice)
Process the parameter slice.
virtual bool getUseSimplification() const
virtual void freeSlice(auto_ptr< Slice > slice)
It is allowed to delete returned slices directly, but it is better to use freeSlice.
virtual void setUseIndependence(bool use)
This method should only be called before calling run().
virtual ~StatisticsStrategy()
TaskEngine handles a list of tasks that are to be carried out.
void printReport(FILE *out) const
Print a report on statistics of the recorded slices to the file out.
StatTracker(const string &title)
The title parameter indicates what is to be printed when calling printReport().
double getAvgVarCount() const
const mpz_class & getNodeCount() const
double getAvgSubGenCount() const
void commitRecord()
Commit the most recent argument to preliminaryTrack permanently to the record.
double getAvgIdealGenCount() const
void preliminaryRecord(const Slice &slice)
Record information about slice, but store it only until this method is next called on this object.