27 _internalTracker(
"internal nodes"),
28 _leafTracker(
"leaf nodes") {
38 fputs(
"**** Slice Algorithm Statistics ****\n",
_out);
87 _idealGenSum += _prelimIdealGenCount;
88 _subGenSum += _prelimSubGenCount;
89 _varSum += _prelimVarCount;
91 size_t genCountLog2 = 0;
92 if (_prelimIdealGenCount > 0)
93 genCountLog2 = (size_t)(log((
double)_prelimIdealGenCount) / log((
double)2));
94 _nodesByGenCount[genCountLog2] += 1;
98 fprintf(out,
"|-%s:\n", _title.c_str());
100 gmp_fprintf(out,
" | %Zd nodes\n", getNodeCount().get_mpz_t());
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);
107 size_t genCountLog2 = _nodesByGenCount.rbegin()->first;
109 mpz_class nodeCount = 0;
110 map<size_t, mpz_class>::const_iterator it =
111 _nodesByGenCount.find(genCountLog2);
112 if (it != _nodesByGenCount.end())
113 nodeCount = it->second;
115 gmp_fprintf(out,
" | %Zd nodes has log2(#gens) = %Zd.\n",
116 nodeCount.get_mpz_t(),
117 mpz_class(genCountLog2).get_mpz_t());
119 if (genCountLog2 == 0)
134 mpq_class q = mpq_class(_idealGenSum) / _nodeCount;
143 mpq_class q = mpq_class(_subGenSum) / _nodeCount;
152 mpq_class q = mpq_class(_varSum) / _nodeCount;
Represents a monomial ideal with int exponents.
size_t getGeneratorCount() const
This class describes the interface of a strategy object for the Slice Algorithm.
virtual void setUseSimplification(bool use)=0
This method should only be called before calling run().
virtual void freeSlice(auto_ptr< Slice > slice)=0
It is allowed to delete returned slices directly, but it is better to use freeSlice.
virtual void setUseIndependence(bool use)=0
This method should only be called before calling run().
virtual bool processSlice(TaskEngine &tasks, auto_ptr< Slice > slice)=0
Process the parameter slice.
virtual bool getUseSimplification() const =0
virtual void run(const Ideal &ideal)=0
Run the Slice algorithm.
This class represents a slice, which is the central data structure of the Slice Algorithm.
const Ideal & getIdeal() const
Returns for a slice .
Ideal & getSubtract()
Returns for a slice .
size_t getVarCount() const
Returns the number of variables in the ambient ring.
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
StatTracker _internalTracker
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().
SliceStrategy * _strategy
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.